:root {
  --accent: #6c1d45;
  --accent-light: #9c2c5e;
}

body {
  font-family: "Segoe UI", Arial, sans-serif;
  background: linear-gradient(135deg, #fff4f7, #f6f0ff);
  margin: 0;
  padding: 16px;
  display: flex;
  justify-content: center;
  height: 100vh;
  overflow: hidden; /* Prevent scrolling */
  box-sizing: border-box;
}

.card {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  max-height: 90vh; 
  max-width: 420px;
  width: 100%;
  padding: 12px 12px 6px 12px; 
  border: 1px solid rgba(255,255,255,0.3);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.top-label {
  position: relative;
  text-align: center;
  margin-bottom: 8px;
}
.logo-box {
  display: inline-block;
  padding: 8px;
  border-radius: 14px;
  background: linear-gradient(135deg,#fbe9f0,#f3e7f9);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  transition: all 0.6s ease;
}
.logo-box img {
  max-width: 80px;
  border-radius: 10px;
  display: block;
}

h1 {
  text-align: center;
  font-size: 1.2em;
  margin: 0 0 14px 0;
  color: var(--accent);
  font-weight: 700;
}

.micro-group {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.05);
  margin-bottom: 4px;
}

/* Reduce bottom margin for the measurement type group */
.micro-group.measurement-row {
  margin-bottom: 4px; /* Match the beverage card spacing */
}

/* Tighten the last micro-group */
.micro-group:last-of-type {
  margin-bottom: 8px; /* Reduced bottom margin for last group */
}

.micro-title {
  font-size: 0.75em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
  margin-top: 0px;
  margin-bottom: 4px; /* Consistent space below all titles */
}

.micro-group:last-of-type {
  margin-bottom: 6px; /* Keep consistent with others */
}

/* Specifically target the button rows to ensure consistent bottom spacing */
.btn-row:last-child {
  margin-bottom: 0;
}

/* Ensure inputs and buttons have consistent spacing */
input, select, textarea, button {
  margin-top: 6px;
  margin-bottom: 0;
}

/* Fix button fonts */
.btn-row button, 
#calcBtn, 
#clearBtn, 
#saveBtn {
    font-family: Arial, sans-serif !important; /* or whatever your button font was */
    font-size: 14px !important;
    font-weight: bold !important;
}

/* Also fix any other buttons that might be affected */
button {
    font-family: Arial, sans-serif !important;
    font-size: 14px !important;
}

.row {
  display: flex;
  gap: 10px;
  margin: 0;
}
.row label { flex: 1; }

label {
  display: block;
  margin-top: 6px;
  margin-bottom: 0px;
  font-weight: 600;
  font-size: 0.85em;
  color: #333;
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid #e1e5e9;
  font-size: 0.95em;
  background: #fff;
  box-sizing: border-box;
  transition: all 0.2s ease;
  margin: 3px 0;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,29,69,0.1);
  outline: none;
}

button {
  margin-top: 6px;
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108,29,69,0.3);
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.btn-row button { flex: 1; }

/* Results */
.results {
  background: rgba(248, 249, 250, 0.8);
  border-radius: 12px;
  padding: 16px;
  border-left: 3px solid var(--accent);
}

.result-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result-item {
  flex: 1 1 calc(50% - 8px);
  min-width: 120px;
  display: flex;
  align-items: center;
  font-size: 0.85em;
  margin-bottom: 4px;
}

.result-item b {
  color: var(--accent);
  margin-right: 4px;
}

.icon { 
  width: 20px; 
  margin-right: 6px; 
  text-align: center;
  font-size: 0.9em;
}

.progress-bar {
  flex: 1 1 100%;
  height: 12px;
  background: #e9ecef;
  border-radius: 6px;
  overflow: hidden;
  margin: 6px 0;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

#progressFill {
  height: 100%;
  width: 0;
  transition: all 0.6s ease;
}

/* Batch Actions */
/*.batch-actions {
  margin-top: 0px;
  padding-top: 10px;
  border-top: 0px solid rgba(0,0,0,0.1);
  padding-bottom: 0;
  margin-bottom: 0 !important; /* Force no bottom margin */
}

/* Batch Management specific fixes */
.batch-actions.micro-group {
  padding-top: 12px;
  margin-top: 4px;
  margin-bottom: 6px !important;
}

