/* PWA Full-Screen Support */
@media (display-mode: fullscreen) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  
  .header {
    padding-top: calc(env(safe-area-inset-top) + 10px);
  }
}

@media (display-mode: standalone) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  
  .header {
    padding-top: calc(env(safe-area-inset-top) + 10px);
  }
}

:root {
  /* Light Mode Colors */
  --primary-blue: #007AFF;
  --primary-blue-rgb: 0, 122, 255; /* RGB values for primary blue for opacity usage */
  --text-dark: #1D1D1F;
  --text-medium: #6E6E73;
  --background-light: #F5F5F7;
  --white: #FFFFFF;
  --border-light: #E8E8ED;
  --success-green: #34C759;
  --error-red: #FF3B30;
  --warning-orange: #FF9500;
  --table-stripe: #FDFDFE; /* For striped table rows */
  --table-hover: #F0F0F2; /* For table row hover */
  --button-hover-bg: rgba(0, 122, 255, 0.08); /* Blue button hover */
}

/* Dark Mode Colors */
body.dark-mode {
  --primary-blue: #0A84FF; /* Slightly different blue for dark mode */
  --primary-blue-rgb: 10, 132, 255; /* RGB values for primary blue for opacity usage */
  --text-dark: #FFFFFF; /* Pure white text on dark background */
  --text-medium: #E5E5E7; /* Light grey for secondary text */
  --background-light: #1C1C1E; /* Dark background */
  --white: #2C2C2E; /* Darker "white" for elements like containers/headers */
  --border-light: #48484A; /* Darker border */
  --success-green: #30D158;
  --error-red: #FF453A;
  --warning-orange: #FF9F0A;
  --table-stripe: #2C2C2E; /* Dark table stripe */
  --table-hover: #3A3A3C; /* Dark table hover */
  --button-hover-bg: rgba(10, 132, 255, 0.2); /* Dark blue button hover */
  
  /* Additional dark mode variables */
  --dark-surface: #2C2C2E; /* Dark surface for cards and containers */
  --dark-border: #48484A; /* Dark border color */
  --dark-background: #1C1C1E; /* Dark background for elements */
}

body {
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--background-light);
  color: var(--text-dark);
  line-height: 1.5;
  font-size: 15px; /* Default base font size for larger screens */
}

.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 16px 32px;
  border-bottom: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 
    0 8px 32px rgba(102, 126, 234, 0.3),
    0 2px 16px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
  min-height: 80px;
  overflow: hidden;
  position: relative;
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: headerShimmer 3s infinite;
}

@keyframes headerShimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.header .logo {
  height: 48px;
  display: block;
  filter: 
    drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3))
    brightness(1.1)
    contrast(1.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 12px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.header .logo:hover {
  transform: scale(1.1) rotate(5deg);
  filter: 
    drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4))
    brightness(1.3)
    contrast(1.2);
}

.header-nav {
  display: flex;
  gap: 12px;
  align-items: center;
}

.header-title {
  flex: 1;
  text-align: center;
  padding: 0 20px;
}

.header-title h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 800;
  color: white;
  text-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.3),
    0 1px 2px rgba(0, 0, 0, 0.5);
  letter-spacing: -0.8px;
  animation: fadeInSlide 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
}

.header-title h1:hover {
  transform: scale(1.05);
  text-shadow: 
    0 4px 8px rgba(0, 0, 0, 0.4),
    0 2px 4px rgba(0, 0, 0, 0.6),
    0 0 20px rgba(255, 255, 255, 0.3);
}

@keyframes fadeInSlide {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.header-nav button {
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: 8px;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 
    0 4px 15px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.header-nav button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transition: left 0.5s;
}

.header-nav button:hover::before {
  left: 100%;
}

.header-nav button:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 
    0 12px 30px rgba(0, 0, 0, 0.3),
    0 6px 20px rgba(255, 255, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.header-nav button:active {
  transform: translateY(0);
  transition: all 0.1s;
}

/* Special logout button styling */
.header-nav button.logout-btn {
  background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
  border: 2px solid rgba(255, 65, 108, 0.5);
  color: white;
  box-shadow: 
    0 6px 20px rgba(255, 65, 108, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  position: relative;
}

.header-nav button.logout-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%);
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.header-nav button.logout-btn:hover {
  background: linear-gradient(135deg, #ff3838 0%, #ff1744 100%);
  border-color: rgba(255, 23, 68, 0.7);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 
    0 15px 35px rgba(255, 35, 56, 0.5),
    0 8px 25px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.9);
}

.header-nav button.logout-btn:hover::before {
  opacity: 1;
}

/* Dropdown Menu Styles */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-button {
  background: rgba(var(--primary-blue-rgb), 0.08);
  border: 1px solid rgba(var(--primary-blue-rgb), 0.15);
  color: var(--primary-blue);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.dropdown-button:hover {
  background: rgba(var(--primary-blue-rgb), 0.12);
  border-color: rgba(var(--primary-blue-rgb), 0.25);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(var(--primary-blue-rgb), 0.2);
}

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  background-color: var(--white);
  min-width: 180px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border-radius: 8px;
  z-index: 1000;
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.dropdown-content button {
  color: var(--text-dark);
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s ease;
  margin: 0;
  border-radius: 0;
}

.dropdown-content button:hover {
  background-color: var(--table-hover);
}

.dropdown-content button.logout-btn {
  color: var(--error-red);
  border-top: 1px solid var(--border-light);
}

.dropdown.show .dropdown-content {
  display: block;
}

/* Dropdown arrow */
.dropdown-arrow {
  transition: transform 0.2s ease;
}

.dropdown.show .dropdown-arrow {
  transform: rotate(180deg);
}

.container {
  max-width: 960px;
  margin: 24px auto;
  padding: 24px;
  background-color: var(--white);
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  overflow-x: auto; /* For table responsiveness */
}

.section-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-dark);
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group select,
.form-group textarea {
  width: calc(100% - 24px); /* Adjust for padding */
  padding: 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 16px;
  background-color: var(--background-light);
  color: var(--text-dark);
}
.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group input[type="email"]:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}
.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.button-group {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  justify-content: flex-end;
}
.button-group button {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
.button-group button.primary {
  background-color: var(--primary-blue);
  color: var(--white);
}
.button-group button.primary:hover {
  background-color: #006DED;
  transform: translateY(-1px);
}
.button-group button.secondary {
  background-color: var(--background-light);
  color: var(--text-dark);
  border: 1px solid var(--border-light);
}
.button-group button.secondary:hover {
  background-color: #E0E0E5;
  transform: translateY(-1px);
}
.button-group button.warning {
  background-color: var(--warning-orange);
  color: white;
  border: 1px solid var(--warning-orange);
}
.button-group button.warning:hover {
  background-color: #E6850E;
  border-color: #E6850E;
  transform: translateY(-1px);
}

.message-area { /* Renamed from #messages to be a class */
  margin-top: 24px;
  padding: 16px;
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}
.message-area.show {
    opacity: 1;
}
.message-area.success {
  background-color: rgba(52, 199, 89, 0.1);
  color: var(--success-green);
  border: 1px solid var(--success-green);
}
.dark-mode .message-area.success {
    background-color: rgba(48, 209, 88, 0.2);
}
.message-area.error {
  background-color: rgba(255, 59, 48, 0.1);
  color: var(--error-red);
  border: 1px solid var(--error-red);
}
.dark-mode .message-area.error {
    background-color: rgba(255, 69, 58, 0.2);
}
.message-area.info {
  background-color: rgba(0, 122, 255, 0.1);
  color: var(--primary-blue);
  border: 1px solid var(--primary-blue);
}
.dark-mode .message-area.info {
    background-color: rgba(10, 132, 255, 0.2);
}

/* Specific sections for index.html */
#currentItems, #currentEmails {
  margin-top: 20px;
  border: 1px dashed var(--border-light);
  padding: 15px;
  border-radius: 8px;
}
#currentItems h3, #currentEmails h3 {
  margin-top: 0;
  font-size: 18px;
  color: var(--text-dark);
  margin-bottom: 10px;
}
.item-list, .email-list-display {
  list-style: none;
  padding: 0;
  margin: 0;
}
.item-list li, .email-list-display li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-medium);
}
.item-list li:last-child, .email-list-display li:last-child {
  border-bottom: none;
}
.item-list button, .email-list-display button {
  background-color: var(--error-red);
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s ease;
}
.item-list button:hover, .email-list-display button:hover {
  background-color: #E63946;
}
.item-display-text {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.item-display-text .item-name {
    font-size: 14px;
    color: var(--text-medium);
}
.item-display-text .item-notes {
    font-size: 12px;
    font-style: italic;
    color: var(--text-medium);
    margin-top: 4px;
    white-space: pre-wrap;
}

/* Stock Status Styling (for index.html) */
.stock-status-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}
.stock-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.stock-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    color: var(--text-dark);
}
.stock-list li:last-child {
    border-bottom: none;
}
.stock-list .qty-low {
    color: var(--warning-orange);
    font-weight: 500;
}
.stock-list .qty-urgent {
    color: var(--error-red);
    font-weight: 600;
}
.no-stock-message {
    text-align: center;
    color: var(--text-medium);
    padding: 15px 0;
}

