/* Global Styles */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --dark-color: #212529;
    --light-color: #f8f9fa;
}

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

body {
    font-family: 'DM Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    overflow-x: hidden;
}

/* Login Screen */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--station-paper, #F7F2E8);
    background-image: linear-gradient(rgba(247,242,232,.88), rgba(247,242,232,.88)), url('/manus-storage/fuelstation-paper-texture_2f7e1c54.png');
    position: relative;
}
.login-container::before {
    content: '';
    position: absolute;
    inset: 28px;
    border: 1px solid rgba(23,50,77,.18);
    pointer-events: none;
}
.login-container::after {
    content: 'TRACEABLE RECORDS / BRANCH CONTROL / DAILY MOVEMENT';
    position: absolute;
    left: 44px;
    bottom: 32px;
    font-size: 10px;
    letter-spacing: 2px;
    color: rgba(23,50,77,.55);
}

.login-box {
    background: rgba(255,255,252,.96);
    padding: 42px 44px 38px;
    border-radius: 2px;
    border-top: 6px solid var(--station-orange, #E87932);
    box-shadow: 14px 14px 0 rgba(23,50,77,.09), 0 18px 42px rgba(23,50,77,.12);
    width: 100%;
    max-width: 440px;
    position: relative;
}
.login-box::before {
    content: '';
    position: absolute;
    left: 18px;
    right: 18px;
    top: 156px;
    border-top: 1px dotted rgba(23,50,77,.32);
}
.ledger-brand-block h2 {
    font-family: 'DM Serif Display', Georgia, serif;
    color: var(--station-ink, #17324D);
    letter-spacing: -.4px;
}
.ledger-brand-block p { font-family: 'DM Sans', sans-serif; }
.ledger-kicker {
    margin-top: 4px;
    margin-bottom: 10px;
    color: var(--station-orange, #E87932);
    font: 700 10px/1.2 'DM Sans', sans-serif;
    letter-spacing: 2px;
}
.login-box .form-label {
    font: 700 11px/1.2 'DM Sans', sans-serif;
    letter-spacing: 1.1px;
    text-transform: uppercase;
    color: var(--station-ink, #17324D);
}
.login-box .form-control, .login-box .form-select {
    border-radius: 0;
    border-color: rgba(23,50,77,.28);
    background: #fffefa;
}
.login-box .form-control:focus, .login-box .form-select:focus {
    border-color: var(--station-orange, #E87932);
    box-shadow: 0 0 0 3px rgba(232,121,50,.15);
}
.login-box .btn-primary {
    border-radius: 0;
    background: var(--station-orange, #E87932);
    border-color: var(--station-orange, #E87932);
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 12px;
    font-weight: 700;
}

/* Sidebar */
.sidebar {
    background-color: #2c3e50;
    min-height: calc(100vh - 56px);
    padding: 20px 0;
}

.sidebar .nav-link {
    color: #ecf0f1;
    padding: 12px 20px;
    margin: 5px 10px;
    border-radius: 8px;
    transition: all 0.3s;
}

.sidebar .nav-link:hover {
    background-color: #34495e;
    color: white;
    transform: translateX(5px);
}

.sidebar .nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
}

.nav-section-title {
    color: #95a5a6;
    font-size: 11px;
    font-weight: 600;
    padding: 15px 20px 5px;
    letter-spacing: 1px;
}

/* Main Content */
.main-content {
    padding: 30px;
    background-color: #ecf0f1;
    min-height: calc(100vh - 56px);
}

/* Cards */
.stat-card {
    border-radius: 15px;
    padding: 25px;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    border-left: 4px solid var(--primary-color);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.stat-card .icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-card.primary .icon { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.stat-card.success .icon { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.stat-card.warning .icon { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.stat-card.danger .icon { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.stat-card.info .icon { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin: 10px 0 5px;
}

.stat-label {
    color: #7f8c8d;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Page Header */
.page-header {
    background: white;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.page-header h2 {
    margin: 0;
    color: #2c3e50;
    font-weight: 600;
}

.page-header .breadcrumb {
    margin: 0;
    background: none;
    padding: 0;
}

/* Tables */
.data-table {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.table {
    margin: 0;
}

.table thead th {
    background-color: #f8f9fa;
    color: #2c3e50;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    padding: 15px;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table tbody td {
    vertical-align: middle;
    padding: 15px;
}

/* Forms */
.form-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.form-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #ced4da;
    padding: 10px 15px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Buttons */
.btn {
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

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

/* Badges */
.badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 12px;
}

/* Status Badges */
.badge.status-active { background-color: #d4edda; color: #155724; }
.badge.status-inactive { background-color: #f8d7da; color: #721c24; }
.badge.status-pending { background-color: #fff3cd; color: #856404; }
.badge.status-completed { background-color: #d1ecf1; color: #0c5460; }
.badge.status-balanced { background-color: #d4edda; color: #155724; }

/* Multi-row Add Section */
.multi-row-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.multi-row-section h5 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-weight: 600;
}

.row-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 3px solid var(--primary-color);
}

.row-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Charts */
.chart-container {
    position: relative;
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

/* Loading Overlay */
#loadingOverlay {
    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: 9999;
}

#loadingOverlay .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Toast Notifications */
.toast {
    min-width: 300px;
}

.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-error {
    border-left: 4px solid var(--danger-color);
}

.toast-warning {
    border-left: 4px solid var(--warning-color);
}

/* Filter Section */
.filter-section {
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.filter-section h5 {
    margin-bottom: 15px;
    color: #2c3e50;
}

/* Summary Box */
.summary-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.summary-box h3 {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
}

.summary-box p {
    margin: 5px 0 0;
    opacity: 0.9;
}

/* Compact login layout: keep the complete desktop sign-in flow inside one viewport. */
@media (min-width: 769px) {
    .login-container {
        min-height: 100vh;
        height: 100vh;
        overflow-y: auto;
        padding: 12px 0;
    }
    .login-box {
        max-width: 440px;
        padding: 24px 36px 20px;
        border-top-width: 4px;
    }
    .login-box::before { top: 120px; }
    .login-box #branchLogo {
        height: 82px !important;
        margin-bottom: 10px !important;
    }
    .login-box #branchLogo img { max-height: 82px !important; }
    .login-box .ledger-kicker { margin-bottom: 6px; }
    .login-box .ledger-brand-block h2 { font-size: 1.75rem; }
    .login-box .ledger-brand-block p { margin-bottom: 12px !important; }
    .login-box .mb-3 { margin-bottom: .55rem !important; }
    .login-box .form-control,
    .login-box .form-select {
        min-height: 38px;
        padding: .35rem .65rem;
    }
    .login-box #loginCompanyLogoPreview { min-height: 30px !important; margin-top: .25rem !important; }
    .login-box #loginCompanyLogoPreview img { max-height: 30px !important; }
    .login-box .btn-primary { min-height: 40px; }
}

/* Short desktop browser viewport: fit the login card below Chrome's toolbar. */
@media (min-width: 769px) and (max-height: 720px) {
    .login-container { padding: 4px 0; }
    .login-box {
        padding: 12px 30px 12px;
        border-top-width: 3px;
    }
    .login-box::before { top: 78px; }
    .login-box #branchLogo {
        height: 56px !important;
        margin-bottom: 5px !important;
    }
    .login-box #branchLogo img { max-height: 56px !important; }
    .login-box .ledger-kicker {
        margin-top: 0;
        margin-bottom: 2px;
        font-size: 8px;
        letter-spacing: 1.5px;
    }
    .login-box .ledger-brand-block h2 { font-size: 1.35rem; }
    .login-box .ledger-brand-block p { margin-bottom: 6px !important; font-size: .85rem; }
    .login-box .mb-3 { margin-bottom: .2rem !important; }
    .login-box .form-label { font-size: 9px; margin-bottom: 2px; }
    .login-box .form-control,
    .login-box .form-select {
        min-height: 30px;
        height: 30px;
        padding: .15rem .5rem;
        font-size: .85rem;
    }
    .login-box #loginCompanyLogoPreview { min-height: 20px !important; margin-top: 0 !important; }
    .login-box #loginCompanyLogoPreview img { max-height: 20px !important; }
    .login-box .btn-primary { min-height: 32px; padding: 4px 12px; }
    .login-box #loginError { margin-top: .35rem !important; padding: .35rem .5rem; font-size: .8rem; }
}

/* Responsive */
@media (max-width: 768px) {
    .login-container {
        min-height: 100vh;
        padding: 18px 10px;
        align-items: flex-start;
        overflow-y: auto;
    }
    .login-container::before { inset: 10px; }
    .login-container::after { display: none; }
    .login-box {
        margin: 8px 0;
        padding: 28px 22px 24px;
    }
    .login-box #branchLogo { height: 90px !important; }
    .login-box #branchLogo img { max-height: 90px !important; }
    .sidebar {
        min-height: auto;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .stat-card {
        margin-bottom: 15px;
    }
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.shadow-sm { box-shadow: 0 2px 5px rgba(0,0,0,0.08); }
.shadow-md { box-shadow: 0 5px 15px rgba(0,0,0,0.12); }
.shadow-lg { box-shadow: 0 10px 30px rgba(0,0,0,0.15); }

.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.p-20 { padding: 20px; }

/* Auto-save Indicator */
.auto-save-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 10px 20px;
    border-radius: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: none;
    align-items: center;
    gap: 10px;
}

.auto-save-indicator.saving {
    display: flex;
}

.auto-save-indicator .spinner-border {
    width: 16px;
    height: 16px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h4 {
    margin-bottom: 10px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 10px;
}

.action-buttons .btn {
    padding: 5px 10px;
    font-size: 14px;
}

/* Permission Matrix */
.permission-matrix {
    background: white;
    border-radius: 10px;
    overflow: hidden;
}

.permission-group {
    border-bottom: 1px solid #dee2e6;
}

.permission-group-header {
    background: #f8f9fa;
    padding: 15px;
    font-weight: 600;
    color: #2c3e50;
}

.permission-item {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f8f9fa;
}

.permission-item:hover {
    background: #f8f9fa;
}

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

/* Stock Status */
.stock-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.stock-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.stock-indicator.high { background-color: #28a745; }
.stock-indicator.medium { background-color: #ffc107; }
.stock-indicator.low { background-color: #dc3545; }

/* Print Styles */
@media print {
    .sidebar, .navbar, .filter-section, .action-buttons {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .page-header {
        page-break-after: avoid;
    }
}

/* Station Ledger permanent-site design: warm paper texture, ink navy hierarchy, and restrained Pump Orange actions. */
:root {
    --station-ink: #17324D;
    --station-paper: #F7F2E8;
    --station-orange: #E87932;
}
body {
    background-color: var(--station-paper);
    background-image: url('/manus-storage/fuelstation-paper-texture_2f7e1c54.png');
    color: var(--station-ink);
}
.navbar.bg-primary {
    background: var(--station-ink) !important;
    border-bottom: 3px solid var(--station-orange);
}
.sidebar {
    background-color: rgba(247, 242, 232, 0.96);
    border-right: 1px solid rgba(23, 50, 77, 0.14);
}
.sidebar .nav-link { color: var(--station-ink); }
.sidebar .nav-link.active {
    background-color: var(--station-ink) !important;
    border-left: 4px solid var(--station-orange);
}
.btn-primary {
    background-color: var(--station-ink);
    border-color: var(--station-ink);
}
.btn-success {
    background-color: var(--station-orange);
    border-color: var(--station-orange);
}
.page-header, .form-card, .data-table, .card {
    border-radius: 6px;
    box-shadow: 0 8px 22px rgba(23, 50, 77, 0.07);
}
button, .nav-link, .card, .form-control, .form-select {
    transition: transform 160ms ease-out, box-shadow 160ms ease-out, background-color 160ms ease-out;
}
button:active { transform: scale(0.97); }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
