/* Batavia Shipping Admin Panel - High DPI Styles */
:root {
    --ink: #0a1828;
    --ink-light: #1e3a54;
    --accent: #c9972b;
    --accent-light: #e6b94d;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --light: #f8fafc;
    --muted: #64748b;
    --border: #e2e8f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Gold Minimal Ghost Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(201, 151, 43, 0.3);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(201, 151, 43, 0.5);
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(201, 151, 43, 0.3) transparent;
}

/* Sidebar specific scrollbar - lighter for dark background */
.sidebar::-webkit-scrollbar-thumb,
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(201, 151, 43, 0.4);
}

.sidebar::-webkit-scrollbar-thumb:hover,
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(201, 151, 43, 0.6);
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #1e293b;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--ink) 0%, var(--ink-light) 50%, #2d4a6f 100%);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(201,151,43,0.1) 0%, transparent 50%);
    animation: pulse 15s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.login-box {
    background: rgba(255,255,255,0.98);
    padding: 50px 40px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4);
    width: 100%; max-width: 420px;
    position: relative; z-index: 1;
    backdrop-filter: blur(10px);
}

.login-logo { text-align: center; margin-bottom: 35px; }
.login-logo img { height: 55px; }
.login-title { text-align: center; color: var(--ink); margin-bottom: 35px; }
.login-title h1 { font-size: 26px; font-weight: 700; margin-bottom: 8px; }
.login-title p { color: var(--muted); font-size: 14px; }

.form-group { margin-bottom: 24px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--ink); font-size: 14px; }
.form-group input {
    width: 100%; padding: 14px 18px;
    border: 2px solid var(--border); border-radius: 12px;
    font-size: 15px; font-family: inherit;
    transition: all 0.2s ease; background: #fff;
}
.form-group input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(201,151,43,0.1); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    padding: 14px 28px; border: none; border-radius: 12px;
    font-size: 15px; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: all 0.2s ease;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: var(--ink); width: 100%;
    box-shadow: 0 4px 14px rgba(201,151,43,0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(201,151,43,0.5); }
.btn-sm { padding: 10px 18px; font-size: 13px; width: auto; }
.btn-success { background: var(--success); color: #fff; }
.btn-secondary { background: var(--light); color: var(--ink); border: 1px solid var(--border); }
.btn-icon {
    width: 38px; height: 38px; padding: 0; border-radius: 10px;
    background: var(--light); color: var(--muted); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.btn-icon:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-danger-icon:hover { background: var(--danger); border-color: var(--danger); }

.error-message {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: var(--danger); padding: 14px 18px; border-radius: 12px;
    margin-bottom: 24px; font-size: 14px; border: 1px solid #fecaca;
    display: flex; align-items: center; gap: 10px;
}

/* Layout */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--ink) 0%, var(--ink-light) 100%);
    color: #fff; position: fixed; height: 100vh;
    overflow-y: auto; z-index: 100;
    display: flex; flex-direction: column;
}
.sidebar-header { padding: 24px; border-bottom: 1px solid rgba(255,255,255,0.1); flex-shrink: 0; }
.sidebar-header img { height: 45px; background: rgba(255,255,255,0.95); padding: 8px 14px; border-radius: 8px; }

.sidebar-nav { padding: 20px 0; flex: 1; overflow-y: auto; }
.nav-section { padding: 0 16px; margin-bottom: 8px; }
.nav-section-title {
    font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
    color: rgba(255,255,255,0.4); padding: 12px 12px 8px; font-weight: 600;
}
.nav-item {
    display: flex; align-items: center; gap: 14px; padding: 14px 16px;
    color: rgba(255,255,255,0.7); text-decoration: none;
    transition: all 0.2s ease; border-radius: 10px; margin: 2px 0; font-size: 14px;
}
.nav-item:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-item.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: var(--ink); font-weight: 600;
}
.nav-item i { width: 20px; text-align: center; font-size: 16px; }
.nav-badge {
    margin-left: auto; background: var(--danger); color: #fff;
    font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600;
}