/* Order History Table Styling (for orderHistory.html) */
.order-history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
}
body.dark-mode .order-history-table {
    background-color: var(--background-dark);
}
.order-history-table th, .order-history-table td {
    border: 1px solid var(--border-light);
    padding: 12px;
    text-align: left;
    vertical-align: top;
    font-size: 15px;
    color: var(--text-dark);
}
body.dark-mode .order-history-table th, body.dark-mode .order-history-table td {
    border-color: var(--border-light);
}
.order-history-table th {
    background-color: var(--background-light);
    font-weight: 600;
    color: var(--text-dark);
}
body.dark-mode .order-history-table th {
    background-color: var(--white);
}
.order-history-table tr:nth-child(even) {
    background-color: var(--table-stripe);
}
.order-history-table tr:hover {
    background-color: var(--table-hover);
}

/* List styles within table cells */
.order-item-list, .email-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9em;
}
.order-item-list li, .email-list li {
    margin-bottom: 4px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    word-break: break-word;
    color: var(--text-medium);
}
.order-item-list li:last-child, .email-list li:last-child {
    margin-bottom: 0;
}
.order-item-list li strong {
    color: var(--text-dark);
}
.order-item-list li .item-name-qty {
    flex-grow: 1;
}
.item-notes-display {
    font-size: 0.8em;
    font-style: italic;
    color: var(--text-medium);
    white-space: pre-wrap;
}
.email-list li span {
    flex-grow: 1;
    margin-right: 5px;
}
.order-item-list button, .email-list button {
    background-color: var(--error-red);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75em;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
    margin-top: 5px;
}
.order-item-list button:hover, .email-list button:hover {
    background-color: #E63946;
}

.status-dropdown {
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    font-size: 15px;
    color: var(--text-dark);
    background-color: var(--white);
    cursor: pointer;
}
body.dark-mode .status-dropdown {
    background-color: var(--background-dark);
    color: var(--text-dark);
    border-color: var(--border-light);
}
.status-dropdown:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}

/* Action buttons in table */
.action-button-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.action-button-group button {
    background-color: var(--primary-blue);
    color: white;
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
}
.action-button-group button:hover {
    background-color: #006DED;
}
.action-button-group .delete-button {
    background-color: var(--error-red);
}
.action-button-group .delete-button:hover {
    background-color: #E63946;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.4);
  justify-content: center;
  align-items: center;
}
.modal-content {
  background-color: var(--white);
  margin: auto;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  width: 90%;
  max-width: 700px;
  position: relative;
  animation-name: animatetop;
  animation-duration: 0.4s;
  max-height: 90vh;
  overflow-y: auto;
}
body.dark-mode .modal-content {
    background-color: var(--background-light);
}
.close-button {
  color: var(--text-medium);
  position: absolute;
  top: 15px;
  right: 25px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s ease;
}
.close-button:hover,
.close-button:focus {
  color: var(--text-dark);
  text-decoration: none;
}
@keyframes animatetop {
  from {top: -300px; opacity: 0}
  to {top: 0; opacity: 1}
}

/* Form styles within modal */
.modal .form-group {
    margin-bottom: 16px;
}
.modal .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
}
.modal .form-group input[type="text"],
.modal .form-group input[type="number"],
.modal .form-group textarea {
    width: calc(100% - 24px);
    padding: 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 16px;
    background-color: var(--background-light);
    color: var(--text-dark);
}
.modal .form-group input[type="text"]:focus,
.modal .form-group input[type="number"]:focus,
.modal .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}
.modal .form-group textarea {
    min-height: 80px;
    resize: vertical;
}
.modal .button-group {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    justify-content: flex-end;
}
.modal .button-group button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}
.modal .button-group button.primary {
    background-color: var(--primary-blue);
    color: var(--white);
}
.modal .button-group button.primary:hover {
    background-color: #006DED;
    transform: translateY(-1px);
}
.modal .button-group button.secondary {
    background-color: var(--background-light);
    color: var(--text-dark);
    border: 1px solid var(--border-light);
}
.modal .button-group button.secondary:hover {
    background-color: #E0E0E5;
    transform: translateY(-1px);
}
.modal .item-list-edit {
    list-style: none;
    padding: 0;
    margin: 0;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    overflow: hidden;
}
.modal .item-list-edit li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px;
    border-bottom: 1px solid var(--border-light);
    background-color: var(--white);
}
.modal .item-list-edit li:nth-child(even) {
    background-color: var(--table-stripe);
}
body.dark-mode .modal .item-list-edit li:nth-child(even) {
    background-color: var(--table-stripe);
}
.modal .item-list-edit li:last-child {
    border-bottom: none;
}
.modal .item-list-edit .item-details-display {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    margin-right: 15px;
    min-width: 150px;
}
.modal .item-list-edit .item-details-display strong {
    color: var(--text-dark);
    font-size: 1.1em;
}
.modal .item-list-edit .item-details-display span {
    font-size: 0.9em;
    color: var(--text-medium);
    margin-top: 2px;
}
.modal .item-list-edit .item-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    margin-top: 5px;
}
.modal .item-list-edit .item-controls label {
    margin-bottom: 0;
    font-weight: normal;
    color: var(--text-medium);
}
.modal .item-list-edit .item-controls input[type="number"] {
    width: 70px;
    padding: 8px;
    text-align: center;
    font-size: 1em;
    border-radius: 6px;
    background-color: var(--background-light);
    color: var(--text-dark);
}
.modal .item-list-edit .item-controls button {
    padding: 8px 12px;
    font-size: 0.9em;
    border-radius: 6px;
    background-color: var(--error-red);
    color: white;
}
.modal .item-list-edit .item-notes-input {
    width: calc(100% - 2px);
    margin-top: 10px;
    font-size: 0.9em;
    min-height: 50px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background-color: var(--background-light);
    color: var(--text-dark);
}
/* Responsive adjustments for modal items */
@media (max-width: 600px) {
    .modal .item-list-edit li {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px;
    }
    .modal .item-list-edit .item-details-display {
        margin-bottom: 10px;
        margin-right: 0;
        width: 100%;
    }
    .modal .item-list-edit .item-controls {
        width: 100%;
        justify-content: flex-end;
        margin-top: 10px;
    }
    .modal .item-list-edit .item-notes-input {
        width: calc(100% - 20px);
    }
}

/* Modal form-row layout for Create Product */
.modal .form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 16px;
}

.modal .form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.modal .modal-header h2 {
    margin: 0;
    color: var(--text-dark);
    font-size: 20px;
    font-weight: 600;
}

.modal .modal-close {
    font-size: 28px;
    font-weight: bold;
    color: var(--text-medium);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal .modal-close:hover {
    color: var(--text-dark);
}

.modal .modal-body {
    padding: 24px;
}

.modal .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    background-color: var(--background-light);
}

body.dark-mode .modal .modal-footer {
    background-color: var(--dark-background);
    border-top-color: var(--dark-border);
}

@media (max-width: 768px) {
    .modal .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .modal .form-row .form-group {
        margin-bottom: 16px;
    }
}

/* Category dropdown styles */
.category-input-container {
    position: relative;
}

.dropdown-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.dropdown-arrow:hover {
    color: var(--primary);
}

