/* Define color variables for the theme */
:root {
  --bg: #f9f9f9; /* Light background color */
  --card: #ffffff; /* Card background color */
  --panel-shadow: rgba(0, 0, 0, 0.1); /* Soft shadow for panels */
  --accent: #4CAF50; /* Modern green accent color */
  --accent-light: #E8F5E9; /* Light green for accents */
  --text: #212121; /* Dark text color */
  --muted: #757575; /* Muted text color */
  --border-radius: 12px; /* Rounded corners */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; /* System font stack */
}

/* General page styles */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-family);
  margin: 20px;
  line-height: 1.6;
  padding-bottom: 80px; /* space for bottom HUD */
}

/* Title styles */
h1 {
  text-align: center;
  margin-bottom: 1em;
  font-size: 2.5rem;
  font-weight: 500;
}

/* Accordion styles (collapsible sections) */
details.accordion {
  background: var(--card);
  margin-bottom: 1em;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 6px var(--panel-shadow);
  overflow: hidden;
}

details.accordion summary {
  list-style: none;
  cursor: pointer;
  padding: 1em;
  font-weight: 600;
  user-select: none;
  font-size: 1.2rem;
}

/* Hide the default triangle marker for <summary> */
details.accordion summary::-webkit-details-marker { display: none; }

/* Add a custom triangle marker for <summary> */
details.accordion summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.5em;
  transition: transform 0.2s ease;
  color: var(--accent);
}

/* Rotate the triangle when the accordion is open */
details.accordion[open] summary::before {
  transform: rotate(90deg);
}

/* Padding for accordion content */
details.accordion > *:not(summary) {
  padding: 0 1em 1em;
}

/* Input and select field styles */
input, select {
  border: 1px solid #ccc;
  border-radius: var(--border-radius);
  padding: 10px;
  width: 100%;
  box-sizing: border-box;
  margin-top: 4px;
  font-size: 1rem;
}

/* Label styles */
label {
  margin-top: 10px;
  display: block;
  font-weight: 500;
}

/* Form and table spacing */
form, table { margin-bottom: 20px; }

/* Table styles */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: 0 2px 4px var(--panel-shadow);
}

th, td {
  border: 1px solid #e0e0e0;
  padding: 12px;
  text-align: left;
  font-size: 0.9rem;
}

/* Totals section styles */
#totals div {
  display: inline-block;
  margin-right: 15px;
  font-weight: 600;
  font-size: 1rem;
}

/* Button styles */
button, .action-btn {
  padding: 10px 16px;
  cursor: pointer;
  border-radius: var(--border-radius);
  margin-top: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  transition: background 0.2s;
}

/* Hover effect for buttons */
button:hover, .action-btn:hover { background: #45a049; }

/* Special button styles */
button#reset-btn { background: #e53935; } /* Red button for reset */
button#export-btn { background: #2196F3; } /* Blue button for export */
button#export-btn:hover { background: #1e88e5; }
button#import-btn { background: var(--accent); margin-left: 5px; }

/* Drag-and-drop area for importing files */
#import-drop {
  border: 2px dashed #ccc;
  padding: 20px;
  text-align: center;
  margin-top: 10px;
  border-radius: var(--border-radius);
  color: #888;
  font-size: 0.9rem;
}

/* Highlight drag-and-drop area when dragging a file */
#import-drop.dragover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--text);
}

/* Small action buttons (Edit/Delete) */
.action-btn { padding: 6px 12px; margin-left: 4px; }
.delete-btn { background-color: #e53935; } /* Red for delete */
.update-btn { background-color: #039be5; } /* Blue for update */

/* Message for strain updates */
#strain-message { color: var(--accent); margin-top: 10px; font-weight: 500; }

/* Inventory item styles */
.inventory-item { margin-bottom: 8px; font-size: 1rem; }

/* Hide file input field */
input[type="file"] { display: none; }

/* Make the sales entries table scrollable */
#entries-table {
  overflow-x: auto;
  display: block;
  white-space: nowrap;
}

/* Modernized styles for the bottom navigation bar */
#hud-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--card);
  box-shadow: 0 -2px 6px var(--panel-shadow);
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
  z-index: 1000;
}

#hud-bar button {
  background: none;
  border: none;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  cursor: pointer;
  transition: color 0.2s;
}

#hud-bar button svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

#hud-bar button.active {
  color: var(--accent);
}

#hud-bar button span {
  font-size: 0.75rem;
  margin-top: 4px;
  color: inherit;
}

#hud-bar button:hover {
  color: var(--accent);
}

/* Updated styles for the settings menu */
#settings-menu {
  background: var(--card);
  border: 2px solid var(--accent);
  color: var(--text);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 12px var(--panel-shadow);
  padding: 1em;
  max-width: 400px;
  margin: 0 auto;
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 1000;
  display: none; /* Hidden by default */
  animation: fadeIn 0.3s ease-in-out;
}

#settings-menu[open] {
  display: block; /* Show when open */
}

/* Add a fade-in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Style the buttons inside the settings menu */
#settings-menu button {
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  font-size: 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: background 0.2s;
}

#settings-menu button:hover {
  background: #45a049; /* Slightly darker green */
}

/* Style the drag-and-drop area */
#settings-menu #import-drop {
  border: 2px dashed var(--accent);
  padding: 15px;
  text-align: center;
  border-radius: var(--border-radius);
  color: var(--muted);
  margin-top: 10px;
}

#settings-menu #import-drop.dragover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--text);
}

/* Override chevron marker with CSS-drawn arrow (robust across encodings) */
details.accordion summary::before {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  border-right: 2px solid var(--accent);
  border-top: 2px solid var(--accent);
  margin-right: 0.5em;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}
details.accordion[open] summary::before { transform: rotate(135deg); }

/* Focus styles for inputs and buttons */
input:focus, select:focus, button:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Preset buttons for quick amounts */
#amount-presets .preset-btn {
  background: var(--accent-light);
  color: var(--accent);
  padding: 6px 10px;
  font-size: 0.95rem;
}
#amount-presets .preset-btn:hover {
  background: #cdebd3;
}
