/* Utility classes for layout and spacing */
.flex-row {
  display: flex;
  flex-direction: row;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.flex-1 {
  flex: 1 1 0%;
}

.flex-grow-1 {
  flex-grow: 1;
}

.gap-xs {
  gap: 0.2rem;
}

.gap-sm {
  gap: 0.5rem;
}

.gap-md {
  gap: 1rem;
}

.gap-lg {
  gap: 2rem;
}

.ml-auto {
  margin-left: auto;
}

.ml-05 {
  margin-left: 0.5rem;
}

.w-100 {
  width: 100%;
}

.overflow-y-auto {
  overflow-y: auto;
}

.space-between {
  justify-content: space-between;
}

.align-items-center {
  align-items: center;
}

.mb-05 {
  margin-bottom: 0.5rem;
}

.border-bottom {
  border-bottom: 1px solid var(--border);
}

.d-none {
  display: none !important;
}

/* New Modern Dark Theme for Fuzzy Macro */
@import url("https://fonts.googleapis.com/css2?family=Libre+Franklin:ital,wght@0,100..900;1,100..900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");

/* Font utility classes used across HTML imports */
.poppins-regular {
  font-family: "Poppins", sans-serif;
  font-weight: 400;
}
.poppins-medium {
  font-family: "Poppins", sans-serif;
  font-weight: 500;
}
.poppins-semibold {
  font-family: "Poppins", sans-serif;
  font-weight: 600;
}
.poppins-bold {
  font-family: "Poppins", sans-serif;
  font-weight: 700;
}

:root {
  --background: #121212;
  --surface: #1E1E1E;
  --surface-hover: #2C2C2C;
  --surface-dim: #141414;
  --primary: #ab8062;
  /* Default Brown */
  --primary-hover: #cd9975;
  --primary-rgb: 171, 128, 98;
  --text-main: #E0E0E0;
  --text-dim: #A0A0A0;
  --border: #333333;
  --active-text: #ffffff;
  --active-img: none;
  --drag-item-bg: #262626;
  --textbox-bg: #2b2b2b;
  /* Reset filter */
}

/* Purple Theme Overrides */
.theme-purple {
  --primary: #9d8ec3;
  --primary-hover: #b4a6d6;
  --primary-rgb: 157, 142, 195;
}

/* Cream/Sunny Theme Overrides (main color: #efda98) */
.theme-cream {
  --primary: #efda98;
  --primary-hover: #f4e3b2;
  --primary-rgb: 239, 218, 152;
}

/* Red Theme Overrides (main color: #840909) */
.theme-red {
  --primary: #cb4144;
  --primary-hover: #9f1a1a;
  --primary-rgb: 132, 9, 9;
}

/* Blue Theme Overrides (main color: #3fc1c3) */
.theme-blue {
  --primary: #3fc1c3;
  --primary-hover: #3ab0b2;
  --primary-rgb: 63, 193, 195;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--background);
  color: var(--text-main);
  font-family: "Poppins", sans-serif;
  height: 100vh;
  overflow: hidden;
  display: flex;
  font-size: 14px;
  animation: pageFadeIn 1.0s ease-out;
}

button {
  all: unset;
  cursor: pointer;
}

ul,
h1,
h2,
h3,
h4,
a,
p {
  all: unset;
  display: block;
}

input:focus,
select:focus {
  outline: none;
}

/* Layout - defined in index.html structure */
.app-container {
  display: flex;
  width: 100%;
  height: 100%;
}

.sidebar-container {
  width: 240px;
  background-color: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.main-content-container {
  flex-grow: 1;
  padding: 2rem;
  overflow-y: auto;
  background-color: var(--background);
  display: flex;
  flex-direction: column;
}

/* Sidebar Styling */
.sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 1rem;
}

.sidebar-item {
  padding: 0.8rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-dim);
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 0.95rem;
}

.sidebar-item:hover {
  background-color: var(--surface-hover);
  color: var(--text-main);
}