.sidebar-footer {
    padding: 20px; border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.2); flex-shrink: 0;
}
.user-info { display: flex; align-items: center; gap: 14px; }
.user-avatar {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border-radius: 12px; display: flex; align-items: center; justify-content: center;
    color: var(--ink); font-weight: 700; font-size: 18px;
}
.user-details { flex: 1; }
.user-name { font-weight: 600; color: #fff; font-size: 14px; }
.user-role { font-size: 12px; color: rgba(255,255,255,0.5); }
.logout-link { color: rgba(255,255,255,0.5); margin-left: auto; }

.main-content { flex: 1; margin-left: 280px; padding: 32px; min-height: 100vh; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; }
.page-title { font-size: 28px; font-weight: 700; color: var(--ink); }
.page-subtitle { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-bottom: 32px; }
.stat-card {
    background: #fff; padding: 28px; border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1); position: relative; overflow: hidden;
    transition: all 0.3s ease;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
}
.stat-card.primary::before { background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.stat-card.success::before { background: linear-gradient(90deg, var(--success), #34d399); }
.stat-card.info::before { background: linear-gradient(90deg, var(--info), #60a5fa); }
.stat-card.warning::before { background: linear-gradient(90deg, var(--warning), #fbbf24); }

.stat-icon {
    width: 52px; height: 52px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; margin-bottom: 16px;
}
.stat-card.primary .stat-icon { background: rgba(201,151,43,0.1); color: var(--accent); }
.stat-card.success .stat-icon { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-card.info .stat-icon { background: rgba(59,130,246,0.1); color: var(--info); }
.stat-card.warning .stat-icon { background: rgba(245,158,11,0.1); color: var(--warning); }

.stat-value { font-size: 36px; font-weight: 700; color: var(--ink); line-height: 1; margin-bottom: 6px; }
.stat-label { font-size: 14px; color: var(--muted); font-weight: 500; }

/* Charts */
.charts-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin-bottom: 32px; }
.chart-card { background: #fff; border-radius: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); overflow: hidden; }
.chart-header {
    padding: 20px 24px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.chart-title { font-size: 16px; font-weight: 600; color: var(--ink); }
.chart-subtitle { font-size: 13px; color: var(--muted); }
.chart-body { padding: 24px; height: 320px; position: relative; }
.chart-body canvas { max-height: 100%; }

/* Tables */
.card { background: #fff; border-radius: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); overflow: hidden; }
.card-header {
    padding: 20px 24px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.card-title { font-size: 16px; font-weight: 600; color: var(--ink); }
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 16px 20px; text-align: left; border-bottom: 1px solid var(--border); }
th {
    background: var(--light); font-weight: 600; color: var(--ink);
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
}
tr:hover { background: #fafafa; }
tr:last-child td { border-bottom: none; }
td small { color: var(--muted); }

.badge {
    display: inline-flex; align-items: center; padding: 6px 12px;
    border-radius: 20px; font-size: 12px; font-weight: 600;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-quoted { background: #dbeafe; color: #1e40af; }
.badge-accepted { background: #d1fae5; color: #065f46; }
.badge-declined { background: #fee2e2; color: #991b1b; }
.badge-import { background: #e0f2fe; color: #0369a1; }
.badge-export { background: #ffedd5; color: #c2410c; }

.actions { display: flex; gap: 8px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.5; display: block; }
.empty-state h4 { font-size: 18px; margin-bottom: 8px; color: var(--ink); }

/* Filters */
.filters {
    display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px;
    padding: 20px; background: #fff; border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.filter-group { display: flex; align-items: center; gap: 10px; }
.filter-group label { font-size: 13px; font-weight: 600; color: var(--muted); }
.filter-group select, .filter-group input {
    padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 14px; font-family: inherit; background: #fff;
}
.filter-group select:focus, .filter-group input:focus { outline: none; border-color: var(--accent); }

/* Modal */
.modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 1000;
    align-items: center; justify-content: center; backdrop-filter: blur(4px);
}
.modal.active { display: flex; }
.modal-content {
    background: #fff; border-radius: 20px; width: 90%; max-width: 900px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}
.modal-header {
    padding: 24px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; background: #fff; z-index: 10;
}
.modal-header h3 { font-size: 20px; font-weight: 600; color: var(--ink); }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 20px 24px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 12px; background: var(--light);
}
.modal-footer select, .modal-footer input {
    padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 14px; font-family: inherit;
}
.close-btn {
    width: 36px; height: 36px; background: var(--light); border: none;
    border-radius: 10px; font-size: 18px; cursor: pointer; color: var(--muted);
    display: flex; align-items: center; justify-content: center;
}
.close-btn:hover { background: var(--danger); color: #fff; }

.quote-details { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.detail-section { background: var(--light); padding: 20px; border-radius: 12px; }
.detail-section h4 {
    color: var(--ink); margin-bottom: 16px; font-size: 13px;
    text-transform: uppercase; letter-spacing: 0.5px;
    display: flex; align-items: center; gap: 8px;
}
.detail-section h4 i { color: var(--accent); }
.detail-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; border-bottom: 1px solid rgba(0,0,0,0.05); }
.detail-row:last-child { border-bottom: none; }
.detail-row span { color: var(--muted); }
.detail-row strong { color: var(--ink); }

/* Settings */
.settings-section {
    background: #fff; border-radius: 16px; padding: 28px;
    margin-bottom: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.settings-section h3 {
    color: var(--ink); margin-bottom: 24px; padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px; font-size: 18px;
}
.settings-section h3 i { color: var(--accent); }
.setting-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 0; border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-info h4 { color: var(--ink); margin-bottom: 4px; font-size: 15px; }
.setting-info p { color: var(--muted); font-size: 13px; }
.setting-input {
    padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px;
    font-size: 14px; font-family: inherit; min-width: 320px;
}
.setting-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,151,43,0.1); }

.toggle { position: relative; width: 56px; height: 30px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--border); border-radius: 30px; transition: 0.3s;
}
.toggle-slider:before {
    position: absolute; content: ""; height: 24px; width: 24px;
    left: 3px; bottom: 3px; background: #fff; border-radius: 50%;
    transition: 0.3s; box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--success); }
.toggle input:checked + .toggle-slider:before { transform: translateX(26px); }

.security-info { padding: 16px; background: var(--light); border-radius: 10px; }
.security-info p { margin: 8px 0; font-size: 14px; color: var(--muted); }
.security-info strong { color: var(--ink); }

/* Editor */
.editor-container { background: #fff; border-radius: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); overflow: hidden; }
.editor-toolbar {
    padding: 16px 20px; background: var(--light); border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.editor-toolbar span { font-weight: 600; color: var(--ink); }
.editor-frame { width: 100%; height: calc(100vh - 200px); border: none; }

/* Toast */
.toast {
    position: fixed; bottom: 24px; right: 24px; padding: 16px 24px;
    background: var(--ink); color: #fff; border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3); z-index: 2000;
    animation: slideIn 0.3s ease; transition: opacity 0.3s;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Mobile Menu Toggle - hidden by default on desktop */
.mobile-menu-toggle {
    display: none;
}

.sidebar-overlay {
    display: none;
}

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 992px) {
    .mobile-menu-toggle { 
        display: flex; 
        align-items: center; 
        justify-content: center;
        position: fixed;
        top: 16px;
        left: 16px;
        z-index: 200;
        width: 48px;
        height: 48px;
        border: none;
        border-radius: 12px;
        background: var(--ink);
        color: #fff;
        font-size: 20px;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    }
    
    .sidebar-overlay { 
        display: block; 
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 95;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    .sidebar-overlay.active { 
        opacity: 1;
        pointer-events: auto; 
    }
    
    .sidebar { 
        transform: translateX(-100%); 
        transition: transform 0.3s ease;
    }
    .sidebar.active { transform: translateX(0); }
    
    .main-content { 
        margin-left: 0; 
        padding: 80px 20px 20px;
    }
    .quote-details { grid-template-columns: 1fr; }
    
    .page-header { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 16px; 
    }
    .page-title { font-size: 24px; }
    
    .modal-content { width: 95%; max-width: none; margin: 10px; }
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr; }
    .filters { flex-direction: column; }
    .filter-group { width: 100%; }
    .filter-group select, .filter-group input { width: 100%; }
    
    .setting-input { min-width: 100%; width: 100%; }
    .setting-row { flex-direction: column; align-items: flex-start; gap: 12px; }
    .settings-section { padding: 16px; }
    .settings-section h3 { font-size: 16px; }
    
    .main-content { padding: 70px 12px 12px; }
    .page-title { font-size: 20px; }
    
    .stat-card { padding: 16px; }
    .stat-value { font-size: 24px; }
    .stat-icon { width: 40px; height: 40px; font-size: 16px; margin-bottom: 12px; }
    
    .card { border-radius: 12px; }
    .card-header { padding: 14px; flex-direction: column; gap: 10px; align-items: flex-start; }
    
    .chart-body { height: 220px; padding: 12px; }
    .chart-header { padding: 14px; }
    
    .login-box { padding: 24px 20px; margin: 12px; }
    .login-title h1 { font-size: 20px; }
    
    .btn { padding: 10px 16px; font-size: 13px; }
    .btn-sm { padding: 8px 12px; font-size: 12px; }
    .actions { flex-wrap: wrap; }
    
    /* Responsive table - card layout on mobile */
    .table-container { overflow-x: visible; }
    table, thead, tbody, th, td, tr { display: block; }
    thead { display: none; }
    
    tr {
        margin-bottom: 16px;
        background: var(--light);
        border-radius: 12px;
        padding: 16px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    }
    
    td {
        padding: 8px 0;
        border-bottom: 1px solid var(--border);
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        font-size: 14px;
    }
    td:last-child { border-bottom: none; }
    
    td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--ink);
        text-align: left;
        flex-shrink: 0;
        margin-right: 12px;
    }
    
    td small { display: block; }
    td .actions { justify-content: flex-end; }
    
    .empty-state { padding: 40px 16px; }
    .empty-state i { font-size: 36px; }
    
    /* Modal responsive */
    .modal-content { 
        width: 100%; 
        max-width: none; 
        margin: 0;
        border-radius: 16px 16px 0 0;
        max-height: 90vh;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
    }
    .modal-header { padding: 16px; }
    .modal-header h3 { font-size: 18px; }
    .modal-body { padding: 16px; }
    .modal-footer { padding: 16px; flex-wrap: wrap; }
    .modal-footer select, .modal-footer input { width: 100%; }
    
    .quote-details { gap: 12px; }
    .detail-section { padding: 14px; }
    .detail-section h4 { font-size: 12px; margin-bottom: 12px; }
    .detail-row { font-size: 13px; padding: 6px 0; }
    
    /* Editor iframe */
    .editor-frame { height: calc(100vh - 160px); }
    .editor-toolbar { padding: 12px; flex-direction: column; gap: 10px; align-items: flex-start; }
}

@media (max-width: 480px) {
    .mobile-menu-toggle { top: 10px; left: 10px; width: 42px; height: 42px; font-size: 18px; }
    .main-content { padding: 60px 10px 10px; }
    
    .page-title { font-size: 18px; }
    .page-subtitle { font-size: 12px; }
    
    .stat-card { padding: 14px; }
    .stat-value { font-size: 22px; }
    .stat-label { font-size: 12px; }
    
    tr { padding: 12px; margin-bottom: 12px; }
    td { padding: 6px 0; font-size: 13px; }
    
    .badge { padding: 4px 8px; font-size: 10px; }
    .btn-icon { width: 32px; height: 32px; font-size: 14px; }
    
    .detail-section { padding: 12px; }
    .detail-row { flex-direction: column; gap: 2px; align-items: flex-start; }
    .detail-row span { font-size: 11px; }
    .detail-row strong { font-size: 13px; }
    
    .toggle { width: 48px; height: 26px; }
    .toggle-slider:before { height: 20px; width: 20px; }
    .toggle input:checked + .toggle-slider:before { transform: translateX(22px); }
    
    .filters { padding: 12px; gap: 10px; }
    .filter-group label { font-size: 12px; }
}
