/* START OF FILE styles.css */
/* LuminX Tablet UI - Modern Design System */

:root {
    /* Colors */
    --bg: #F3F4F6;
    --surface: #FFFFFF;
    --border: #E5E7EB;
    
    --text-main: #111827;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    
    --primary: #009386;
    --primary-hover: #007d72;
    --primary-light: #E0F2F1;
    
    --danger: #EF4444;
    --danger-bg: #FEF2F2;
    --warning: #F59E0B;
    --warning-bg: #FFFBEB;
    --success: #10B981;
    --success-bg: #ECFDF5;
    --blue: #3B82F6;
    --blue-bg: #EFF6FF;
    
    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(255, 255, 255, 0.5);
    
    /* Spacing */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;

    /* Responsive grid sizing */
    --grid-card-min: clamp(320px, 45vw, 560px);
    --grid-card-min-tight: clamp(300px, 40vw, 520px);
    --grid-card-min-compact: clamp(160px, 22vw, 240px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    width: 100%;
    height: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: pan-y;
    overflow: hidden;
}

/* Allow text selection in form controls */
input, textarea, select, [contenteditable="true"] {
    -webkit-user-select: text;
    user-select: text;
    touch-action: manipulation;
}

/* Layout */
.app {
    width: 100%;
    min-height: 100vh;
    height: 100%;
    padding-bottom: 80px; /* Space for sticky footer */
    touch-action: pan-y;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

.view {
    display: none;
    padding: 24px;
    width: 100%;
    max-width: 100%;
    margin: 0;
    animation: fadeIn 0.3s ease;
    touch-action: pan-y;
}

.view.active { display: block; }

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

/* Typography & Common */
h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: var(--text-main); }
h2 { font-size: 20px; font-weight: 600; color: var(--text-main); }
h3 { font-size: 16px; font-weight: 600; color: var(--text-main); margin-bottom: 12px; }
.header-subtitle { font-size: 13px; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }

/* Buttons */
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 147, 134, 0.2);
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}
.btn-secondary:hover { background: #F9FAFB; border-color: #D1D5DB; }

.btn-glass {
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(209, 213, 219, 0.5);
    color: var(--text-main);
}
.btn-glass:hover { background: white; }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: rgba(0,0,0,0.05); color: var(--text-main); }

.btn-icon {
    width: 44px; height: 44px;
    border-radius: 50%; /* Circle */
    display: flex; align-items: center; justify-content: center;
    padding: 0;
}

.btn-icon-text { display: flex; align-items: center; gap: 8px; }

/* Inputs */
input[type="search"], input[type="text"], .form-input, textarea, select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: white;
    transition: border-color 0.2s;
    font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 147, 134, 0.1); }

/* Dashboard Specifics */
.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 32px; gap: 20px; flex-wrap: wrap; }
.search-wrapper { position: relative; width: 100%; max-width: 400px; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-wrapper input { padding-left: 42px; height: 48px; border-radius: 24px; /* Rounded search */ }

.doors-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}

@media (max-width: 1200px) {
    .doors-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .doors-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
    .doors-grid { grid-template-columns: repeat(1, minmax(0, 1fr)); }
}

/* Door Card Redesign */
.door-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    border-left: 5px solid transparent; /* Status Indicator */
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.door-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

/* Status Colors */
.door-card.status-active { border-left-color: var(--success); }
.door-card.status-scheduled { border-left-color: var(--blue); }
.door-card.status-inactive { border-left-color: var(--border); opacity: 0.8; }

.door-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.door-number { font-size: 24px; font-weight: 700; color: var(--text-main); }
.door-info { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px; }
.door-info .label { color: var(--text-secondary); }
.door-info .value { font-weight: 600; color: var(--text-main); }