body.dark-mode .dropdown-arrow {
    color: var(--text-secondary);
}

body.dark-mode .dropdown-arrow:hover {
    color: var(--primary);
}

.category-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--white);
    border: 1px solid var(--border-light);
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

body.dark-mode .category-dropdown {
    background-color: var(--dark-surface);
    border-color: var(--dark-border);
}

.category-option {
    padding: 10px 12px;
    cursor: pointer;
    color: var(--text-dark);
    transition: background-color 0.2s ease;
}

.category-option:hover {
    background-color: var(--table-hover);
}

body.dark-mode .category-option:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.category-option:last-child {
    border-radius: 0 0 6px 6px;
}

/* Config Table styles */
.config-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
}
body.dark-mode .config-table {
    background-color: var(--background-dark);
}
.config-table th, .config-table td {
    border: 1px solid var(--border-light);
    padding: 12px;
    text-align: left;
    vertical-align: middle;
    font-size: 15px;
    color: var(--text-dark);
}
body.dark-mode .config-table th, body.dark-mode .config-table td {
    border-color: var(--border-light);
}
.config-table th {
    background-color: var(--background-light);
    font-weight: 600;
    color: var(--text-dark);
}
body.dark-mode .config-table th {
    background-color: var(--white);
}
.config-table tr:nth-child(even) {
    background-color: var(--table-stripe);
}
.config-table tr:hover {
    background-color: var(--table-hover);
}
.config-table input[type="number"],
.config-table input[type="text"],
.config-table select {
    width: calc(100% - 10px);
    padding: 6px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 14px;
    background-color: var(--background-light);
    color: var(--text-dark);
}
.config-table input[type="number"]:focus,
.config-table input[type="text"]:focus,
.config-table select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}
.config-table .action-buttons {
    display: flex;
    gap: 5px;
    justify-content: center;
}
.config-table .action-buttons button {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.config-table .action-buttons .edit-button {
    background-color: var(--primary-blue);
    color: white;
}
.config-table .action-buttons .edit-button:hover {
    background-color: #006DED;
}
.config-table .action-buttons .delete-button {
    background-color: var(--error-red);
    color: white;
}
.config-table .action-buttons .delete-button:hover {
    background-color: #E63946;
}

/* Stock Movement Table Delete Buttons */
.stock-movement-table .action-buttons .delete-button {
    background-color: var(--error-red);
    color: white;
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s ease;
}
.stock-movement-table .action-buttons .delete-button:hover {
    background-color: #E63946;
}

.config-table .action-buttons .save-button {
    background-color: var(--success-green);
    color: white;
}
.config-table .action-buttons .save-button:hover {
    background-color: #28A745;
}
.config-table .action-buttons .cancel-button {
    background-color: var(--text-medium);
    color: white;
}
.config-table .action-buttons .cancel-button:hover {
    background-color: #5A5A5D;
}

/* Stock View Table styles (for viewStock.html) */
.stock-view-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
}
body.dark-mode .stock-view-table {
    background-color: var(--background-dark);
}
.stock-view-table th, .stock-view-table td {
    border: 1px solid var(--border-light);
    padding: 12px;
    text-align: left;
    vertical-align: middle;
    font-size: 15px;
    color: var(--text-dark);
}
body.dark-mode .stock-view-table th, body.dark-mode .stock-view-table td {
    border-color: var(--border-light);
}
.stock-view-table th {
    background-color: var(--background-light);
    font-weight: 600;
    color: var(--text-dark);
}
body.dark-mode .stock-view-table th {
    background-color: var(--white);
}

/* Additional dark mode fixes for text color issues */
body.dark-mode .sticker-preview {
    background-color: var(--white);
    color: var(--text-dark);
}

body.dark-mode .delete-mode-switch::after {
    background-color: var(--text-dark);
}

/* Ensure any missed text elements use proper dark mode colors */
body.dark-mode p,
body.dark-mode span,
body.dark-mode div,
body.dark-mode label {
    color: var(--text-dark);
}

body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select {
    color: var(--text-dark) !important;
    background-color: var(--white);
}

/* Specific fix for manage stock item ID field */
body.dark-mode #stockItemId {
    color: var(--text-dark) !important;
    background-color: var(--white) !important;
}

/* Also fix placeholder text color */
body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
    color: var(--text-medium) !important;
    opacity: 0.7;
}

/* Fix webkit autofill styling in dark mode */
body.dark-mode input:-webkit-autofill,
body.dark-mode input:-webkit-autofill:hover,
body.dark-mode input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-dark) !important;
    -webkit-box-shadow: 0 0 0px 1000px var(--white) inset !important;
    transition: background-color 5000s ease-in-out 0s !important;
}

/* QR Test page specific styles */
.code-block {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 12px;
    margin: 10px 0;
    color: #333;
}

.info-box {
    background: #e8f5e8;
    padding: 15px;
    border-radius: 5px;
    margin: 10px 0;
    color: #2d5a2d;
}

.success-button {
    background: #51cf66 !important;
    color: white;
}

/* Dark mode overrides for QR test page */
body.dark-mode .code-block {
    background: var(--white);
    color: var(--text-dark);
}

body.dark-mode .info-box {
    background: rgba(72, 187, 120, 0.2);
    color: var(--text-dark);
    border: 1px solid rgba(72, 187, 120, 0.3);
}

/* Comprehensive dark mode text color fixes */
body.dark-mode .card,
body.dark-mode .card p,
body.dark-mode .card div,
body.dark-mode .card span,
body.dark-mode .modal p,
body.dark-mode .modal div,
body.dark-mode .modal span,
body.dark-mode .description {
    color: var(--text-dark) !important;
}

/* Fix any remaining hardcoded colors */
body.dark-mode .qr-bridge-container,
body.dark-mode .qr-bridge-container p,
body.dark-mode .qr-bridge-container div {
    color: var(--text-dark) !important;
}

.stock-view-table tr:nth-child(even) {
    background-color: var(--table-stripe);
}
.stock-view-table tr:hover {
    background-color: var(--table-hover);
}
.stock-view-table .status-ok {
    color: var(--success-green);
    font-weight: 500;
}
.stock-view-table .status-low {
    color: var(--warning-orange);
    font-weight: 500;
}
.stock-view-table .status-urgent {
    color: var(--error-red);
    font-weight: 600;
}