.sidebar-item.active {
  background-color: rgba(var(--primary-rgb), 0.15);
  color: var(--primary);
  font-weight: 600;
}

/* Sub-nav bar (tabs inside main content) */
.sub-nav-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}

.sub-nav-bar .gather-tab-item,
.sub-nav-bar .boost-tab-item,
.sub-nav-bar .kill-tab-item,
.sub-nav-bar .quests-tab-item,
.sub-nav-bar .config-tab-item,
.sub-nav-bar .planters-tab-item {
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
  border: 1px solid transparent;
}

.sub-nav-bar .gather-tab-item:hover,
.sub-nav-bar .boost-tab-item:hover,
.sub-nav-bar .kill-tab-item:hover,
.sub-nav-bar .quests-tab-item:hover,
.sub-nav-bar .config-tab-item:hover,
.sub-nav-bar .planters-tab-item:hover {
  background-color: var(--surface-hover);
  color: var(--text-main);
  border-color: var(--border);
}

.sub-nav-bar .gather-tab-item.active,
.sub-nav-bar .boost-tab-item.active,
.sub-nav-bar .kill-tab-item.active,
.sub-nav-bar .quests-tab-item.active,
.sub-nav-bar .config-tab-item.active,
.sub-nav-bar .planters-tab-item.active {
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--primary);
  border-color: rgba(var(--primary-rgb), 0.15);
}

.import-export-button {
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
  border: 1px solid transparent;
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--text-main);
  border-color: rgba(var(--primary-rgb), 0.15);
}

.import-export-button:hover {
  background-color: rgba(var(--primary-rgb), 0.15);
  color: var(--primary);
  border-color: rgba(var(--primary-rgb), 0.2);
}


/* Subtab panels: controlled by JS by adding/removing .active */
.sub-tab-panel {
  display: none;
}

.sub-tab-panel.active {
  display: block;
}

/* Icon filters for active state handling via CSS class if needed */
.sidebar-item img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  filter: grayscale(100%);
  opacity: 0.7;
  transition: all 0.2s;
}

.sidebar-item:hover img,
.sidebar-item.active img {
  filter: none;
  opacity: 1;
}