/* Compact the button rows in batch management */
 .batch-actions .btn-row {
  margin-bottom: 6px; /* Reduced spacing between button rows */
}


 .batch-actions .btn-row:last-child {
  margin-bottom: 0; /* Even less for the last row */
}

/* Ensure no extra space after the last elements */
/* .batch-actions > *:last-child {
  margin-bottom: 0;

.batch-actions .micro-title {
  margin-bottom: 6px;
} */

.batch-notes, .data-field, input, textarea, select {
    font-family: inherit;
    font-size: 14px; /* or whatever your original size was */
}

/* Ensure measurement row has same structure */
.measurement-row .micro-title {
  margin-bottom: 6px; /* Same as other titles */
}

#authSection {
  background: rgba(255,255,255,0.9);
  border-radius: 10px;
  padding: 12px;
  margin: 8px 0;
  border: 1px solid rgba(0,0,0,0.08);
}

/* Reduce spacing in cloud management sections */
#authSection, #cloudManagementSection {
  padding: 10px; /* Tighter padding */
  margin: 6px 0; /* Reduced margins */
}

/* Toast */
#toast {
  visibility: hidden;
  max-width: 400px;
  width: auto;
  color: #fff;
  text-align: center;
  border-radius: 12px;
  padding: 10px 16px;
  position: fixed;
  z-index: 1001;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  font-size: 0.85em;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.4s, transform 0.4s;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

#toast.show {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-success { background: linear-gradient(135deg,#2ecc71,#27ae60); }
.toast-warning { background: linear-gradient(135deg,#f39c12,#f1c40f); color: #222; }

.toast-info { background: linear-gradient(135deg, #3498db, #2980b9); }
.toast-error { 
    background: linear-gradient(135deg,#e74c3c,#c0392b); 
}

/* Help System */
.help-fab {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f6c343, #e8b438);
  color: #222;
  border: none;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  z-index: 1001;
}

.help-panel {
  position: absolute;
  bottom: 0;
  left: 20px;
  right: 20px;
  max-height: 80%;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.2);
  padding: 24px;
  z-index: 100;
  display: none;
  overflow-y: auto;
}

#helpContentBox {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 20px;
}

.help-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.help-header h2 {
  margin: 0;
  font-size: 1.2em;
  color: var(--accent);
}

.close {
  font-size: 22px;
  cursor: pointer;
  color: #666;
}

.help-section-title {
  font-weight: 600;
  margin: 12px 0 6px 0;
  cursor: pointer;
  color: var(--accent);
  font-size: 0.9em;
  padding: 8px 12px;
  background: rgba(108, 29, 69, 0.05);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.help-section-title:hover {
  background: rgba(108, 29, 69, 0.1);
}

.help-section-content {
  display: none;
  margin-left: 12px;
  margin-bottom: 12px;
  color: #444;
  font-size: 0.85em;
  line-height: 1.4;
  padding: 8px 12px;
  background: rgba(248, 249, 250, 0.8);
  border-radius: 6px;
  border-left: 3px solid var(--accent);
}

.help-close-bottom {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  position: sticky;
  flex-shrink: 0;
}

/* Batch Management Enhancements */
.batch-management-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--accent);
}

.batch-stats {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.stat-item {
  background: rgba(108, 29, 69, 0.1);
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 0.8em;
  font-weight: 600;
}

.batch-list-container {
  margin: 15px 0;
}

.batch-list-container label {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
  display: block;
}

#batchList {
  width: 100%;
  padding: 10px;
  border: 1.5px solid #e1e5e9;
  border-radius: 10px;
  background: white;
  font-size: 0.9em;
  margin: 8px 0;
  display: block;
}

#batchList option {
  padding: 8px;
  border-bottom: 1px solid #f0f0f0;
}

#batchList option:hover {
  background: #f8f9fa;
}

#batchList option:checked {
  background: var(--accent);
  color: white;
}

/* Smart defaults visual indicators */
select.wine-default {
  border-left: 4px solid #8b0000;
  background: linear-gradient(90deg, rgba(139,0,0,0.05) 0%, transparent 100%);
}

select.cider-default {
  border-left: 4px solid #8fbc8f;
  background: linear-gradient(90deg, rgba(143,188,143,0.05) 0%, transparent 100%);
}