/* Responsive adjustments for all pages */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    text-align: center;
    gap: 10px;
    padding: 10px;
  }
  
  .header-nav {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
  }
  
  .header-nav button {
    font-size: 14px;
    padding: 8px 12px;
    min-width: auto;
  }
  
  .container {
    margin: 15px;
    padding: 15px;
  }
  .button-group {
    flex-direction: column;
  }
  .button-group button {
    width: 100%;
  }

  /* MOBILE TEXT READABILITY MODIFICATIONS (Shared across all pages) */
  body {
    font-size: 16px;
    line-height: 1.6;
  }

  .section-title {
    font-size: 22px;
  }

  h3 {
    font-size: 17px;
  }

  label,
  input[type="text"],
  input[type="number"],
  input[type="email"],
  select,
  textarea {
    font-size: 16px;
  }

  /* Specific for item lists (index.html, stickers.html) */
  .item-list li,
  .email-list-display li {
    font-size: 15px;
  }
  .item-list button,
  .email-list-display button {
    font-size: 13px;
    padding: 6px 12px;
  }
  .item-display-text .item-name {
    font-size: 13px;
  }
  .item-display-text .item-notes {
    font-size: 11px;
  }


  /* Specific for stock status list (index.html) */
  .stock-list li {
    font-size: 15px;
  }

  /* Specific for manage stock page (manageStock.html) */
  .form-group input[type="text"],
  .form-group input[type="number"] {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 14px 12px;
  }
  
  .button-group {
    gap: 10px;
  }
  
  .button-group button {
    padding: 12px 16px;
    font-size: 16px;
  }
  
  /* QR Scanner modal mobile optimizations */
  .modal .scanner-container {
    width: 100%;
    max-width: none;
  }
  
  .modal .scanner-container video {
    width: 100%;
    height: auto;
    max-height: 50vh;
  }

  /* Specific for order history table (orderHistory.html) */
  .order-history-table, .order-history-table thead, .order-history-table tbody, .order-history-table th, .order-history-table td, .order-history-table tr {
      display: block;
  }
  .order-history-table thead tr {
      position: absolute;
      top: -9999px;
      left: -9999px;
  }
  .order-history-table tr {
      border: 1px solid var(--border-light);
      margin-bottom: 15px;
      border-radius: 8px;
      overflow: hidden;
  }
  .order-history-table td {
      border: none;
      position: relative;
      padding-left: 50%;
      text-align: right;
      border-bottom: 1px dashed var(--border-light);
      min-height: 40px;
  }
  .order-history-table td:last-child {
      border-bottom: none;
  }
  .order-history-table td::before {
      content: attr(data-label);
      position: absolute;
      left: 15px;
      width: calc(50% - 30px);
      white-space: nowrap;
      text-align: left;
      font-weight: 600;
      color: var(--primary-blue);
  }
  .order-item-list, .email-list {
      font-size: 14px;
  }
  .order-item-list li, .email-list li {
      font-size: 14px;
  }
  .order-item-list button, .email-list button {
      font-size: 12px;
      padding: 4px 8px;
  }
  .status-dropdown {
      font-size: 14px;
      padding: 6px;
  }
  .action-button-group button {
      font-size: 0.85em;
      padding: 5px 8px;
  }


  /* Specific for config table (config.html) */
  .config-table, .config-table thead, .config-table tbody, .config-table th, .config-table td, .config-table tr {
      display: block;
  }
  .config-table thead tr {
      position: absolute;
      top: -9999px;
      left: -9999px;
  }
  .config-table tr {
      border: 1px solid var(--border-light);
      margin-bottom: 15px;
      border-radius: 8px;
      overflow: hidden;
  }
  .config-table td {
      border: none;
      position: relative;
      padding-left: 50%;
      text-align: right;
      border-bottom: 1px dashed var(--border-light);
      min-height: 40px;
  }
  .config-table td:last-child {
      border-bottom: none;
  }
  .config-table td::before {
      content: attr(data-label);
      position: absolute;
      left: 15px;
      width: calc(50% - 30px);
      white-space: nowrap;
      text-align: left;
      font-weight: 600;
      color: var(--primary-blue);
  }
  .config-table .action-buttons {
      justify-content: flex-end;
  }
  .config-table input[type="number"],
  .config-table input[type="text"],
  .config-table select {
      font-size: 15px;
  }

  /* Specific for modal items (orderHistory.html) */
  .modal .item-list-edit li {
      flex-direction: column;
      align-items: flex-start;
      padding: 10px;
  }
  .modal .item-list-edit .item-details-display {
      margin-bottom: 10px;
      margin-right: 0;
      width: 100%;
  }
  .modal .item-list-edit .item-controls {
      width: 100%;
      justify-content: flex-end;
      margin-top: 10px;
  }
  .modal .item-list-edit .item-notes-input {
      width: calc(100% - 20px);
  }

  /* Specific for stock view table (viewStock.html) */
  .stock-view-table, .stock-view-table thead, .stock-view-table tbody, .stock-view-table th, .stock-view-table td, .stock-view-table tr {
      display: block;
  }
  .stock-view-table thead tr {
      position: absolute;
      top: -9999px;
      left: -9999px;
  }
  .stock-view-table tr {
      border: 1px solid var(--border-light);
      margin-bottom: 15px;
      border-radius: 8px;
      overflow: hidden;
  }
  .stock-view-table td {
      border: none;
      position: relative;
      padding-left: 50%;
      text-align: right;
      border-bottom: 1px dashed var(--border-light);
      min-height: 40px;
  }
  .stock-view-table td:last-child {
      border-bottom: none;
  }
  .stock-view-table td::before {
      content: attr(data-label);
      position: absolute;
      left: 15px;
      width: calc(50% - 30px);
      white-space: nowrap;
      text-align: left;
      font-weight: 600;
      color: var(--primary-blue);
  }
}
/* ... (your existing CSS) ... */

/* Stock Movement Table styles (for manageStock.html) */
.stock-movement-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
}
body.dark-mode .stock-movement-table {
    background-color: var(--background-dark);
}
.stock-movement-table th, .stock-movement-table td {
    border: 1px solid var(--border-light);
    padding: 12px;
    text-align: left;
    vertical-align: middle;
    font-size: 15px;
    color: var(--text-dark);
}
body.dark-mode .stock-movement-table th, body.dark-mode .stock-movement-table td {
    border-color: var(--border-light);
}
.stock-movement-table th {
    background-color: var(--background-light);
    font-weight: 600;
    color: var(--text-dark);
}
body.dark-mode .stock-movement-table th {
    background-color: var(--white);
}
.stock-movement-table tr:nth-child(even) {
    background-color: var(--table-stripe);
}
.stock-movement-table tr:hover {
    background-color: var(--table-hover);
}

/* Responsive adjustments for stock movement table */
@media (max-width: 768px) {
  .stock-movement-table, .stock-movement-table thead, .stock-movement-table tbody, .stock-movement-table th, .stock-movement-table td, .stock-movement-table tr {
      display: block;
  }
  .stock-movement-table thead tr {
      position: absolute;
      top: -9999px;
      left: -9999px;
  }
  .stock-movement-table tr {
      border: 1px solid var(--border-light);
      margin-bottom: 15px;
      border-radius: 8px;
      overflow: hidden;
  }
  .stock-movement-table td {
      border: none;
      position: relative;
      padding-left: 50%;
      text-align: right;
      border-bottom: 1px dashed var(--border-light);
      min-height: 40px;
  }
  .stock-movement-table td:last-child {
      border-bottom: none;
  }
  .stock-movement-table td::before {
      content: attr(data-label);
      position: absolute;
      left: 15px;
      width: calc(50% - 30px);
      white-space: nowrap;
      text-align: left;
      font-weight: 600;
      color: var(--primary-blue);
  }
}

/* Product Information Page Specific Styles */
.search-container {
  position: relative;
  width: 100%;
  margin-bottom: 30px;
}

.search-container input {
  width: 100%;
  padding: 12px;
  border: none;
  background-color: var(--white);
  color: var(--text-dark);
  border-radius: 4px;
  font-size: 16px;
  border: 1px solid var(--border-light);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-height: 300px;
  overflow-y: auto;
  background-color: var(--white);
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  z-index: 10;
  display: none;
  border: 1px solid var(--border-light);
  border-top: none;
}

.search-results.active {
  display: block;
}

.search-result-item {
  padding: 10px 15px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-dark);
}

.search-result-item:hover,
.search-result-item.selected {
  background-color: var(--table-hover);
}

.search-result-item .item-id {
  font-weight: bold;
  margin-right: 5px;
}

.search-result-item .item-stock {
  color: var(--text-medium);
  font-size: 0.9em;
  margin-left: 5px;
}

.product-info {
  background-color: var(--white);
  border-radius: 6px;
  padding: 25px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  display: none;
  border: 1px solid var(--border-light);
}

.product-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-light);
}

.product-title {
  flex: 1;
}

.product-title h2 {
  margin: 0 0 10px 0;
  font-weight: 600;
  color: var(--text-dark);
}

.product-id {
  font-weight: 500;
  color: var(--text-medium);
  font-size: 15px;
}

/* Enhanced Product Detail Styles */
.product-info-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.product-header {
  background: linear-gradient(135deg, var(--primary-blue) 0%, rgba(var(--primary-blue-rgb), 0.8) 100%);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  color: white;
  box-shadow: 0 8px 32px rgba(var(--primary-blue-rgb), 0.15);
}

.product-title {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 8px 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.product-id {
  font-size: 16px;
  opacity: 0.9;
  font-weight: 500;
}

.product-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.product-actions .btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  backdrop-filter: blur(10px);
  font-weight: 500;
  padding: 12px 20px;
  border-radius: 10px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-actions .btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.product-actions .btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.product-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.15);
}