/* Badges */
.badge { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; text-transform: uppercase; }
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-scheduled { background: var(--blue-bg); color: var(--blue); }
.badge-inactive { background: #F3F4F6; color: #6B7280; }
.badge-inbound { background: #DBEAFE; color: #1E40AF; }
.badge-outbound { background: #F3E8FF; color: #6B21A8; }
.badge-verified { background: var(--success-bg); color: var(--success); border: 1px solid #A7F3D0; }
.badge-needs-review { background: var(--danger-bg); color: var(--danger); border: 1px solid #FECACA; }
.badge-rerun { background: var(--warning-bg); color: var(--warning); border: 1px solid #FDE68A; }
.badge-incomplete { background: #F3F4F6; color: #9CA3AF; }

/* Session View Improvements */
.page-header-with-back { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.header-left-group { display: flex; align-items: center; gap: 16px; }

/* Banners */
.active-shipment-bar, .scheduled-shipment-bar {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 20px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}
.active-shipment-bar { border: 1px solid var(--success); }
.banner-status-stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--success); }

.active-label, .scheduled-label { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; text-transform: uppercase; }
.active-meta, .scheduled-info { display: flex; align-items: center; gap: 16px; }
.receipt-num { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.banner-actions { display: flex; gap: 12px; }
.btn-glass-danger { 
    color: var(--danger); 
    border: 1px solid #FECACA; 
    background: #FEF2F2;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

/* Tabs */
.tabs-and-search { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tabs-group { display: flex; gap: 24px; }
.tab {
    padding: 0 0 12px 0;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 15px;
    position: relative;
}
.tab.active { color: var(--primary); }
.tab.active::after { content: ''; position: absolute; bottom: -1px; left: 0; width: 100%; height: 2px; background: var(--primary); }
.search-box-container { margin-bottom: 12px; position: relative; width: 300px; }
.search-box-container input { height: 40px; padding-left: 36px; }
.search-box-container .search-icon { left: 12px; }

/* Shipment Grid */
.shipments-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}

@media (max-width: 1200px) {
    .shipments-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .shipments-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
    .shipments-grid { grid-template-columns: repeat(1, minmax(0, 1fr)); }
}
.shipment-tile { background: white; border-radius: var(--radius-md); padding: 20px; border: 1px solid var(--border); display: flex; flex-direction: column; gap: 16px; transition: transform 0.2s; }
.shipment-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.shipment-title-row { display: flex; justify-content: space-between; align-items: center; }
.shipment-receipt { font-size: 18px; font-weight: 700; }
.shipment-info-row { display: flex; flex-wrap: wrap; gap: 16px; color: var(--text-secondary); font-size: 13px; }
.info-item { display: flex; align-items: center; gap: 6px; background: #F9FAFB; padding: 4px 8px; border-radius: 4px; }
.btn-start { width: 100%; padding: 10px; background: var(--surface); border: 1px solid var(--border); font-weight: 600; color: var(--primary); border-radius: 6px; }
.btn-start:hover { background: var(--primary-light); border-color: var(--primary); }

/* Session View Details */
.session-header-bar { background: white; border-radius: var(--radius-md); padding: 20px; display: flex; align-items: center; gap: 20px; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.session-title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.session-meta { display: flex; gap: 20px; color: var(--text-secondary); font-size: 14px; }
.meta-item { display: flex; align-items: center; gap: 6px; }
.timer-capsule { background: var(--text-main); color: white; padding: 8px 16px; border-radius: 20px; font-family: monospace; font-size: 16px; display: flex; align-items: center; gap: 8px; }

/* Metrics & Progress Bar */
.metrics-row { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 20px; }
.metric-card { background: white; padding: 20px; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); border: 1px solid var(--border); display: flex; flex-direction: column; justify-content: center; }
.main-metric { border-left: 4px solid var(--primary); }
.warning-metric { border-left: 4px solid var(--warning); align-items: center; }
.metric-header { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: 14px; font-weight: 600; color: var(--text-secondary); width: 100%; }
.progress-track { width: 100%; height: 12px; background: #E5E7EB; border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 6px; transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
.metric-value { font-size: 32px; font-weight: 700; color: var(--text-main); line-height: 1; }

/* Split View (Scanned/Unscanned) */
.split-view-container { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 24px; padding-bottom: 60px; }
@media (max-width: 900px) { .split-view-container { grid-template-columns: 1fr; } }

.section-box { background: white; border-radius: var(--radius-md); padding: 0; overflow: hidden; border: 1px solid var(--border); height: 100%; }
.section-header { padding: 16px 20px; background: #F9FAFB; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.section-header h2 { font-size: 16px; margin: 0; }
.count-badge { background: #E5E7EB; padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; }

.empty-state-illustration { text-align: center; padding: 40px; color: var(--text-muted); }
.illustration-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }

.scanned-list { padding: 0; max-height: 600px; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.pallet-item { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; cursor: pointer; transition: background 0.1s; }
.pallet-item:hover { background: #F3F4F6; }
.pallet-left { display: flex; align-items: center; gap: 16px; }
.pallet-icon { width: 32px; height: 32px; background: #E5E7EB; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); font-size: 14px; }

.pallets-grid-compact { padding: 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(var(--grid-card-min-compact), 1fr)); gap: 12px; max-height: 600px; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.unscanned-card { background: #F9FAFB; border: 1px dashed var(--border); border-radius: 8px; padding: 12px; text-align: center; font-size: 13px; color: var(--text-secondary); }

/* Sticky Footer */
.sticky-footer { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); width: 95%; max-width: 1360px; z-index: 100; }
.footer-glass { background: rgba(17, 24, 39, 0.9); backdrop-filter: blur(12px); padding: 16px 24px; border-radius: 16px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 10px 25px rgba(0,0,0,0.2); color: white; }
.footer-right { display: flex; gap: 12px; }

/* Pallet Detail Redesign */
.detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; background: white; padding: 20px; border-radius: var(--radius-md); border: 1px solid var(--border); gap: 12px; }
.detail-actions { display: flex; gap: 12px; align-items: center; }
.detail-title { flex: 1; margin-left: 16px; }
.detail-layout { display: grid; grid-template-columns: 1.5fr 1fr; gap: 24px; }
@media (max-width: 900px) { .detail-layout { grid-template-columns: 1fr; } }

.dropdowns-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dropdown-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; }
.select-wrapper { position: relative; }
.select-arrow { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text-secondary); }

/* Custom Menu styling enhancement */
.menu-dropdown { position: relative; }
.menu-trigger { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: white; border: 1px solid var(--border); border-radius: var(--radius-sm); height: 48px; }
.menu-list { position: absolute; top: 54px; left: 0; width: 100%; background: white; border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 50; display: none; overflow: hidden; }
.menu-list.open { display: block; }
.menu-search-wrapper { padding: 8px; border-bottom: 1px solid var(--border); }
.menu-search { height: 36px; border-radius: 4px; font-size: 14px; }
.menu-scroll-area { max-height: 250px; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.menu-item { padding: 10px 16px; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.menu-item:hover { background: #F3F4F6; }
.avatar-icon { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-size: 11px; font-weight: 600; }

/* Validation Grid */
.validation-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.validation-item { padding: 12px; border-radius: 8px; border: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.validation-item.status-pass { background: var(--success-bg); border-color: #A7F3D0; }
.validation-item.status-fail { background: var(--danger-bg); border-color: #FECACA; }
.validation-status { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.check-icon { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-size: 12px; }
.check-icon.pass { background: var(--success); }
.check-icon.fail { background: var(--danger); }
.validation-label { font-size: 12px; color: var(--text-secondary); }

/* Media Grid */
.media-grid-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.media-item { aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); cursor: zoom-in; transition: transform 0.2s; }
.media-item:hover { transform: scale(1.02); }
.media-item img { width: 100%; height: 100%; object-fit: cover; }

/* Media Placeholder Styles */
.media-placeholder { display: flex; align-items: center; justify-content: center; min-height: 200px; position: relative; }
.media-placeholder-content { text-align: center; color: white; padding: 20px; }
.media-placeholder-label { font-size: 18px; font-weight: 600; margin-bottom: 8px; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.media-placeholder-number { font-size: 14px; opacity: 0.9; text-shadow: 0 1px 3px rgba(0,0,0,0.3); }

/* Modals */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(2px); display: none; align-items: center; justify-content: center; z-index: 1000; animation: fadeIn 0.2s; }
.modal.show { display: flex; }
.modal-content { background: white; border-radius: 20px; padding: 32px; width: 90%; max-width: 500px; box-shadow: var(--shadow-lg); }
.modal-large { max-width: 600px; }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.modal-header > div { flex: 1; }
.modal-header h2 { margin: 0 0 8px 0; font-size: 24px; font-weight: 600; }
.modal-subtitle { color: var(--text-secondary); font-size: 14px; margin: 0; }
.modal-body { margin-bottom: 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; padding-top: 16px; border-top: 1px solid var(--border); }
.input-group-vertical { margin-bottom: 20px; }
.form-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 8px; color: var(--text-main); }
.input-with-button { display: flex; gap: 8px; }
.form-input-flex { flex: 1; }
.large-input { height: 48px; font-size: 16px; }
.icon-btn-square { width: 48px; height: 48px; border: 1px solid var(--border); background: white; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn-square:hover { background: #F9FAFB; }
.checkbox-card { background: #F9FAFB; padding: 16px; border-radius: 8px; border: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; }
.checkbox-input { 
    width: 20px; 
    height: 20px; 
    cursor: pointer; 
    background: white;
    border: 2px solid var(--border);
    border-radius: 4px;
    appearance: none;
    -webkit-appearance: none;
    position: relative;
}
.checkbox-input:checked {
    background: var(--primary);
    border-color: var(--primary);
}
.checkbox-input:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 14px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.checkbox-content { flex: 1; }
.checkbox-main-label { font-weight: 500; cursor: pointer; display: block; margin-bottom: 4px; }
.checkbox-hint { font-size: 13px; color: var(--text-secondary); margin: 0; }
.btn-wide { min-width: 160px; }

/* Overlays */
.status-overlay { position: fixed; inset: 0; z-index: 2000; display: none; align-items: center; justify-content: center; color: white; backdrop-filter: blur(10px); }
.status-overlay.show { display: flex; animation: fadeIn 0.2s; }
.overlay-content { text-align: center; transform: scale(1); animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes popIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.overlay-icon-circle { width: 80px; height: 80px; border-radius: 50%; border: 4px solid rgba(255,255,255,0.5); display: flex; align-items: center; justify-content: center; font-size: 40px; margin: 0 auto 20px; background: rgba(255,255,255,0.2); }
.verified-bg { background: rgba(16, 185, 129, 0.9); }
.review-bg { background: rgba(239, 68, 68, 0.9); }
.rerun-bg { background: rgba(245, 158, 11, 0.9); }

/* Overlay Pallet Info - AWS Compatible */
.overlay-pallet-info { 
    margin-top: 40px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    text-align: left !important;
    background: rgba(255, 255, 255, 0.95) !important;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 32px !important;
    border-radius: 16px !important;
    border: 4px solid white !important;
    min-width: 500px !important;
    max-width: 600px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4) !important;
}
.overlay-info-item { 
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 8px 0 !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
.overlay-info-item:last-child {
    border-bottom: none;
}
.overlay-info-item .info-label { 
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #374151 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
}
.overlay-info-item .info-value { 
    font-size: 24px !important;
    font-weight: 800 !important;
    color: #111827 !important;
    letter-spacing: 0.04em !important;
}