/* ============================================
   FuelPro - Fuel Management System Styles
   ============================================ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #0f172a;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0891b2;
    --info-light: #cffafe;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --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);
}

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
}

/* ---- LOGIN PAGE ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #0f172a 100%);
    padding: 20px;
}

.login-container {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-brand {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 72px;
    height: 72px;
    background: var(--primary);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.login-logo i {
    font-size: 32px;
    color: white;
}

.login-brand h1 {
    font-size: 28px;
    color: var(--gray-900);
    font-weight: 700;
}

.login-brand p {
    color: var(--gray-500);
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.login-form label i {
    width: 16px;
    margin-right: 4px;
    color: var(--gray-400);
}

.login-hint {
    text-align: center;
    margin-top: 16px;
    color: var(--gray-400);
}

/* ---- FORM ELEMENTS ---- */
input, select, textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--gray-800);
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn i { font-size: 13px; }

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

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }

.btn-info { background: var(--info); color: white; }
.btn-info:hover { background: #0e7490; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
}
.btn-outline:hover { background: var(--gray-100); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- SIDEBAR ---- */
.main-app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--secondary);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.3s;
}

.sidebar-brand {
    padding: 20px 24px;
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand i {
    color: var(--primary);
    font-size: 24px;
}

.sidebar-nav {
    padding: 12px 0;
}

.nav-section {
    padding: 16px 24px 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-500);
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: var(--gray-400);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    color: white;
    background: rgba(255,255,255,0.05);
}

.nav-item.active {
    color: white;
    background: rgba(37, 99, 235, 0.15);
    border-left-color: var(--primary);
}

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

/* ---- TOPBAR ---- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--gray-600);
    cursor: pointer;
    display: none;
}

.topbar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-800);
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.notification-bell {
    position: relative;
    cursor: pointer;
    font-size: 18px;
    color: var(--gray-500);
}

.notification-bell .badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-info span:first-child {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
}

.user-role {
    font-size: 11px;
    color: var(--gray-500);
}

/* ---- PAGE CONTENT ---- */
.page-content {
    padding: 24px;
}

/* ---- CARDS ---- */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-800);
}

.card-body { padding: 20px; }

/* ---- STAT CARDS ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s;
}

.stat-card:hover { transform: translateY(-2px); }

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.cyan { background: var(--info-light); color: var(--info); }

.stat-info h4 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-info p {
    font-size: 13px;
    color: var(--gray-500);
}

.stat-info .stat-change {
    font-size: 12px;
    font-weight: 600;
    margin-top: 2px;
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ---- GRID LAYOUTS ---- */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

/* ---- TABLE ---- */
.table-responsive { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

table th, table td {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    border-bottom: 1px solid var(--gray-200);
}

table th {
    background: var(--gray-50);
    font-weight: 700;
    color: var(--gray-600);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

table tr:hover { background: var(--gray-50); }

table td { color: var(--gray-700); }

/* ---- STATUS BADGES ---- */
.status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-active, .status-approved, .status-completed { background: var(--success-light); color: var(--success); }
.status-pending { background: var(--warning-light); color: #b45309; }
.status-rejected, .status-inactive { background: var(--danger-light); color: var(--danger); }
.status-processing, .status-in-progress { background: var(--info-light); color: var(--info); }

/* ---- CHART CONTAINER ---- */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* ---- MODAL ---- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

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

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-400);
    line-height: 1;
}

.modal-close:hover { color: var(--gray-800); }

.modal-body { padding: 24px; }

.modal-body .form-group {
    margin-bottom: 16px;
}

.modal-body .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

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

/* ---- TOAST ---- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius);
    color: white;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--primary); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ---- FILTERS BAR ---- */
.filters-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.filters-bar input,
.filters-bar select {
    width: auto;
    min-width: 160px;
}

.filters-bar .search-input {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.filters-bar .search-input input {
    padding-left: 36px;
    width: 100%;
}

.filters-bar .search-input i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

/* ---- GAUGE ---- */
.gauge-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gauge-bar {
    flex: 1;
    height: 10px;
    background: var(--gray-200);
    border-radius: 5px;
    overflow: hidden;
}

.gauge-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s;
}

.gauge-fill.high { background: var(--success); }
.gauge-fill.medium { background: var(--warning); }
.gauge-fill.low { background: var(--danger); }

.gauge-label {
    font-size: 13px;
    font-weight: 600;
    min-width: 40px;
    text-align: right;
}

/* ---- ACTIVITY FEED ---- */
.activity-feed { list-style: none; }

.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
}

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

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.activity-text {
    font-size: 13px;
    color: var(--gray-700);
}

.activity-text strong { color: var(--gray-900); }

.activity-time {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 2px;
}

/* ---- DETAIL VIEW ---- */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.detail-item label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--gray-500);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.detail-item p {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
    margin-top: 2px;
}

/* ---- PDF EXPORT PAGE ---- */
.pdf-preview {
    background: white;
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 900px;
    margin: 0 auto;
}

.pdf-preview .pdf-header {
    text-align: center;
    border-bottom: 3px solid var(--primary);
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.pdf-preview .pdf-header h1 {
    font-size: 28px;
    color: var(--primary);
}

.pdf-preview .pdf-header p {
    color: var(--gray-500);
}

.pdf-section {
    margin-bottom: 30px;
}

.pdf-section h2 {
    font-size: 18px;
    color: var(--gray-800);
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.pdf-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.pdf-kpi {
    text-align: center;
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.pdf-kpi .value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.pdf-kpi .label {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-400);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 16px;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .pdf-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: block; }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .modal-body .form-row { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .pdf-kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ---- PRINT / PDF STYLES ---- */
@media print {
    .sidebar, .topbar, .btn, .filters-bar { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ---- MISC ---- */
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.font-bold { font-weight: 700; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--gray-500); }

/* ---- PULSE ANIMATION (for tracking) ---- */
@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220,38,38,0.4); }
    50% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(220,38,38,0); }
}

/* ---- ADDITIONAL STATUS BADGES ---- */
.status-draft { background: var(--gray-200); color: var(--gray-600); }
.status-loading { background: #e0f2fe; color: var(--info); }
.status-scheduled { background: var(--primary-light); color: var(--primary); }
.status-delivered { background: var(--success-light); color: var(--success); }
.status-in-transit { background: #e0f2fe; color: var(--info); }
.status-paid { background: var(--success-light); color: var(--success); }
.status-unpaid { background: var(--danger-light); color: var(--danger); }
.status-partial { background: var(--warning-light); color: #b45309; }
.status-confirmed { background: var(--success-light); color: var(--success); }
