/* ==========================================================================
   CSS SYSTEM - HOUSEPLANT MANAGER & LABEL GENERATOR
   ========================================================================== */

/* Import Google Fonts for screen UI */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Playfair+Display:ital,wght@0,600;1,400&display=swap');

:root {
    /* Theme Light Variables */
    --bg-main: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-input: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --accent-color: #10b981;
    --accent-color-hover: #059669;
    --accent-light: #ecfdf5;
    
    /* Plant Group Colors */
    --group-desert: #c2410c;
    --group-rainforest: #0f766e;
    --group-swamp: #581c87;
    --group-woodland: #1e3a8a;
    
    /* Overlay glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(226, 232, 240, 0.8);
    --glass-blur: 12px;
}

[data-theme="dark"] {
    /* Theme Dark Variables */
    --bg-main: #0b0f19;
    --bg-sidebar: #111827;
    --bg-card: #1f2937;
    --bg-card-hover: #374151;
    --bg-input: #1f2937;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #374151;
    --accent-color: #34d399;
    --accent-color-hover: #10b981;
    --accent-light: rgba(16, 185, 129, 0.1);
    
    /* Overlay glassmorphism */
    --glass-bg: rgba(17, 24, 39, 0.7);
    --glass-border: rgba(55, 65, 81, 0.8);
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==========================================================================
   DASHBOARD SCREEN LAYOUT (On-Screen UI Only)
   ========================================================================== */

#app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar and Filters Panel */
.sidebar {
    width: 320px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    flex-shrink: 0;
    overflow-y: auto;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #10b981, #0f766e);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

.brand-title {
    font-family: 'Playfair Display', serif;
    font-size: 22px;
    font-weight: 600;
}

.brand-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: -2px;
}

/* Search Box */
.search-box {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--bg-input);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
}

.search-input:focus {
    border-color: var(--accent-color);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 50%;
    transition: color 0.2s, background 0.2s;
    line-height: 1;
}

.search-clear-btn:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.08);
}

/* Filter Groups */
.filter-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.section-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.filter-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}

.filter-btn.active {
    background-color: var(--accent-light);
    color: var(--accent-color);
    font-weight: 600;
}

.filter-count {
    font-size: 12px;
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 20px;
    color: var(--text-muted);
}

.filter-btn.active .filter-count {
    background: var(--accent-color);
    color: white;
}

/* Statistics Mini Cards */
.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

.stat-card {
    background: var(--bg-input);
    padding: 12px;
    border-radius: 12px;
    text-align: center;
}

.stat-val {
    font-size: 20px;
    font-weight: 700;
}

.stat-lbl {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    margin-top: 2px;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    padding: 40px;
    overflow-y: auto;
    height: 100vh;
}

/* Top bar of main panel */
.top-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
}

.tabs-navigation {
    display: flex;
    background: var(--bg-input);
    padding: 4px;
    border-radius: 12px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn.active {
    background: var(--bg-sidebar);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.action-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn {
    padding: 10px 18px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-sidebar);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.btn:hover {
    background-color: var(--bg-card-hover);
}

.btn-primary {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

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

.btn-icon-only {
    padding: 10px;
    border-radius: 10px;
}

/* Inventory Tab Styles */
#inventory-tab-content {
    display: block;
}

.inventory-batch-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    padding: 14px 20px;
    border-radius: 14px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.batch-selection-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
}

.batch-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-color);
    cursor: pointer;
}

.plant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 24px;
}

/* Interactive plant card inside UI grid */
.ui-plant-card {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    height: 235px;
}

.ui-plant-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-color);
}

.ui-card-accent-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
}

.ui-card-accent-bar.bg-desert { background-color: var(--group-desert); }
.ui-card-accent-bar.bg-rainforest { background-color: var(--group-rainforest); }
.ui-card-accent-bar.bg-swamp { background-color: var(--group-swamp); }
.ui-card-accent-bar.bg-woodland { background-color: var(--group-woodland); }

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

