/* =============================================
   SPBBE Management System - Shared Styles
   ============================================= */

:root {
    --bg-cream: #FDFCF9;
    --bg-warm: #F7F5F0;
    --card-white: #FFFFFF;
    --primary: #1E3A5F;
    --primary-light: #2D5A8B;
    --accent: #E67E22;
    --accent-light: #F39C4D;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --text-dark: #1F2937;
    --text-muted: #6B7280;
    --text-light: #9CA3AF;
    --border: #E5E2D9;
    --shadow: 0 4px 20px rgba(30, 58, 95, 0.08);
    --shadow-hover: 0 8px 30px rgba(30, 58, 95, 0.12);
}

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

body {
    font-family: 'Nunito Sans', sans-serif;
    background: var(--bg-cream);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
}

/* =============================================
   Sidebar
   ============================================= */
.sidebar {
    width: 280px;
    background: var(--primary);
    min-height: 100vh;
    padding: 24px 0;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.logo {
    padding: 0 24px 32px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 24px;
}

.logo a {
    text-decoration: none;
}

.logo h1 {
    font-family: 'DM Serif Display', serif;
    font-size: 28px;
    color: #fff;
    letter-spacing: 1px;
}

.logo span {
    font-family: 'Nunito Sans', sans-serif;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    text-transform: uppercase;
    letter-spacing: 2px;
    display: block;
    margin-top: 4px;
}

.nav-section {
    padding: 0 16px;
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.4);
    padding: 0 12px;
    margin-bottom: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.nav-item.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 15px rgba(230, 126, 34, 0.3);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* =============================================
   Main Content
   ============================================= */
.main {
    margin-left: 280px;
    flex: 1;
    min-height: 100vh;
}

.header {
    background: var(--card-white);
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 24px;
    color: var(--primary);
}

.header-left p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-warm);
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.search-box input {
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    width: 200px;
    color: var(--text-dark);
}

.search-box svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.notification-btn {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card-white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.notification-btn:hover {
    border-color: var(--primary);
}

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

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px 8px 8px;
    background: var(--bg-warm);
    border-radius: 12px;
    cursor: pointer;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}

.user-info {
    text-align: left;
}

.user-info .name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.user-info .role {
    font-size: 11px;
    color: var(--text-muted);
}

/* Content Area */
.content {
    padding: 32px;
}

/* =============================================
   Stats Grid
   ============================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card-white);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

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

.stat-card .icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.stat-card .icon.blue { background: rgba(30, 58, 95, 0.1); color: var(--primary); }
.stat-card .icon.orange { background: rgba(230, 126, 34, 0.1); color: var(--accent); }
.stat-card .icon.green { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-card .icon.red { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

.stat-card .label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .value {
    font-family: 'DM Serif Display', serif;
    font-size: 32px;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.stat-card .change {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

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

/* =============================================
   Cards
   ============================================= */
.card {
    background: var(--card-white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    overflow: hidden;
}

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

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

.card-body {
    padding: 24px;
}

/* =============================================
   Tank Visualization
   ============================================= */
.tanks-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.tank-container {
    text-align: center;
}

.tank {
    width: 120px;
    height: 180px;
    background: var(--bg-warm);
    border: 3px solid var(--border);
    border-radius: 20px 20px 60px 60px;
    margin: 0 auto 16px;
    position: relative;
    overflow: hidden;
}

.tank-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, #3B82F6 0%, #1E3A5F 100%);
    border-radius: 0 0 57px 57px;
    transition: height 1s ease;
}

.tank-fill.warning {
    background: linear-gradient(180deg, #FBBF24 0%, #D97706 100%);
}

.tank-fill.danger {
    background: linear-gradient(180deg, #F87171 0%, #DC2626 100%);
}

.tank-level {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 2;
}

.tank-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.tank-capacity {
    font-size: 13px;
    color: var(--text-muted);
}

/* =============================================
   Tables
   ============================================= */
.table-container {
    overflow-x: auto;
}

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

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg-warm);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    font-size: 14px;
    color: var(--text-dark);
}

tr:hover td {
    background: var(--bg-cream);
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status.success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.status.warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.status.danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.status.info { background: rgba(30, 58, 95, 0.1); color: var(--primary); }

.status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

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

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-light);
    box-shadow: 0 4px 15px rgba(30, 58, 95, 0.3);
}

.btn-accent {
    background: var(--accent);
    color: #fff;
}

.btn-accent:hover {
    background: var(--accent-light);
    box-shadow: 0 4px 15px rgba(230, 126, 34, 0.3);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-dark);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}

/* =============================================
   Grid Layouts
   ============================================= */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* =============================================
   Charts
   ============================================= */
.chart-placeholder {
    height: 250px;
    background: linear-gradient(135deg, var(--bg-warm) 0%, var(--bg-cream) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.chart-placeholder::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 40px,
            var(--border) 40px,
            var(--border) 41px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 40px,
            var(--border) 40px,
            var(--border) 41px
        );
    opacity: 0.5;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    height: 180px;
    z-index: 1;
}

.chart-bar {
    width: 40px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 8px 8px 0 0;
    animation: growBar 1s ease forwards;
    transform-origin: bottom;
}

@keyframes growBar {
    from { transform: scaleY(0); }
    to { transform: scaleY(1); }
}

/* =============================================
   Alerts
   ============================================= */
.alert {
    padding: 16px 20px;
    border-radius: 12px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}

.alert.warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.alert.danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.alert-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.alert.warning .alert-icon { color: var(--warning); }
.alert.danger .alert-icon { color: var(--danger); }
.alert.success .alert-icon { color: var(--success); }

.alert-content h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}

.alert-content p {
    font-size: 13px;
    color: var(--text-muted);
}

/* =============================================
   Forms
   ============================================= */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    background: var(--card-white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(30, 58, 95, 0.1);
}

select.form-control {
    cursor: pointer;
}

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

/* =============================================
   Progress Bar
   ============================================= */
.progress {
    height: 8px;
    background: var(--bg-warm);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-bar.blue { background: var(--primary); }
.progress-bar.green { background: var(--success); }
.progress-bar.orange { background: var(--accent); }
.progress-bar.red { background: var(--danger); }

/* =============================================
   Tabs
   ============================================= */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}

.tab {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

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

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* =============================================
   Financial Summary
   ============================================= */
.financial-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.financial-item {
    display: flex;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.financial-item:last-child {
    border-bottom: none;
    padding-top: 20px;
    margin-top: 10px;
    border-top: 2px solid var(--primary);
}

.financial-item .label {
    color: var(--text-muted);
    font-size: 14px;
}

.financial-item .value {
    font-weight: 700;
    font-size: 16px;
}

.financial-item .value.positive { color: var(--success); }
.financial-item .value.negative { color: var(--danger); }

/* =============================================
   Timeline
   ============================================= */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--card-white);
    box-shadow: 0 0 0 4px var(--bg-cream);
}

.timeline-item.success::before { background: var(--success); }
.timeline-item.warning::before { background: var(--warning); }
.timeline-item.danger::before { background: var(--danger); }

.timeline-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.timeline-content {
    font-size: 14px;
    color: var(--text-dark);
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

    .tanks-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .tanks-grid {
        grid-template-columns: 1fr;
    }

    .header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .header-right {
        width: 100%;
        flex-wrap: wrap;
    }

    .search-box {
        flex: 1;
    }

    .search-box input {
        width: 100%;
    }
}