select.mead-default {
  border-left: 4px solid #daa520;
  background: linear-gradient(90deg, rgba(218,165,32,0.05) 0%, transparent 100%);
}

/* Cloud/Local batch indicators */
.cloud-batch { 
  border-left: 4px solid #3498db;
  background: linear-gradient(90deg, rgba(52,152,219,0.05) 0%, transparent 100%);
}

.local-batch { 
  border-left: 4px solid #27ae60;
  background: linear-gradient(90deg, rgba(39,174,96,0.05) 0%, transparent 100%);
}

/* Button variants */
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-light)) !important; }
.btn-secondary { background: linear-gradient(135deg, #6c757d, #5a6268) !important; }
.btn-success { background: linear-gradient(135deg, #28a745, #20c997) !important; }
.btn-danger { background: linear-gradient(135deg, #e74c3c, #c0392b) !important; }
.btn-warning { background: linear-gradient(135deg, #f39c12, #e67e22) !important; }
.btn-info { background: linear-gradient(135deg, #3498db, #2980b9) !important; }



#cloudManagementSection {
  position: relative !important; /* Force it to stay inside card */
  max-height:65vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.batch-management-header,
.batch-list-container,
.batch-actions-enhanced {
  position: relative !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close {
    color: #aaa;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.modal-body label {
    display: block;
    margin-bottom: 10px;
}

.modal-body input {
    width: 100%;
    padding: 8px;
    margin-top: 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.forgot-password {
    text-align: center;
    margin-top: 10px;
}

.forgot-password a {
    color: #666;
    text-decoration: none;
    font-size: 0.9em;
}

.forgot-password a:hover {
    text-decoration: underline;
}

/* PWA-specific styles */
@media all and (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);
  }
  
  /* Optional: Add some extra padding for iOS notch */
  .card {
    margin-top: 10px;
  }
}

/* Ensure proper fullscreen appearance */
html {
  height: 100%;
  background-color: #2c5530;
}

body {
  min-height: 100vh;
  background-color: #2c5530;
}

.install-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
}

.install-button {
  padding: 12px 20px;
  background: linear-gradient(135deg, #2c5530, #4a7c59);
  color: white;
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  width: auto;
  white-space: nowrap;
}

.close-install-btn {
  padding: 8px;
  background: #666;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  width: 32px;
  height: 32px;
}

.close-install-btn:hover {
  background: #888;
}

.export-btn:hover {
    background: #8e44ad;
}

.export-csv-btn {
    background: #9b59b6;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
}

.export-csv-btn:hover {
    background: #8e44ad;
}

/* Tools Dropdown Styles */
.tools-dropdown {
    position: absolute;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    padding: 6px;
    z-index: 1000;
    margin-top: 4px;
    border: 1px solid rgba(0,0,0,0.1);
    min-width: 160px;
}

.tools-dropdown button {
    margin: 1px 0;
    padding: 8px 10px;
    text-align: left;
    border-radius: 6px;
    font-size: 0.8em;
    width: 100%;
    background: transparent;
    color: #333;
    border: none;
}

.tools-dropdown button:hover {
    background: rgba(108, 29, 69, 0.1);
    transform: none;
    box-shadow: none;
}

/* Tools Modal Styles */
.tools-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.tools-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    max-height: 80vh;
    overflow-y: auto;
	position: relative;
    z-index: 1;
}

.tool-section {
    margin: 16px 0;
    padding: 12px;
    background: rgba(248, 249, 250, 0.8);
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}

.tool-section h4 {
    margin: 0 0 12px 0;
    color: var(--accent);
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.converter-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 8px 0;
}

.converter-row input, .converter-row select {
    flex: 1;
    margin: 0;
    padding: 8px 10px;
    font-size: 0.9em;
}

.converter-row span {
    font-weight: bold;
    color: var(--accent);
    min-width: 20px;
    text-align: center;
}

.converter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.converter-group label {
    font-size: 0.8em;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 2px;
}

.converter-group input {
    margin: 0;
    padding: 8px 10px;
    font-size: 0.9em;
}

.result-box {
    margin-top: 12px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
    font-size: 0.9em;
    line-height: 1.4;
}

.result-box strong {
    color: var(--accent);
}

/* Adjust button widths in calculation row */
.micro-group.measurement-row .btn-row button {
    flex: 1;
    min-width: 0; /* Allow buttons to shrink equally */
    font-size: 0.85em;
    padding: 10px 8px;
}

/* Modal header styles */
.tools-modal-content .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.tools-modal-content .modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.1em;
}

.tools-modal-content .close {
    color: #aaa;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.tools-modal-content .close:hover {
    color: #000;
}

/* Ensure tool modals work on mobile */
@media (max-width: 480px) {
    .tools-modal-content {
        margin: 10% auto;
        padding: 15px;
        width: 95%;
    }
    
    .converter-row {
        flex-direction: column;
        gap: 6px;
    }
    
    .converter-row span {
        transform: rotate(90deg);
    }
}

.converter-actions {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.converter-actions button {
    width: auto;
    padding: 8px 16px;
    font-size: 0.8em;
}

.tools-category {
    font-size: 0.7em;
    font-weight: 700;
    color: var(--accent);
    margin: 6px 0 2px 0;
    padding: 2px 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(108, 29, 69, 0.2);
}

.tools-category.expandable {
    cursor: pointer;
    background: rgba(108, 29, 69, 0.05);
    border-radius: 6px;
    padding: 8px 10px;
    margin: 2px 0;
}

.tools-category.expandable:hover {
    background: rgba(108, 29, 69, 0.1);
}

.tools-submenu {
    margin-left: 10px;
    border-left: 2px solid rgba(108, 29, 69, 0.2);
    padding-left: 8px;
}

.tools-submenu button {
    margin: 1px 0;
    padding: 6px 8px;
    font-size: 0.75em;
}

/* Fermentation Timeline */
.fermentation-timeline {
    display: flex;
    justify-content: space-between;
    margin: 15px 0;
    position: relative;
}

.fermentation-timeline::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 0;
    right: 0;
    height: 3px;
    background: #e9ecef;
    z-index: 1;
}

.timeline-stage {
    text-align: center;
    z-index: 2;
    position: relative;
    flex: 1;
}

.timeline-stage::before {
    content: '';
    width: 12px;
    height: 12px;
    background: #e9ecef;
    border-radius: 50%;
    display: block;
    margin: 0 auto 8px auto;
    border: 3px solid white;
    box-shadow: 0 0 0 2px #e9ecef;
}

.timeline-stage.active::before {
    background: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}

.timeline-stage.completed::before {
    background: #27ae60;
    box-shadow: 0 0 0 2px #27ae60;
}

.timeline-stage span {
    font-size: 0.75em;
    font-weight: 600;
    color: #666;
    display: block;
}

.timeline-stage.active span {
    color: var(--accent);
    font-weight: 700;
}

.timeline-stage.completed span {
    color: #27ae60;
}

/* Advanced Options Styling */
.advanced-options {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 8px 12px;
    margin: 8px 0;
    border-left: 3px solid var(--accent);
}

.advanced-options summary {
    font-weight: 600;
    cursor: pointer;
    outline: none;
    font-size: 0.8em;
    color: var(--accent);
}

.advanced-options[open] summary {
    margin-bottom: 8px;
}

.advanced-options small {
    font-size: 0.75em;
    line-height: 1.3;
    color: #666;
    display: block;
    margin-top: 4px;
}

.toast-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22) !important;
}

.toast-info {
    background: linear-gradient(135deg, #3498db, #2980b9) !important;
}

/* Enhanced Toast Styles for Validation */
.toast.error {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-left: 4px solid #e53e3e;
    color: #2d3748;
    text-align: left;
    padding: 16px;
    max-width: 320px;
}

.toast {
  visibility: hidden;
  color: #fff;
  text-align: center;
  border-radius: 12px;
  padding: 10px 16px;
  position: fixed;
  z-index: 99999 !important;
  left: 20px;
  right: 20px;
  bottom: 24px;
  font-size: 0.85em;
  font-weight: 500;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s, transform 0.4s;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  width: calc(100% - 40px);
  max-width: none;
  box-sizing: border-box;
}

.toast-header {
    font-weight: bold;
    margin-bottom: 8px;
    color: #c53030;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.toast-header span {
    font-weight: 700;
}

.toast-message {
    font-size: 0.85em;
    line-height: 1.4;
    margin-bottom: 12px;
    color: #4a5568;
}

.toast-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.toast-btn-primary {
    background: #2c5530;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    flex: 1;
    font-size: 0.8em;
    font-weight: 600;
    transition: all 0.2s ease;
}

.toast-btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    flex: 1;
    font-size: 0.8em;
    font-weight: 600;
    transition: all 0.2s ease;
}

.toast-btn-primary:hover {
    background: #225126;
    transform: translateY(-1px);
}

.toast-btn-secondary:hover {
    background: #cbd5e0;
    transform: translateY(-1px);
}

/* Input error states */
.input-error {
    border-color: #e53e3e !important;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1) !important;
    background-color: #fff5f5 !important;
}

.input-warning {
    border-color: #d69e2e !important;
    box-shadow: 0 0 0 3px rgba(214, 158, 46, 0.1) !important;
    background-color: #fffaf0 !important;
}

/* Field highlight animation */
@keyframes fieldPulse {
    0% { background-color: transparent; }
    50% { background-color: rgba(229, 62, 62, 0.05); }
    100% { background-color: transparent; }
}

.field-highlight {
    animation: fieldPulse 2s ease-in-out;
}

/* Enhanced validation specific styles */
.validation-suggestion {
    background: #f7fafc;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    padding: 8px 12px;
    margin: 8px 0;
    font-size: 0.8em;
}

.validation-suggestion strong {
    color: #2c5530;
    display: block;
    margin-bottom: 4px;
}

/* Mobile responsive adjustments for enhanced toasts */
@media (max-width: 480px) {
    .toast.error {
        left: 10px;
        right: 10px;
        margin-left: 0;
        width: calc(100% - 20px);
        max-width: none;
    }
    
    .toast-actions {
        flex-direction: column;
    }
    
    .toast-btn-primary,
    .toast-btn-secondary {
        flex: none;
    }
}

/* Hide the native select so iOS never shows its own picker */
.native-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  height: 0;
  width: 0;
}

/* Custom batch list container */
.batch-list-custom {
  max-height: 220px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
  border: 1px solid #e2e2e2;
  background: #fff;
  margin-top: 6px;
  margin-bottom: 8px;
}

/* Each batch row */
.batch-list-item {
  padding: 6px 8px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.batch-list-item:last-child {
  border-bottom: none;
}

.batch-list-item:hover {
  background: #f7f4fa;
}

/* Selected row highlight */
.batch-list-item.selected {
  background: #f0e3f4;
  border-left: 3px solid var(--accent);
}


/* Batch context in modals */
.batch-context {
    font-size: 0.8em;
    color: #666;
    margin-top: 8px;
    padding: 6px 8px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #2c5530;
}

.batch-context strong {
    color: #2c5530;
}

/* Smart defaults explanation */
.default-explanation {
    font-size: 0.75em;
    color: #666;
    margin-top: 4px;
    font-style: italic;
    line-height: 1.3;
}

/* Range indicator for inputs */
.range-indicator {
    font-size: 0.7em;
    color: #718096;
    margin-top: 2px;
    display: block;
}

/* Enhanced placeholder styling for validation */
input:invalid {
    border-color: #e53e3e;
}

input:valid {
    border-color: #38a169;
}

/* Focus states for error fields */
input.input-error:focus {
    border-color: #e53e3e;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
}

/* Loading state for validation */
.validating {
    position: relative;
}

.validating::after {
    content: "⏳";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
}

.btn-with-tooltip {
    position: relative;
}

.btn-with-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: #2c5530;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75em;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.btn-with-tooltip:hover::after {
    opacity: 1;
}

/* HIDE tooltip on active/click states */
.btn-with-tooltip:active::after,
.btn-with-tooltip:focus::after {
    opacity: 0 !important;
    display: none !important;
}

.batch-actions-enhanced {
    position: relative;
}

.batch-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #2c5530;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8em;
    max-width: 140px;
    text-align: center;
    z-index: 1000;
    display: none;
}

.batch-actions-enhanced:hover .batch-tooltip {
    display: block;
}

/* ===== MLF TRACKER STYLES ===== */
.mlf-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    border-left: 4px solid #6c1d45;
}

.mlf-section h4 {
    color: #6c1d45;
    margin-bottom: 10px;
}

.progress-container {
    margin: 15px 0;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    transition: width 0.5s ease;
}

.progress-text {
    text-align: center;
    margin-top: 5px;
    font-weight: bold;
    color: #6c1d45;
}

.temp-status {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin: 10px 0;
    border-left: 4px solid #17a2b8;
}

.temp-alert {
    padding: 8px;
    border-radius: 4px;
    margin-top: 8px;
}

.temp-optimal {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.temp-too_cold {
    background: #cce7ff;
    border: 1px solid #b3d9ff;
    color: #004085;
}

.temp-too_warm {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.completion-estimate {
    background: #e2e3e5;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    text-align: center;
}

.estimate-box {
    font-size: 14px;
}

.temp-reading {
    font-size: 16px;
    margin-bottom: 8px;
}

.recommendation-box {
    background: #e8f5e8;
    border: 1px solid #28a745;
    border-radius: 6px;
    padding: 12px;
    margin-top: 15px;
}

.reasons-list {
    margin-top: 10px;
}

.reason-item {
    padding: 5px 0;
    border-bottom: 1px solid #dee2e6;
}

.reason-item:last-child {
    border-bottom: none;
}

.input-group {
    margin-bottom: 12px;
}

.input-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
}

.active-mlf-batch {
    background: white;
    padding: 10px;
    border-radius: 6px;
    margin: 8px 0;
    border: 1px solid #dee2e6;
}

.strain-recommendation {
    background: #fff3cd;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border: 2px solid #ffc107;
}

.strain-score {
    background: #6c1d45;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    margin: 5px 0;
}

.strain-details {
    background: white;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

.alternative-strains {
    margin-top: 15px;
}

.alternative-strain {
    background: white;
    padding: 8px;
    border-radius: 4px;
    margin: 5px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
    background: #6c1d45;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-small:hover {
    background: #5a1738;
}

/* Clean compact row */
.compact-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 4px;
  margin-bottom: 12px;
}

.field-group {
  display: flex;
  flex-direction: column;
}

.field-group label {
  font-size: 0.75em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.field-group select,
.field-group input {
  width: 100%;
  padding: 6px 4px;
  border-radius: 8px;
  border: 1.5px solid #e1e5e9;
  font-size: 0.9em;
  background: #fff;
  box-sizing: border-box;
}

/* Size inputs styling */
.size-inputs {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 2px;
  align-items: center;
}

.size-inputs input {
  padding: 8px 6px;
}

.size-inputs span {
  font-size: 0.75em;
  color: #666;
  font-weight: 600;
  white-space: nowrap;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
  .compact-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  
  .size-inputs {
    grid-template-columns: 1fr auto 1fr auto;
    max-width: 200px;
    margin: 0 auto;
  }
}



/* Fix for batch management buttons on mobile */
.batch-actions-enhanced .btn-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.batch-actions-enhanced .btn-row button {
  flex: 1;
  padding: 8px 4px;
  font-size: 12px;
  min-height: 36px;
}

.batch-actions-enhanced .btn-row:has(button:only-child) {
  grid-template-columns: 1fr;
}

/* Ensure proper spacing on mobile */
.batch-list-container {
    margin-bottom: 15px;
}

.batch-details {
    margin-top: 15px;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .batch-actions-enhanced .btn-row {
        gap: 6px;
    }
    
    .batch-actions-enhanced .btn-row button {
        min-width: 100px;
        font-size: 13px;
        padding: 8px 6px;
    }
    
    .batch-management-header {
        text-align: center;
    }
    
    .batch-stats {
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* Fix for batch management main buttons */
.batch-actions .btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 5px;
}

.batch-actions .btn-row button {
    flex: 1;
    min-width: 120px;
    max-width: 160px;
    text-align: center;
    padding: 10px 6px;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .batch-actions .btn-row {
        gap: 4px;
    }
    
    .batch-actions .btn-row button {
        min-width: 100px;
        font-size: 12px;
        padding: 8px 4px;
    }
}

/* Fix for batch management main buttons */
.batch-actions .btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 100%;
    margin: 0 auto;
}

.batch-actions .btn-row button {
    flex: 1;
    min-width: 140px;
    max-width: 180px;
    text-align: center;
    padding: 10px 8px;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .batch-actions .btn-row {
        gap: 6px;
    }
    
    .batch-actions .btn-row button {
        min-width: 120px;
        font-size: 13px;
        padding: 8px 6px;
    }
}

/* Fix for enhanced batch management buttons */
.batch-actions-enhanced .btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 100%;
}

.batch-actions-enhanced .btn-row button {
    flex: 1;
    min-width: 120px;
    max-width: 200px;
    text-align: center;
    padding: 10px 8px;
    font-size: 14px;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .batch-actions-enhanced .btn-row {
        gap: 6px;
    }
    
    .batch-actions-enhanced .btn-row button {
        min-width: 100px;
        font-size: 13px;
        padding: 8px 6px;
    }
    
    .batch-management-header {
        text-align: center;
    }
    
    .batch-stats {
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* Batch Enhancements */

.batch-status-summary {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 8px;
    flex-wrap: wrap;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
}

.status-badge.active {
    background: rgba(46, 204, 113, 0.2);
    color: #27ae60;
}

.status-badge.complete {
    background: rgba(241, 196, 15, 0.2);
    color: #f39c12;
}

.status-badge.stuck {
    background: rgba(231, 76, 60, 0.2);
    color: #c0392b;
}



/* Make most buttons maroon, keep delete buttons red */
.batch-actions-enhanced .btn-warning,
.batch-actions-enhanced .btn-info, 
.batch-actions-enhanced .btn-secondary,
.batch-actions-enhanced button {
  background: linear-gradient(135deg, var(--accent), var(--accent-light)) !important;
  color: #fff !important;
}

/* Keep red for destructive actions */
.batch-actions-enhanced .btn-danger {
  background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
}

/* Modal styles for vessel transfer */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 90%;
    width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    margin: 0;
}

/* Timeline styling */
.timeline {
    margin: 15px 0;
}

.timeline-step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-left: 10px;
    border-left: 3px solid #ddd;
}

.timeline-step.current {
    border-left-color: #2c5530;
}

.timeline-icon {
    font-size: 24px;
    margin-right: 10px;
    flex-shrink: 0;
}

.timeline-content {
    flex-grow: 1;
}

.timeline-content strong {
    display: block;
    margin-bottom: 5px;
}

.timeline-content small {
    color: #666;
    font-size: 0.9em;
}

/* Color Analysis Styles */
.color-history-timeline {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

.color-history-timeline .timeline-item {
    transition: transform 0.2s, box-shadow 0.2s;
}

.color-history-timeline .timeline-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.batch-selector option.cloud-batch {
    background-color: #e3f2fd;
}

.batch-selector option.local-batch {
    background-color: #e8f5e8;
}

.batch-selector option:hover {
    background-color: #f0f0f0;
}

/* Color comparison swatches */
.color-swatch {
    width: 100%;
    height: 60px;
    border-radius: 6px;
    border: 2px solid #ddd;
    transition: transform 0.2s;
}

.color-swatch:hover {
    transform: scale(1.02);
}

/* Modal enhancements */
.modal-content {
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Progress bars for similarity */
.similarity-bar {
    height: 20px;
    background: linear-gradient(to right, #e74c3c, #f39c12, #27ae60);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.similarity-fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    transition: width 0.5s ease;
}

/* Tooltips for color info */
.color-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.color-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    z-index: 1000;
}

/* ==== Progressive "Manage Selected Batch" Dropdown ============= */

.action-dropdown {
  position: relative;
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  z-index: 300;
}

/* The pill button */
.dropdown-toggle {
  border-radius: 999px;
  border: none; /* override any global button border */
  padding: 8px 14px;
  font-size: 0.9rem;
  background: #2c5530;          /* dark green like the rest of app */
  color: #ffffff !important;    /* force readable text */
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.dropdown-toggle:hover {
  filter: brightness(1.05);
}

/* Menu container */
.dropdown-menu {
  position: absolute;
  top: 115%;
  right: 0;
  min-width: 230px;
  max-width: 280px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
  padding: 4px 0;
  display: none;
  z-index: 400;
  font-size: 0.9rem;
  color: #222;                  /* default text color INSIDE menu */
}

.dropdown-menu.show {
  display: block;
}

/* Sections inside the dropdown */
.dropdown-section {
  padding: 4px 0;
  border-top: 1px solid #f0f0f0;
}

.dropdown-section:first-child {
  border-top: none;
}

.dropdown-header {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  padding: 4px 12px 2px;
}

/* Each action row */
.dropdown-item {
  width: 100%;
  border: none;
  background: none;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  color: #222 !important;       /* 🔥 force dark text so labels show */
  white-space: nowrap;
}

.dropdown-item .icon {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.dropdown-item:hover {
  background: #f5f5f5;
}

/* Slight emphasis for destructive actions */
.dropdown-item[data-action="delete"],
.dropdown-item[data-action="clearAll"],
.dropdown-item[data-action="clearLocal"] {
  color: #b0382f !important;
}

.dropdown-item[data-action="delete"] .icon,
.dropdown-item[data-action="clearAll"] .icon,
.dropdown-item[data-action="clearLocal"] .icon {
  filter: saturate(1.2);
}

/* Stat badges (used in summary row above list) */
.stat-badge {
  border-radius: 999px;
  padding: 2px 8px;
  background: #f3f3f3;
}

.stat-badge.cloud {
  background: #e6f3ff;
}

.stat-badge.local {
  background: #eef9ea;
}

/* ===== Batch Quick Info Card – Final Layout Pass ===== */

.batch-quick-info {
  border-radius: 10px;
  border: 1px solid #e2e2e2;
  padding: 10px 12px;
  background: #ffffff;
  font-size: 0.85rem;
  line-height: 1.35;
}

/* Top row: name left, progress right */
.batch-quick-info .qi-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}

.batch-quick-info .qi-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.batch-quick-info .qi-subtitle {
  color: #666;
  font-size: 0.8rem;
  margin-top: 2px;
}

/* Right-side stat stack */
.batch-quick-info .qi-right {
  text-align: right;
  font-size: 0.8rem;
  color: #444;
  white-space: nowrap;
}

/* Detail rows */
.batch-quick-info .qi-details {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin-top: 6px;
}

.batch-quick-info .qi-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.batch-quick-info .qi-label {
  color: #666;
}

.batch-quick-info .qi-value {
  font-weight: 500;
  color: #222;
}

/* Emphasis rows */
.batch-quick-info .qi-stage {
  color: #2c5530;
  font-weight: 600;
}

/* Mobile tightening */
@media (max-width: 600px) {
  .batch-quick-info {
    padding: 9px 10px;
  }

  .batch-quick-info .qi-title {
    font-size: 0.9rem;
  }

  .batch-quick-info .qi-right {
    font-size: 0.75rem;
  }
}


/* ==== Mobile adjustments for dropdown ========================== */

@media (max-width: 600px) {
  .action-dropdown {
    justify-content: center;
  }

  .dropdown-menu {
    right: 50%;
    transform: translateX(50%);
    max-width: 92vw;
  }

  .dropdown-toggle {
    width: 100%;
    justify-content: center;
  }
}

/* ===== Results Suggested Actions Bar ===== */

.result-action-bar {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f9f5ff;
  border: 1px solid #e2d9ff;
  font-size: 0.8rem;
}

.result-action-bar .rab-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: #4a148c;
}

.rab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.rab-insight-text {
  color: #333;
  line-height: 1.3;
}

.rab-chip {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.75rem;
  border: none;
  cursor: pointer;
  background: #4a148c;
  color: #fff;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .rab-actions {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ===== Batch Insight modals (Color, Predictor, Template) ===== */

#batchInsightModal .modal-content {
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 14px 16px 16px;
  box-sizing: border-box;
}

#batchInsightModal h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

/* Tighten spacing on text */
#batchInsightModal p {
  margin: 4px 0;
  line-height: 1.4;
  font-size: 0.85rem;
}

#batchInsightModal div,
#batchInsightModal label,
#batchInsightModal ul,
#batchInsightModal li {
  font-size: 0.85rem;
}

/* Template name input */
#batchInsightModal input[type="text"],
#batchInsightModal input[type="number"] {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 6px;
  font-size: 0.85rem;
}

/* Footer buttons */
#batchInsightModal .btn-row {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

#batchInsightModal .btn-row button {
  min-width: 120px;
}

/* ===== iOS FIX: keep batch list scrolling inside the app card ===== */

/* Let the whole cloud panel scroll INSIDE the card */
#cloudManagementSection {
  max-height: 70vh;
  overflow-y: visible;                 /* 🔥 was overflow: hidden */
  -webkit-overflow-scrolling: touch;
}

/* Optional inner scroll for the list column */
.batch-list-column {
  max-height: 45vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Only matters if you add the wrapper div in HTML later */
.batch-list-scroll {
  max-height: 220px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

.batch-list {
  width: 100%;
  box-sizing: border-box;
}