.product-actions .btn-primary {
  background: linear-gradient(135deg, var(--primary-blue) 0%, rgba(var(--primary-blue-rgb), 0.9) 100%);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.product-actions .btn-primary:hover {
  background: linear-gradient(135deg, rgba(var(--primary-blue-rgb), 0.9) 0%, var(--primary-blue) 100%);
  box-shadow: 0 4px 16px rgba(var(--primary-blue-rgb), 0.4);
}

.product-actions .btn-danger {
  background: linear-gradient(135deg, var(--error-red) 0%, #e53e3e 100%);
  border: none;
}

.product-actions .btn-danger:hover {
  background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
}

.product-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

.detail-section {
  background: var(--white);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  border: 1px solid var(--border-light);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  min-height: 300px;
}

.detail-section:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 48px rgba(0,0,0,0.15);
}

.detail-section h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-light);
}

.detail-section h3:before {
  content: '';
  width: 5px;
  height: 28px;
  background: linear-gradient(to bottom, var(--primary-blue), rgba(var(--primary-blue-rgb), 0.6));
  border-radius: 3px;
}

/* Section-specific icons */
.detail-section:first-child h3:after {
  content: '📦';
  font-size: 24px;
  margin-left: auto;
  opacity: 0.8;
}

.detail-section:last-child h3:after {
  content: '📊';
  font-size: 24px;
  margin-left: auto;
  opacity: 0.8;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.detail-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  transition: all 0.2s ease;
  border-radius: 8px;
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-item:hover {
  background-color: rgba(var(--primary-blue-rgb), 0.03);
  margin: 0 -12px;
  padding-left: 12px;
  padding-right: 12px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.detail-label {
  font-size: 12px;
  color: var(--text-medium);
  margin-bottom: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  line-height: 1.2;
}

.detail-value {
  font-size: 15px;
  color: var(--text-dark);
  font-weight: 500;
  line-height: 1.3;
  min-height: 18px;
}

/* Stock Status Enhancements */
.stock-indicator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 24px;
  font-weight: 700;
  font-size: 16px;
  min-width: 80px;
  justify-content: center;
}

.stock-indicator:before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.stock-high {
  color: var(--success-green);
  background: rgba(52, 199, 89, 0.1);
  font-weight: 600;
}

.stock-high:before {
  background-color: var(--success-green);
}

.stock-medium {
  color: var(--warning-orange);
  background: rgba(255, 149, 0, 0.1);
  font-weight: 600;
}

.stock-medium:before {
  background-color: var(--warning-orange);
}

.stock-low {
  color: var(--error-red);
  background: rgba(255, 59, 48, 0.1);
  font-weight: 600;
}

.stock-low:before {
  background-color: var(--error-red);
}

/* Product Type Badge */
.product-type-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary-blue), rgba(var(--primary-blue-rgb), 0.8));
  color: white;
  padding: 8px 18px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  box-shadow: 0 2px 8px rgba(var(--primary-blue-rgb), 0.3);
}

/* Pulse animation for stock indicators */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Enhanced mobile responsiveness for product details */
@media (min-width: 1200px) {
  .product-info-container {
    padding: 32px;
  }
  
  .product-details {
    gap: 32px;
  }
  
  .detail-section {
    min-height: 350px;
    padding: 24px;
  }
  
  .detail-item {
    padding: 10px 0;
  }
  
  .detail-value {
    font-size: 16px;
  }
}

@media (max-width: 768px) {
  .product-details {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .product-header {
    padding: 24px 20px;
    margin-bottom: 24px;
  }
  
  .product-title {
    font-size: 24px;
  }
  
  .product-actions {
    gap: 8px;
  }
  
  .product-actions .btn {
    padding: 10px 16px;
    font-size: 14px;
  }
  
  .detail-section {
    padding: 20px;
    min-height: auto;
  }
  
  .detail-grid {
    gap: 16px;
  }
  
  .detail-item {
    padding: 16px 0;
  }
  
  .detail-value {
    font-size: 16px;
  }
}

.no-results {
  text-align: center;
  padding: 40px 0;
  color: var(--text-medium);
  font-style: italic;
}

/* Product List Grid Styles */
.product-list {
  margin-top: 20px;
}

.product-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 15px;
}

.view-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

.view-toggle {
  display: flex;
  background-color: var(--background-light);
  border-radius: 6px;
  padding: 2px;
  border: 1px solid var(--border-light);
}

body.dark-mode .view-toggle {
  background-color: var(--dark-surface);
  border-color: var(--dark-border);
}

.view-btn {
  background-color: transparent;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-medium);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.view-btn:hover {
  color: var(--text-dark);
  background-color: var(--white);
}

body.dark-mode .view-btn:hover {
  color: var(--text-dark);
  background-color: var(--dark-background);
}

.view-btn.active {
  background-color: var(--primary-blue);
  color: white;
}

.view-btn.active:hover {
  background-color: var(--primary-blue);
  color: white;
  opacity: 0.9;
}

.product-list h3 {
  font-size: 20px;
  margin: 0;
  color: var(--text-dark);
}

.bulk-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.bulk-actions.hidden {
  opacity: 0.5;
  pointer-events: none;
}

.delete-mode-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
  padding: 15px;
  background-color: var(--white);
  border-radius: 6px;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.delete-mode-toggle.active {
  border-color: var(--error-red);
  background-color: rgba(255, 59, 48, 0.1);
}

.delete-mode-switch {
  position: relative;
  width: 50px;
  height: 25px;
  background-color: var(--text-medium);
  border-radius: 25px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.delete-mode-switch.active {
  background-color: var(--error-red);
}

.delete-mode-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 21px;
  height: 21px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
}

.delete-mode-switch.active::after {
  transform: translateX(25px);
}

.delete-mode-label {
  font-weight: 500;
  color: var(--text-dark);
  cursor: pointer;
}

.delete-mode-warning {
  color: var(--error-red);
  font-size: 12px;
  font-style: italic;
  margin-left: 10px;
}

.selected-count {
  color: var(--text-medium);
  font-size: 14px;
}

.btn-bulk {
  background-color: var(--error-red);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-bulk:hover {
  opacity: 0.9;
}

.btn-bulk:disabled {
  background-color: var(--text-medium);
  cursor: not-allowed;
}

.btn-select-all {
  background-color: var(--text-medium);
  color: white;
}

.btn-select-all:hover {
  opacity: 0.9;
}

#productGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.product-grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.product-list-table {
  width: 100%;
}

.products-table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--white);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 5px rgba(0,0,0,0.05);
  border: 1px solid var(--border-light);
}

body.dark-mode .products-table {
  background-color: var(--dark-surface);
  border-color: var(--dark-border);
}

.products-table th {
  background-color: var(--background-light);
  font-weight: 600;
  color: var(--text-dark);
  padding: 12px;
  text-align: left;
  border-bottom: 2px solid var(--border-light);
}

body.dark-mode .products-table th {
  background-color: var(--dark-background);
  color: var(--text-dark);
  border-bottom-color: var(--dark-border);
}

.products-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-dark);
}

body.dark-mode .products-table td {
  border-bottom-color: var(--dark-border);
  color: var(--text-dark);
}

.products-table tr:nth-child(even) {
  background-color: var(--table-stripe);
}

body.dark-mode .products-table tr:nth-child(even) {
  background-color: var(--dark-background);
}

.products-table tr:hover {
  background-color: var(--table-hover);
}

body.dark-mode .products-table tr:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.products-table tr.selected {
  background-color: rgba(0, 122, 255, 0.1);
  border-left: 3px solid var(--primary-blue);
}

body.dark-mode .products-table tr.selected {
  background-color: rgba(0, 122, 255, 0.2);
}

.checkbox-column {
  width: 40px;
  text-align: center;
}

.table-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  display: none;
}

.delete-mode .table-checkbox {
  display: inline-block;
}

.table-actions {
  display: flex;
  gap: 8px;
}

.table-actions .btn {
  padding: 6px 12px;
  font-size: 12px;
}

.product-card {
  background-color: var(--white);
  border-radius: 6px;
  padding: 15px;
  transition: all 0.3s ease;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  border: 1px solid var(--border-light);
}

.product-card.selected {
  border: 2px solid var(--primary-blue);
  background-color: rgba(0, 122, 255, 0.1);
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.product-card.selected:hover {
  background-color: rgba(0, 122, 255, 0.15);
}

.product-checkbox {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 18px;
  height: 18px;
  cursor: pointer;
  z-index: 10;
  display: none;
}

.delete-mode .product-checkbox {
  display: block;
}

.delete-mode .product-card {
  cursor: default;
}

.delete-mode .product-card:hover {
  transform: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.delete-mode .product-card:not(.selected):hover {
  background-color: var(--white);
}

.product-card-header {
  margin-bottom: 10px;
  margin-right: 25px;
}

.product-card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
  margin: 0 0 5px 0;
}

.product-card-id {
  font-size: 12px;
  color: var(--text-medium);
}

.product-card-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 13px;
}