.ui-card-group-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 12px;
    color: white;
}
.ui-card-group-tag.bg-desert { background-color: var(--group-desert); }
.ui-card-group-tag.bg-rainforest { background-color: var(--group-rainforest); }
.ui-card-group-tag.bg-swamp { background-color: var(--group-swamp); }
.ui-card-group-tag.bg-woodland { background-color: var(--group-woodland); }

.ui-card-owned-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    background-color: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.ui-card-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--accent-color);
    cursor: pointer;
}

.ui-card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 2px;
    line-height: 1.25;
    padding-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ui-card-sci {
    font-size: 12px;
    font-style: italic;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 12px;
    line-height: 1.2;
    padding-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ui-card-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: auto;
}

.ui-card-detail-item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ui-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    margin-top: 12px;
}

.ui-card-qty-selector {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ui-card-qty-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.ui-card-qty-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ui-card-qty-input {
    width: 28px;
    text-align: center;
    border: none;
    font-size: 12px;
    font-weight: 700;
    background: transparent;
    color: var(--text-primary);
}

.ui-card-actions {
    display: flex;
    gap: 6px;
}

.ui-card-action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 6px;
}

.ui-card-action-btn:hover {
    color: var(--text-primary);
    background-color: var(--bg-card-hover);
}

.ui-card-action-btn.delete-btn:hover {
    color: #ef4444;
    background-color: #fee2e2;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-sidebar);
    border: 1px dashed var(--border-color);
    border-radius: 20px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.empty-state-icon {
    font-size: 48px;
    opacity: 0.6;
}

/* Print Preview Screen Layout */
#preview-tab-content {
    display: none;
}

.preview-controls-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    padding: 16px 20px;
    border-radius: 14px;
    margin-bottom: 24px;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.tier-select-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tier-selector {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
}