/* Content Areas */
.content {
  display: none;
  /* Controlled by JS */
  flex-direction: column;
  width: 100%;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pageFadeIn {
  from {
    opacity: 0.7;
  }

  to {
    opacity: 1;
  }
}

/* Containers */
.standard-container {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

.standard-container h2 {
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: 1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.standard-container label,
.standard-container h3 {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-main);
}

.standard-container p {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

/* Components */
.purple-button {
  background-color: var(--primary);
  color: #121212;
  border: none;
  border-radius: 6px;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  text-align: center;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.purple-button:hover {
  background-color: var(--primary-hover);
}

.purple-button:active {
  transform: scale(0.98);
}

.purple-button.active {
  background-color: #f04747;
  /* Stop button color */
  color: white;
}

.textbox {
  background-color: var(--textbox-bg);
  /* Slightly lighter than surface */
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem;
  color: var(--text-main);
  font-family: inherit;
  transition: border-color 0.2s;
  font-size: 0.9rem;
}

.textbox:focus {
  border-color: var(--primary);
}

/* Custom Select */
.custom-select {
  cursor: pointer;
  position: relative;
  user-select: none;
}

.custom-select .select-area {
  background-color: var(--textbox-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-main);
}

.custom-select .select-menu {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background-color: var(--textbox-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 100;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 4px;
}

.custom-select .option {
  padding: 0.5rem;
  transition: background-color 0.1s;
}

.custom-select .option:hover {
  background-color: var(--primary);
  color: #121212;
}

.custom-select .chevron {
  font-size: 0.8rem;
  transition: transform 0.2s;
}

/* Modal (Import/Export) Styling */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-dialog {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  max-width: 700px;
  width: 92%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}

.modal-dialog h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.2rem;
  color: var(--text-main);
  font-weight: 600;
}

.modal-dialog p {
  color: var(--text-dim);
  margin: 0 0 1rem 0;
}

.modal-textarea {
  width: 100%;
  min-height: 260px;
  font-family: 'Courier New', monospace;
  padding: 0.75rem;
  border: 1px solid var(--border);
  background-color: var(--textbox-bg);
  color: var(--text-main);
  border-radius: 6px;
  resize: vertical;
  box-sizing: border-box;
  font-size: 0.95rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.btn-cancel {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  font-weight: 600;
}

.btn-cancel:hover {
  background: var(--surface-hover);
}

.btn-confirm {
  background: var(--primary);
  color: #121212;
  border: 1px solid var(--primary);
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  font-weight: 600;
}

.btn-confirm:hover { background: var(--primary-hover); }

/* Checkbox */
.checkbox-container {
  display: flex;
  align-items: center;
  position: relative;
  padding-left: 28px;
  cursor: pointer;
  font-size: 0.95rem;
  user-select: none;
  margin-bottom: 0.5rem;
  min-height: 20px;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 18px;
  width: 18px;
  background-color: var(--textbox-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  transition: all 0.2s;
}

.checkbox-container:hover input~.checkmark {
  border-color: var(--text-dim);
}

.checkbox-container input:checked~.checkmark {
  background-color: var(--primary);
  border-color: var(--primary);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 9px;
  border: solid #121212;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-container input:checked~.checkmark:after {
  display: block;
}

/* Drag List */
.drag-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 1rem;
}

.drag-item {
  background: var(--drag-item-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin: 0.5rem;
  padding: 0.8rem;
  display: flex;
  align-items: center;
  color: var(--text-main);
}

.drag-item.disabled {
  background: var(--surface-dim);
  color: var(--text-dim);
  opacity: 0.6;
}

.drag-item:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
}

.drag-handle {
  margin-right: 1rem;
  cursor: grab;
  color: var(--text-dim);
}

/* Category badges */
.category-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-right: 0.5rem;
  text-transform: uppercase;
  color: #121212;
}

.drag-item[data-category="gather"] .category-badge {
  background: #5865f2;
  color: #fff;
}

.drag-item[data-category="collect"] .category-badge {
  background: #57f287;
}

.drag-item[data-category="kill"] .category-badge {
  background: #ed4245;
  color: #fff;
}

.drag-item[data-category="quest"] .category-badge {
  background: #fee75c;
}

.drag-item[data-category="special"] .category-badge {
  background: #eb459e;
  color: #fff;
}


/* Specific Pages */
#home-parent {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#home-placeholder {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 1rem;
}

#log {
  background-color: #000;
  color: #eee;
  font-family: "Consolas", monospace;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  height: 300px;
  overflow-y: auto;
  font-size: 0.85rem;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Credits */
.credits {
  margin-top: auto;
  padding: 1rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
}

/* Ensure images in standard-container align well (like in Boost page) */
.standard-container img {
  vertical-align: middle;
}

.icon-img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 0.3rem;
}

/* Specific sizing for icons in dropdowns and labels */
.custom-select .option img,
.standard-container label img {
  width: 18px;
  height: 18px;
  margin-right: 0.4rem;
}

/* Missing classes from original specific to functionality */
.manual-planters-field,
.manual-planters-planters {
  width: 10rem;
}

.cycle-spacing {
  display: flex;
  gap: 5rem;
  margin-left: 3rem;
  margin-top: -0.7rem;
  align-items: center;
}

.emoji-text {
  display: flex;
  align-items: center;
}

/* Planter timers */
#planter-timers-container {
  display: none;
}

#planter-timers-container.show {
  display: flex;
}

.planter-timers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  width: 100%;
  margin-top: 1rem;
}

.planter-timers .planter {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  padding: 1rem;
  border-radius: 8px;
}

.planter-timers .planter-img-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.planter-timers .planter-img {
  width: 40px;
  display: block;
}