.product-card-detail {
  display: flex;
  flex-direction: column;
}

.detail-card-label {
  color: var(--text-medium);
  font-size: 11px;
  margin-bottom: 2px;
}

.detail-card-value {
  color: var(--text-dark);
}

.product-card-stock {
  margin-top: 10px;
  font-weight: 600;
}

/* Dark mode overrides for product styles */
body.dark-mode .search-container input {
  background-color: var(--dark-surface);
  color: var(--white);
  border-color: var(--dark-border);
}

body.dark-mode .search-results {
  background-color: var(--dark-surface);
  border-color: var(--dark-border);
}

body.dark-mode .search-result-item {
  color: var(--white);
  border-bottom-color: var(--dark-border);
}

body.dark-mode .search-result-item:hover,
body.dark-mode .search-result-item.selected {
  background-color: var(--dark-background);
}

body.dark-mode .product-info {
  background-color: var(--dark-surface);
  border-color: var(--dark-border);
}

body.dark-mode .product-header {
  border-bottom-color: var(--dark-border);
}

body.dark-mode .delete-mode-toggle {
  background-color: var(--dark-surface);
  border-color: transparent;
}

body.dark-mode .delete-mode-toggle.active {
  background-color: rgba(255, 59, 48, 0.2);
}

body.dark-mode .product-card {
  background-color: var(--dark-surface);
  border-color: var(--dark-border);
}

body.dark-mode .product-card.selected {
  background-color: rgba(0, 122, 255, 0.2);
}

body.dark-mode .product-card.selected:hover {
  background-color: rgba(0, 122, 255, 0.25);
}

body.dark-mode .delete-mode .product-card:not(.selected):hover {
  background-color: var(--dark-surface);
}

/* Stickers Page Specific Styles */
.form-section {
  margin-bottom: 25px;
}

.items-list {
  border: 1px dashed var(--border-light);
  padding: 20px;
  min-height: 100px;
  border-radius: 4px;
  margin: 20px 0;
}

body.dark-mode .items-list {
  border-color: var(--dark-border);
}

.preview-container {
  border: 1px solid var(--border-light);
  padding: 15px;
  margin-top: 30px;
  border-radius: 4px;
}

body.dark-mode .preview-container {
  border-color: var(--dark-border);
}

.preview-title {
  font-size: 18px;
  margin-bottom: 15px;
  font-weight: 500;
}

.sticker-preview {
  background-color: white;
  color: black;
  padding: 15px;
  border-radius: 4px;
  margin-top: 15px;
}

.page-options {
  margin-top: 20px;
  padding: 15px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
}

body.dark-mode .page-options {
  border-color: var(--dark-border);
}

.page-options h3 {
  margin-top: 0;
  margin-bottom: 15px;
}

.option-group {
  margin-bottom: 20px;
}

.checkbox-container {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.checkbox-container input[type="checkbox"] {
  margin-right: 8px;
}

.checkbox-container label {
  display: inline;
  margin-bottom: 0;
}

/* Message Area Styles */
.message-area {
  padding: 10px 15px;
  margin-bottom: 20px;
  border-radius: 4px;
  font-weight: 500;
  display: none;
  transition: opacity 0.3s ease;
  opacity: 0;
}

.message-area.show {
  display: block;
  opacity: 1;
}

.message-area.success {
  background-color: rgba(40, 167, 69, 0.2);
  color: var(--success-green);
  border-left: 4px solid var(--success-green);
}

.message-area.error {
  background-color: rgba(220, 53, 69, 0.2);
  color: var(--error-red);
  border-left: 4px solid var(--error-red);
}

.message-area.info {
  background-color: rgba(0, 123, 255, 0.2);
  color: var(--primary-blue);
  border-left: 4px solid var(--primary-blue);
}

/* Dark mode input overrides for stickers page */
body.dark-mode input[type="text"], 
body.dark-mode input[type="number"], 
body.dark-mode select {
  background-color: var(--dark-surface);
  color: var(--white);
  border: 1px solid var(--dark-border);
}

body.dark-mode .button-secondary {
  background-color: var(--dark-surface);
  border-color: var(--dark-border);
}

/* Print styles for stickers page */
@media print {
  body {
    background-color: white !important;
    color: black !important;
  }

  .header {
    display: none !important;
  }

  .container {
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    background-color: white !important;
  }

  .form-section, .button-group, .page-options h3, select, input[type="text"], input[type="number"] {
    display: none !important;
  }

  .preview-title {
    display: none !important;
  }
}

/* Scanner Loading Message Button Styles */
#loadingMessage button {
  background: var(--primary-blue);
  color: var(--white);
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  margin-top: 10px;
  transition: background-color 0.2s ease;
}

#loadingMessage button:hover {
  background: rgba(var(--primary-blue-rgb), 0.8);
}

/* Scanner Container Improvements */
.scanner-container {
  position: relative;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#qrVideo {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  background: #000;
}

#qrCanvas {
  display: none; /* Hide the canvas - it's only used for QR processing, not display */
}

@media (max-width: 768px) {
  #qrVideo {
    max-height: 300px;
  }
}

/* Bulk Import Styles */
.bulk-import-container {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.import-step {
  background: var(--background-light);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 20px;
  position: relative;
}

.import-step h3 {
  color: var(--primary-blue);
  margin: 0 0 10px 0;
  font-size: 1.1em;
  font-weight: 600;
}

.import-step p {
  color: var(--text-medium);
  margin: 0 0 15px 0;
  line-height: 1.5;
}

.template-info {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 15px;
  margin-top: 15px;
}

.template-info strong {
  color: var(--text-dark);
  display: block;
  margin-bottom: 10px;
}

.template-info ul {
  margin: 0;
  padding-left: 20px;
}

.template-info li {
  margin-bottom: 8px;
  color: var(--text-medium);
  line-height: 1.4;
}

.template-info code {
  background: var(--background-light);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: var(--primary-blue);
}

.status-box {
  background: var(--background-light);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 15px;
  text-align: center;
  margin-top: 15px;
}

.result-box {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 15px;
  margin-top: 15px;
  max-height: 300px;
  overflow-y: auto;
}

@media (max-width: 768px) {
  .bulk-import-container {
    gap: 20px;
  }
  
  .import-step {
    padding: 15px;
  }
  
  .template-info {
    padding: 12px;
  }
}

/* Mobile/Desktop visibility utilities */
.desktop-only {
  display: block;
}

.mobile-only {
  display: none;
}

@media (max-width: 768px) {
  .desktop-only {
    display: none;
  }
  
  .mobile-only {
    display: block;
  }
}

/* Mobile Stock Movements Styles */
.mobile-stock-movements {
  gap: 12px;
  margin-top: 20px;
}

.stock-movement-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.stock-movement-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.movement-header {
  padding: 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--white);
  border-bottom: 1px solid var(--border-light);
}

.movement-main-info {
  flex: 1;
}

.movement-title {
  font-weight: 600;
  font-size: 16px;
  color: var(--text-dark);
  margin: 0 0 4px 0;
}

.movement-subtitle {
  font-size: 14px;
  color: var(--text-medium);
  margin: 0;
}

.movement-toggle {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-medium);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.movement-toggle:hover {
  background: var(--button-hover-bg);
}

.movement-details {
  display: none;
  padding: 16px;
  background: var(--background-light);
  border-top: 1px solid var(--border-light);
}

.movement-details.expanded {
  display: block;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-weight: 500;
  color: var(--text-medium);
  font-size: 14px;
}

.detail-value {
  font-weight: 500;
  color: var(--text-dark);
  font-size: 14px;
  text-align: right;
}

.action-badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.action-badge.add {
  background: rgba(52, 199, 89, 0.1);
  color: var(--success-green);
}

.action-badge.remove {
  background: rgba(255, 59, 48, 0.1);
  color: var(--error-red);
}

.quantity-value {
  font-weight: 600;
  font-size: 16px;
}