.calibration-toggle-btn {
    font-size: 13px;
    color: var(--accent-color);
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

/* Calibration Panel */
.calibration-panel {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 14px;
    margin-bottom: 24px;
    display: none;
    flex-direction: column;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.calibration-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.calibration-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.calibration-label-wrapper {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.calibration-slider {
    width: 100%;
    accent-color: var(--accent-color);
    cursor: pointer;
}

.calibration-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* virtual paper layout container (Shows pages on screen) */
.virtual-sheets-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    padding: 10px;
}

.sheet-page-indicator {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: -30px;
    text-align: center;
}

/* Virtual sheet wrapper on screen */
.virtual-sheet-wrapper {
    transform-origin: top center;
    box-shadow: var(--shadow-lg);
    background: #ffffff;
    border: 1px solid #cbd5e1;
    position: relative;
    /* We align the virtual sheets using exact physical units but scale them dynamically on screens if needed */
}

/* Interactive modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-container {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 100%;
    max-width: 740px;
    max-height: 90vh;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

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

.modal-title {
    font-size: 18px;
    font-weight: 700;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}

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

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-input);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent-color);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Toast message style */
.toast-msg {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #10b981;
    color: white;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 200;
}

.toast-msg.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-msg.error {
    background: #ef4444;
}

/* Helper to hide preview canvas print-container on screen */
#print-assets-container {
    display: none;
}


/* ==========================================================================
   AVERY LABEL TEMPLATE ARCHITECTURES (Clean copy of original styles)
   ========================================================================== */

/* Page layout configurations for browser printing */
@page {
    size: 8.5in 11in;
    margin: 0;
}

/* Common Sheet Class for Print layout templates */
.print-sheet {
    width: 8.5in;
    height: 11in;
    box-sizing: border-box;
    background-color: #ffffff;
    overflow: hidden;
    page-break-after: always;
    page-break-inside: avoid;
    /* Applied for exact centering during screen preview */
    margin: 0 auto;
}

.print-sheet:last-of-type {
    page-break-after: avoid;
}

/* --------------------------------------------------------------------------
   LARGE TIER (Avery 5163 / 8163) - 10 Labels Per Sheet
   -------------------------------------------------------------------------- */
.print-sheet-large {
    padding-top: 0.5in;
    padding-bottom: 0.5in;
    padding-left: 0.16in;
    padding-right: 0.16in;
    
    display: grid;
    grid-template-columns: 4.0in 4.0in;
    grid-template-rows: repeat(5, 2.0in);
    column-gap: 0.18in;
    row-gap: 0in;
}

.label-card {
    width: 4.0in;
    height: 2.0in;
    box-sizing: border-box;
    padding: 0.05in 0.12in;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    page-break-inside: avoid;
    font-family: 'Arial', sans-serif;
    background-color: #ffffff;
    color: #1e293b;
    border: 1px dashed #cbd5e1;
    position: relative;
}

.label-card .banner {
    font-size: 6pt;
    font-weight: bold;
    color: #ffffff;
    padding: 1px 5px;
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
    display: inline-block;
    align-self: flex-start;
}

.label-card .bg-desert { background-color: #c2410c !important; }
.label-card .bg-rainforest { background-color: #0f766e !important; }
.label-card .bg-swamp { background-color: #581c87 !important; }
.label-card .bg-woodland { background-color: #1e3a8a !important; }

.label-card .title-block { 
    margin-bottom: 3px; 
}

.label-card .title { 
    font-size: 14pt; 
    font-weight: 800; 
    color: #1e293b; 
    margin: 0; 
    line-height: 1.1; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

.label-card .meta-line { 
    font-size: 9pt; 
    color: #64748b; 
    margin: 1px 0 0 0; 
    line-height: 1.1; 
}

.label-card .scientific { 
    font-style: italic; 
    font-weight: bold; 
    color: #475569; 
}

.label-card .origin { 
    font-size: 8pt; 
    text-transform: uppercase; 
    letter-spacing: 0.3px; 
    color: #94a3b8; 
    font-weight: bold; 
}

.label-card .info-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    row-gap: 2px; 
    column-gap: 10px; 
    margin: 2px 0;
}

.label-card .grid-item { 
    font-size: 7.5pt; 
    font-weight: bold; 
    color: #334155; 
    display: flex; 
    align-items: center; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

.label-card .grid-item.full-width { 
    grid-column: span 2; 
    color: #475569; 
    border-top: 1px dashed #f1f5f9; 
    padding-top: 1px; 
    margin-top: 1px; 
}

.label-card .icon { 
    font-style: normal; 
    margin-right: 4px; 
    font-size: 8.5pt; 
    width: 12px; 
    text-align: center; 
}

.label-card .footer { 
    border-top: 1px solid #e2e8f0; 
    padding-top: 1px; 
    margin-top: 1px; 
}

.label-card .footnote { 
    font-size: 6.5pt; 
    font-style: italic; 
    font-weight: bold; 
    color: #64748b; 
    line-height: 1.1; 
    margin: 0; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

/* --------------------------------------------------------------------------
   MINI TIER (Avery 5160 / 8160) - 30 Labels Per Sheet
   -------------------------------------------------------------------------- */
.print-sheet-mini {
    padding: 0.5in 0.19in;
    display: grid;
    grid-template-columns: 2.625in 2.625in 2.625in;
    grid-template-rows: repeat(10, 1.0in);
    column-gap: 0.12in;
    row-gap: 0in;
}

.print-sheet-mini .label-card {
    width: 2.625in;
    height: 1.0in;
    max-height: 1.0in;
    box-sizing: border-box;
    padding: 0.04in 0.08in 0.03in 0.08in;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    font-family: 'Arial', sans-serif;
    background-color: #ffffff;
    color: #1e293b;
    border: 1px dashed #cbd5e1;
}

.print-sheet-mini .label-card.col-1 {
    padding-left: calc(0.08in + 0.4mm);
}

.print-sheet-mini .banner {
    font-size: 5pt;
    font-weight: bold;
    color: #ffffff;
    padding: 0px 3px;
    border-radius: 1px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 1px;
    display: inline-block;
    align-self: flex-start;
}

.print-sheet-mini .bg-desert { background-color: #c2410c; }
.print-sheet-mini .bg-rainforest { background-color: #0f766e; }
.print-sheet-mini .bg-swamp { background-color: #581c87; }
.print-sheet-mini .bg-woodland { background-color: #1e3a8a; }

.print-sheet-mini .title-block {
    margin-left: 1px;
}

.print-sheet-mini .title {
    font-size: 9pt;
    font-weight: bold;
    color: #1e293b;
    margin: 0;
    line-height: 1.0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.print-sheet-mini .scientific {
    font-size: 6.8pt;
    font-style: italic;
    font-weight: bold;
    color: #475569;
    margin: 0;
    line-height: 1.0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.print-sheet-mini .origin {
    font-size: 6.2pt;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    color: #94a3b8;
    font-weight: bold;
}

.print-sheet-mini .stacked-matrix {
    display: flex;
    flex-direction: column;
    row-gap: 1px;
    border-top: 1px dashed #e2e8f0;
    padding-top: 2px;
    margin-left: 1px;
}

.print-sheet-mini .matrix-row-split {
    display: grid;
    grid-template-columns: 1.25in 1.2in;
    column-gap: 2px;
}

.print-sheet-mini .grid-item {
    font-size: 6.2pt;
    font-weight: bold;
    color: #334155;
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.print-sheet-mini .grid-item.full-width {
    grid-column: span 2;
}

.print-sheet-mini .icon {
    font-style: normal;
    font-size: 7.2pt;
    margin-right: 2px;
    width: 10px;
    text-align: center;
}

.print-sheet-mini .footer {
    border-top: 1px solid #e2e8f0;
    padding-top: 1px;
    margin-left: 1px;
}

.print-sheet-mini .footnote {
    font-size: 5.5pt;
    font-style: italic;
    font-weight: bold;
    color: #64748b;
    line-height: 1;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   MICRO TIER (Avery 5195) - 60 Labels Per Sheet
   -------------------------------------------------------------------------- */
.print-sheet-micro {
    /* Baseline calibration offsets applied dynamically to the padding properties */
    padding-top: 0.56in;
    padding-bottom: 0.45in;
    padding-left: 26px;
    padding-right: 32px;
    
    display: grid;
    grid-template-columns: repeat(4, 1.75in);
    grid-template-rows: repeat(15, 0.66in);
    column-gap: 0.30in;
    row-gap: 0in;
}

.print-sheet-micro .micro-card {
    width: 1.75in;
    height: 0.66in;
    max-height: 0.66in;
    box-sizing: border-box;
    padding: 0.01in 0.04in 0.01in 0.09in;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    font-family: 'Arial', sans-serif;
    background-color: #ffffff;
    color: #1e293b;
    border: 1px dashed #cbd5e1;
}

.print-sheet-micro .color-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
}

.print-sheet-micro .bg-desert { background-color: #c2410c; }
.print-sheet-micro .bg-rainforest { background-color: #0f766e; }
.print-sheet-micro .bg-swamp { background-color: #581c87; }
.print-sheet-micro .bg-woodland { background-color: #1e3a8a; }

.print-sheet-micro .title-block {
    margin-left: 2px;
    line-height: 0.9;
}

.print-sheet-micro .micro-title {
    font-size: 8.5pt;
    font-weight: bold;
    color: #1e293b;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.print-sheet-micro .micro-sci {
    font-size: 6pt;
    font-style: italic;
    font-weight: bold;
    color: #475569;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.print-sheet-micro .micro-matrix {
    display: flex;
    flex-direction: column;
    row-gap: 0.5px;
    border-top: 1px dashed #cbd5e1;
    padding-top: 1px;
    margin-top: 1px;
    margin-left: 2px;
}

.print-sheet-micro .micro-split {
    display: grid;
    grid-template-columns: 0.82in 0.82in;
    column-gap: 2px;
    line-height: 1.0;
}

.print-sheet-micro .micro-item {
    font-size: 5.2pt;
    letter-spacing: -0.1px;
    font-weight: bold;
    color: #334155;
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.print-sheet-micro .micro-item.full-width {
    grid-column: span 2;
    font-size: 4.8pt;
}

.print-sheet-micro .icon {
    font-style: normal;
    font-size: 6.5pt;
    margin-right: 2px;
    width: 9px;
    text-align: center;
}

.print-sheet-micro .micro-footer {
    border-top: 1px solid #e2e8f0;
    padding-top: 0.5px;
    margin-left: 2px;
    /* Lifted baseline clearance (prevent descenders clipping) */
    margin-bottom: 1.5px;
    line-height: 1.0;
}

.print-sheet-micro .micro-footnote {
    font-size: 4.8pt;
    font-style: italic;
    font-weight: bold;
    color: #64748b;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ==========================================================================
   PRINT SPECIFIC MEDIA STYLES - EXECUTES TRIGGERED PRINT (Ctrl + P)
   ========================================================================== */
@media print {
    /* Hide all screen components */
    body, html {
        background-color: #ffffff !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    #app-container {
        display: none !important; /* Hide dashboard UI, sidebar, content tabs */
    }
    
    #print-assets-container {
        display: block !important; /* Show printable wrapper grids only */
        width: 8.5in !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .print-sheet {
        box-shadow: none !important;
        margin: 0 !important;
        border: none !important;
        page-break-after: always !important;
        page-break-inside: avoid !important;
    }
    
    .print-sheet:last-of-type {
        page-break-after: avoid !important;
    }
    
    /* Ensure colors print exactly as formatted */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* Suppress card borders in print if needed, but preserve layout */
    .print-sheet-large .label-card,
    .print-sheet-mini .label-card,
    .print-sheet-micro .micro-card {
        border: none !important; /* Removes dashed template guidelines for print output */
    }
}

/* AI Auto-Fill Loading States */
.btn-primary.loading {
    background-color: var(--text-muted);
    border-color: var(--text-muted);
    cursor: not-allowed;
    position: relative;
    pointer-events: none;
}

.btn-primary.loading span {
    visibility: hidden;
}

.btn-primary.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    border: 3px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: button-loading-spinner 1s ease infinite;
}

.btn-primary.rate-limited {
    background-color: #e11d48 !important;
    border-color: #e11d48 !important;
    color: #ffffff !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

.btn-primary.rate-limited span {
    visibility: visible !important;
    font-weight: 700 !important;
}

@keyframes button-loading-spinner {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.form-input-loading {
    opacity: 0.6;
    pointer-events: none;
    background-color: var(--border-color) !important;
}

/* Modal Form Tabs segmented controller */
.form-tabs-container {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    background-color: var(--bg-body);
    margin-top: 8px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-tabs-header {
    display: flex;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}

.form-tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.form-tab-btn:hover {
    color: var(--text-primary);
}

.form-tab-btn.active {
    background: var(--bg-sidebar);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.form-tab-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Card Scannable QR Code Styling */
.card-qr-container {
    position: absolute;
    right: 8px;
    bottom: 6px;
    width: 32px;
    height: 32px;
    background: #ffffff;
    padding: 2px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.card-qr-container img,
.card-qr-container canvas {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}

/* Dashboard Unified Large Card Container */
.dashboard-card-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    min-width: 400px;
}

.dashboard-card-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.dashboard-card-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid var(--border-color);
}

.dashboard-card-wrapper .label-card {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    width: 100% !important;
    min-width: 4.0in !important;
    height: 2.1in !important;
    min-height: 2.1in !important;
    box-sizing: border-box !important;
    padding: 12px 14px !important;
    position: relative;
    flex: 1;
}

/* Authentication Full Screen Glassmorphism Overlay */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
}

.auth-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg), 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    padding: 40px 30px;
    width: 100%;
    max-width: 380px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.auth-logo {
    font-size: 56px;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.08));
}

.auth-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 28px;
}

.btn-google-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    background: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.btn-google-login:hover {
    background: #f9fafb;
    border-color: #c5c7cb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-google-login:active {
    background: #f3f4f6;
    transform: scale(0.98);
}

/* User Profile Sidebar Widget */
.user-profile-widget {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.02);
    margin-top: auto;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-color);
    box-shadow: var(--shadow-sm);
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.btn-logout {
    background: none;
    border: none;
    color: #d32f2f;
    font-size: 11px;
    font-weight: 600;
    text-align: left;
    padding: 0;
    cursor: pointer;
    width: fit-content;
    text-decoration: underline;
    opacity: 0.8;
}

.btn-logout:hover {
    opacity: 1;
}