.planter-timers .planter-nectar-overlay {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.planter-timers .planter span {
  text-align: center;
  font-size: 0.9rem;
}

.planter-timers .planter .time {
  color: #adb5bd;
}

.planter-timers .planter span.ready {
  color: #4caf50;
}

/* Custom style for the select menu */
#macro_mode {
  appearance: none;
  background-color: var(--surface);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

#macro_mode:hover {
  background-color: var(--surface-hover);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

#macro_mode:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary);
}

/* Optional: Add a custom arrow for the dropdown */
#macro_mode {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23E0E0E0'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1rem;
}

/* Ensure the dropdown options match the theme */
#macro_mode option {
  background-color: var(--surface);
  color: var(--text-main);
}

.app-title {
  font-family: 'Libre Franklin', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--primary);
  margin: 1rem 0;
  text-align: center;
}

.task-list-scroll {
  overflow-y: auto;
}

#logs {
  flex: 1 1 0%;
  min-height: 0;
  /* Prevents overflow issues in flex containers */
}

/* Drag Action Buttons */
.drag-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.drag-action-btn {
  background-color: var(--primary);
  color: #121212;
  border: none;
  border-radius: 4px;
  padding: 0.3rem 0.6rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  font-size: 0.75rem;
  margin-left: 0.5rem;
}

.drag-action-btn:hover {
  background-color: var(--primary-hover);
}

.drag-action-btn:active {
  transform: scale(0.98);
}

/* Profile Management Styles */
.profile-card {
  background: var(--surface);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.profile-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.8rem;
}

.profile-card-title {
  color: var(--text-main);
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.profile-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 1rem;
}

.profile-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--textbox-bg);
  padding: 0.8rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  cursor: pointer;
}

.profile-item:hover {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.profile-item.active {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.1);
}

.profile-item-name {
  color: var(--text-main);
  font-weight: 500;
}

/* Profile Inputs */
.profile-input {
  background-color: var(--textbox-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.6rem;
  color: var(--text-main);
  font-family: inherit;
  transition: border-color 0.2s;
  flex-grow: 1;
}

.profile-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Profile Buttons */
.profile-btn {
  border: none;
  border-radius: 4px;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.current-profile-badge {
  background-color: var(--primary);
  color: #121212;
  border-radius: 4px;
  padding: 0.2rem 0.4rem;
  font-size: 0.75rem;
  margin-left: 0.25rem;
}

.profile-btn:active {
  transform: scale(0.98);
}

.profile-btn-primary {
  background-color: var(--primary);
  color: #121212;
}

.profile-btn-primary:hover {
  background-color: var(--primary-hover);
}

.profile-btn-success {
  background-color: #43b581;
  color: #fff;
}

.profile-btn-success:hover {
  background-color: #3ca374;
}

.profile-btn-secondary {
  background-color: #4f545c;
  color: #fff;
}

.profile-btn-secondary:hover {
  background-color: #72767d;
}

/* Modal styling overrides */
#import-profile-modal>div {
  background-color: var(--surface) !important;
  border-color: var(--border) !important;
}

#import-profile-modal h3 {
  color: var(--text-main) !important;
}

/* Disable specific control buttons (visual + interaction) */
/* Start/Stop, import patterns, update, and profile import/export controls */
.start-btn,
#start-btn,
#stop-btn,
#import-patterns-button,
.import-export-button,
button[onclick*="exportProfile"],
button[onclick*="confirmImportProfile"],
button[onclick*="import-profile-file"],
.profile-btn-secondary,
.profile-btn-primary {
  opacity: 0.45 !important;
  pointer-events: none !important;
  cursor: not-allowed !important;
}

/* Also make the export select and hidden file input inert visually */
#export-profile-select,
#import-profile-file {
  opacity: 0.45 !important;
  pointer-events: none !important;
}

/* Gather import/export controls and beta update button */
#export-field-button,
#import-field-button,
#confirm-import-button,
#cancel-import-button,
#import-modal,
#beta_update_button,
#reset-field-button,
#export_debug_button {
  opacity: 0.45 !important;
  pointer-events: none !important;
  cursor: not-allowed !important;
}