.quantity-value.positive {
  color: var(--success-green);
}

.quantity-value.negative {
  color: var(--error-red);
}

.mobile-loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-medium);
  font-style: italic;
}

.mobile-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.mobile-action-btn {
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  background: var(--white);
  color: var(--text-dark);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-action-btn:hover {
  background: var(--button-hover-bg);
  border-color: var(--primary-blue);
}

.mobile-action-btn.delete {
  color: var(--error-red);
  border-color: var(--error-red);
}

.mobile-action-btn.delete:hover {
  background: rgba(255, 59, 48, 0.1);
}

/* Responsive visibility classes for viewStock.html */
.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

/* Stock Cards for Mobile */
.stock-cards-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.stock-item-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

body.dark-mode .stock-item-card {
    background: var(--background-dark);
    border-color: var(--border-light);
}

.stock-item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: var(--primary-blue);
}

body.dark-mode .stock-item-card:hover {
    box-shadow: 0 4px 12px rgba(255,255,255,0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.card-id {
    font-weight: 600;
    color: var(--primary-blue);
    font-size: 14px;
}

.card-status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.card-status.status-ok {
    background: #d4edda;
    color: #155724;
}

.card-status.status-low {
    background: #fff3cd;
    color: #856404;
}

.card-status.status-urgent {
    background: #f8d7da;
    color: #721c24;
}

body.dark-mode .card-status.status-ok {
    background: rgba(40, 167, 69, 0.2);
    color: #28a745;
}

body.dark-mode .card-status.status-low {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

body.dark-mode .card-status.status-urgent {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
    line-height: 1.3;
}

body.dark-mode .card-title {
    color: var(--text-light);
}

.card-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.detail-label {
    color: var(--text-medium);
    font-weight: 500;
}

.detail-value {
    color: var(--text-dark);
    font-weight: 600;
}

body.dark-mode .detail-value {
    color: var(--text-light);
}

.loading-card, .error-card, .no-items-card {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-medium);
    font-size: 16px;
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 12px;
}

body.dark-mode .loading-card,
body.dark-mode .error-card,
body.dark-mode .no-items-card {
    background: var(--background-dark);
    border-color: var(--border-light);
}

.error-card {
    color: var(--error-red);
}

/* Tab Navigation Styling */
.tab-nav {
    display: flex;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 32px;
    background-color: transparent;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-medium);
    cursor: pointer;
    position: relative;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    font-family: inherit;
    margin: 0;
    border-radius: 0;
}

.tab-btn:hover {
    color: var(--text-dark);
    background-color: var(--button-hover-bg);
}

.tab-btn.active {
    color: var(--primary-blue);
    border-bottom-color: var(--primary-blue);
}

/* Dark mode tab styles */
body.dark-mode .tab-btn {
    color: var(--text-medium);
}

body.dark-mode .tab-btn:hover {
    color: var(--text-dark);
    background-color: var(--button-hover-bg);
}

body.dark-mode .tab-btn.active {
    color: var(--primary-blue);
    border-bottom-color: var(--primary-blue);
}

/* Remove primary/secondary button styles for tabs */
.tab-btn.primary,
.tab-btn.secondary {
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    color: var(--text-medium) !important;
    border-bottom: 3px solid transparent !important;
}

.tab-btn.primary:hover,
.tab-btn.secondary:hover {
    background-color: var(--button-hover-bg) !important;
    color: var(--text-dark) !important;
}

.tab-btn.primary.active,
.tab-btn.secondary.active {
    color: var(--primary-blue) !important;
    border-bottom-color: var(--primary-blue) !important;
}

@media (max-width: 768px) {
  .desktop-only {
      display: none;
  }

  .mobile-only {
      display: block;
  }
  
  .tab-btn {
      padding: 10px 16px;
      font-size: 14px;
  }
}

/* Maintenance Log Entry Styling */
.maintenance-log-entry {
  transition: background-color 0.2s ease;
}

.maintenance-log-entry:hover {
  background-color: var(--table-hover);
  border-radius: 6px;
  margin: 0 -8px;
  padding-left: 16px !important;
  padding-right: 16px !important;
}

.maintenance-log-entry button:hover {
  background-color: #cc2e24 !important;
  transform: scale(1.1);
  transition: all 0.2s ease;
}

body.dark-mode .maintenance-log-entry {
  border-bottom-color: var(--border-light) !important;
}

body.dark-mode .maintenance-log-entry:hover {
  background-color: var(--table-hover);
}

/* Template info section styling */
.template-info {
  background-color: var(--background-light);
  border-left: 4px solid var(--primary-blue);
  border-radius: 6px;
  margin-top: 16px;
  padding: 12px;
}

body.dark-mode .template-info {
  background-color: var(--dark-surface);
  border-left-color: var(--primary-blue);
}

.template-info h4 {
  margin: 0 0 8px 0;
  color: var(--text-dark);
  font-size: 14px;
  font-weight: 600;
}

.template-info p {
  margin: 4px 0;
  font-size: 13px;
  color: var(--text-medium);
  line-height: 1.4;
}

.template-info strong {
  color: var(--text-dark);
  font-weight: 500;
}

/* Product Type Field Transitions */
.form-row {
  transition: all 0.3s ease;
  overflow: hidden;
}

.form-row.hidden {
  max-height: 0;
  opacity: 0;
  margin: 0;
  padding: 0;
}

/* Product Type Select Styling */
select#productType {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 40px;
}

body.dark-mode select#productType {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%9ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

/* Product type indicator badges */
.product-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.product-type-badge.roll { background: #E3F2FD; color: #1976D2; }
.product-type-badge.sheet { background: #E8F5E8; color: #2E7D32; }
.product-type-badge.cartridge { background: #FFF3E0; color: #F57C00; }
.product-type-badge.bottle { background: #F3E5F5; color: #7B1FA2; }
.product-type-badge.other-with { background: #F5F5F5; color: #616161; }
.product-type-badge.other-no { background: #FFEBEE; color: #C62828; }

body.dark-mode .product-type-badge.roll { background: #1E3A8A; color: #93C5FD; }
body.dark-mode .product-type-badge.sheet { background: #166534; color: #86EFAC; }
body.dark-mode .product-type-badge.cartridge { background: #92400E; color: #FCD34D; }
body.dark-mode .product-type-badge.bottle { background: #581C87; color: #DDA0DD; }
body.dark-mode .product-type-badge.other-with { background: #374151; color: #D1D5DB; }
body.dark-mode .product-type-badge.other-no { background: #991B1B; color: #FCA5A5; }

/* Product Type Management Interface */
.product-type-management {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 32px;
}

.add-product-type-form {
  background: var(--white);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
}

.add-product-type-form h3 {
  margin: 0 0 16px 0;
  color: var(--text-dark);
  font-size: 16px;
  font-weight: 600;
}

.add-product-type-form .form-note {
  margin: 8px 0 0 0;
  font-size: 13px;
  color: var(--text-medium);
  font-style: italic;
}

.existing-product-types {
  background: var(--white);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
}

.existing-product-types h3 {
  margin: 0 0 16px 0;
  color: var(--text-dark);
  font-size: 16px;
  font-weight: 600;
}

.product-types-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-type-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--background-light);
  border-radius: 6px;
  border: 1px solid var(--border-light);
}

.product-type-item:hover {
  background: var(--table-hover);
}

.product-type-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-type-item-name {
  font-weight: 500;
  color: var(--text-dark);
}

.product-type-usage-count {
  font-size: 12px;
  color: var(--text-medium);
  background: var(--background-light);
  padding: 2px 8px;
  border-radius: 12px;
}

.product-type-actions {
  display: flex;
  gap: 8px;
}

.delete-product-type-btn {
  background: var(--error-red);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.delete-product-type-btn:hover:not(:disabled) {
  background: #D70015;
  transform: translateY(-1px);
}

.delete-product-type-btn:disabled {
  background: var(--text-medium);
  cursor: not-allowed;
  opacity: 0.5;
}

.delete-product-type-btn:disabled:hover {
  transform: none;
}

/* Dark mode styles for product type management */
body.dark-mode .add-product-type-form,
body.dark-mode .existing-product-types {
  background: var(--dark-surface);
  border-color: var(--dark-border);
}

body.dark-mode .product-type-item {
  background: var(--dark-background);
  border-color: var(--dark-border);
}

body.dark-mode .product-type-item:hover {
  background: var(--table-hover);
}

body.dark-mode .product-type-usage-count {
  background: var(--dark-background);
}

/* Product Type Configuration Interface */
.product-type-configs {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.product-type-config-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 20px;
  transition: all 0.2s ease;
}

.product-type-config-card:hover {
  border-color: var(--primary-blue);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.dark-mode .product-type-config-card {
  background: var(--dark-surface);
  border-color: var(--dark-border);
}

body.dark-mode .product-type-config-card:hover {
  border-color: var(--primary-blue);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.config-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

body.dark-mode .config-card-header {
  border-bottom-color: var(--dark-border);
}

.config-card-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dark);
}

.dimension-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
}

@media (max-width: 768px) {
  .dimension-config-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

.dimension-config {
  padding: 16px;
  background: var(--background-light);
  border-radius: 6px;
  border: 1px solid var(--border-light);
}

body.dark-mode .dimension-config {
  background: var(--dark-background);
  border-color: var(--dark-border);
}

.config-field {
  margin-bottom: 12px;
}

.config-field:last-child {
  margin-bottom: 0;
}

.config-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-medium);
  margin-bottom: 4px;
}

.config-field input[type="text"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-size: 14px;
  background: var(--white);
  color: var(--text-dark);
  transition: border-color 0.2s ease;
}

.config-field input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-blue);
}

body.dark-mode .config-field input[type="text"] {
  background: var(--dark-surface);
  border-color: var(--dark-border);
  color: var(--text-dark);
}

body.dark-mode .config-field input[type="text"]:focus {
  border-color: var(--primary-blue);
}

/* Custom Checkbox Styling */
.checkbox-label {
  display: flex !important;
  align-items: center;
  cursor: pointer;
  font-weight: 500 !important;
  color: var(--text-dark) !important;
  margin-bottom: 8px !important;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-light);
  border-radius: 3px;
  margin-right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
  content: '✓';
  color: white;
  font-size: 12px;
  font-weight: bold;
}

body.dark-mode .checkbox-custom {
  border-color: var(--dark-border);
}

body.dark-mode .checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
}

/* Loading and error states */
.loading-indicator, .error-message {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-medium);
}

.error-message {
  color: var(--error-red);
}

.error-message button {
  margin-top: 12px;
}

/* Header Actions (User email + Logout) */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 10px;
}

/* Dark mode adjustments for header */
body.dark-mode .header {
  background: linear-gradient(135deg, #2d1b69 0%, #11998e 100%);
  box-shadow: 
    0 8px 32px rgba(45, 27, 105, 0.4),
    0 2px 16px rgba(0, 0, 0, 0.3);
}

body.dark-mode .header-title h1 {
  color: #f0f0f0;
  text-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.5),
    0 1px 2px rgba(0, 0, 0, 0.7);
}

body.dark-mode .header-nav button {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: #f0f0f0;
}

body.dark-mode .header-nav button:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

body.dark-mode .dropdown-button {
  background: rgba(var(--primary-blue-rgb), 0.12);
  border: 1px solid rgba(var(--primary-blue-rgb), 0.25);
}

body.dark-mode .dropdown-button:hover {
  background: rgba(var(--primary-blue-rgb), 0.18);
  border-color: rgba(var(--primary-blue-rgb), 0.35);
}

body.dark-mode .header-actions {
  border-bottom-color: var(--border-dark);
}

/* Navigation Header Styles */
.nav-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.nav-links a {
  color: var(--primary-blue);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  background-color: var(--background-light);
  border: 1px solid var(--border-light);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-links a:hover {
  background-color: var(--button-hover-bg);
  color: var(--primary-blue);
}

.nav-links a.active {
  background-color: var(--primary-blue);
  color: var(--white);
}

/* Removed .nav-actions - now using .header-right */

.user-email {
  color: var(--text-medium);
  font-size: 14px;
  font-weight: 500;
}

.logout-btn {
  background: var(--error-red);
  color: var(--white);
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.logout-btn:hover {
  background: #e33326;
}

/* Dark mode adjustments for navigation */
body.dark-mode .nav-links a {
  background-color: var(--background-dark);
  border-color: var(--border-dark);
  color: var(--text-dark);
}

body.dark-mode .nav-links a:hover {
  background-color: rgba(10, 132, 255, 0.1);
}

body.dark-mode .nav-links a.active {
  background-color: var(--primary-blue);
  color: var(--white);
}

/* Pongs Material Tracking Styles */
.form-section {
  background: var(--white);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-light);
}

.section-subtitle {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-dark);
  margin: 0 0 16px 0;
  border-bottom: 2px solid var(--primary-blue);
  padding-bottom: 8px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.pongs-rolls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.pongs-roll-card {
  background: var(--white);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-light);
  position: relative;
  transition: all 0.3s ease;
}

.pongs-roll-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.pongs-roll-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.pongs-roll-id {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
}

.pongs-status-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pongs-status-badge.received {
  background: #e3f2fd;
  color: #1976d2;
}

.pongs-status-badge.opened {
  background: #fff3e0;
  color: #f57c00;
}

.pongs-status-badge.in-use {
  background: #e8f5e8;
  color: #388e3c;
}

.pongs-status-badge.finished {
  background: #fce4ec;
  color: #c2185b;
}

.pongs-roll-details {
  font-size: 14px;
  color: var(--text-medium);
  line-height: 1.4;
}

.pongs-roll-details strong {
  color: var(--text-dark);
}

.pongs-analytics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.analytics-card {
  background: linear-gradient(135deg, var(--primary-blue) 0%, #4fc3f7 100%);
  color: white;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(var(--primary-blue-rgb), 0.3);
}

.analytics-card h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  opacity: 0.9;
}

.analytics-card p {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.pongs-timeline-container {
  background: var(--white);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-light);
  overflow-x: auto;
}

.pongs-history-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.pongs-history-table th {
  background: var(--background-light);
  padding: 12px 8px;
  text-align: left;
  font-weight: 600;
  color: var(--text-dark);
  border-bottom: 2px solid var(--border-light);
  font-size: 14px;
}

.pongs-history-table td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
  color: var(--text-medium);
}

.pongs-history-table tr:hover {
  background: var(--table-hover);
}

.pongs-stickiness-indicator {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.pongs-stickiness-indicator.not-sticky {
  background: #e8f5e8;
  color: #388e3c;
}

.pongs-stickiness-indicator.little-sticky {
  background: #fff3e0;
  color: #f57c00;
}

.pongs-stickiness-indicator.very-sticky {
  background: #ffebee;
  color: #d32f2f;
}

.pongs-roll-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  justify-content: flex-start;
}

.pongs-roll-actions button {
  padding: 6px 12px;
  font-size: 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.pongs-roll-actions button.small {
  padding: 4px 8px;
  font-size: 11px;
}

.pongs-roll-actions button.secondary {
  background: var(--button-secondary);
  color: var(--text-dark);
  border: 1px solid var(--border-medium);
}

.pongs-roll-actions button.secondary:hover {
  background: var(--background-light);
  transform: translateY(-1px);
}

.pongs-roll-actions button.danger {
  background: #d32f2f;
  color: white;
}

.pongs-roll-actions button.danger:hover {
  background: #b71c1c;
  transform: translateY(-1px);
}

.loading-message {
  text-align: center;
  padding: 40px;
  color: var(--text-medium);
  font-style: italic;
}

/* Dark mode support for Pongs tracking */
body.dark-mode .form-section,
body.dark-mode .pongs-roll-card,
body.dark-mode .pongs-timeline-container {
  background: var(--background-dark);
  border-color: var(--border-dark);
}

body.dark-mode .section-subtitle {
  color: var(--text-dark);
}

body.dark-mode .pongs-roll-id {
  color: var(--text-dark);
}

body.dark-mode .pongs-history-table th {
  background: var(--background-medium);
  color: var(--text-dark);
  border-color: var(--border-dark);
}

body.dark-mode .pongs-history-table td {
  border-color: var(--border-dark);
  color: var(--text-medium);
}

body.dark-mode .pongs-history-table tr:hover {
  background: var(--background-medium);
}
