/* ============================================================
   HPPCL Sainj HEP — Government E-Flow Monitoring System
   Main Stylesheet
   ============================================================ */

:root {
    --gov-blue: #1a3a6b;
    --gov-blue-light: #2856a3;
    --gov-blue-dark: #102040;
    --gov-orange: #e8640a;
    --gov-green: #1a7a3c;
    --gov-red: #c0392b;
    --gov-gold: #c9980a;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-500: #64748b;
    --gray-700: #334155;
    --gray-900: #0f172a;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.25s ease;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', 'Noto Sans', sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-900);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* ===== GOVERNMENT TOP BAR ===== */
.gov-topbar {
    background: var(--gov-blue-dark);
    color: #cdd8e8;
    font-size: 12px;
    padding: 5px 0;
    border-bottom: 2px solid var(--gov-gold);
}

.topbar-text { font-size: 12px; }
.topbar-divider { color: #4a6a9a; }
.topbar-badge {
    background: rgba(255,255,255,0.1);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
}

/* ===== MAIN HEADER ===== */
.main-header {
    background: linear-gradient(135deg, var(--white) 0%, #f0f4ff 100%);
    border-bottom: 3px solid var(--gov-blue);
    box-shadow: var(--shadow-md);
}

.header-logo-box {
    flex-shrink: 0;
}

.logo-circle {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: var(--shadow-md);
}

.gov-logo {
    background: linear-gradient(135deg, var(--gov-blue), var(--gov-blue-light));
    color: var(--white);
    border: 3px solid var(--gov-gold);
}

.hp-logo {
    background: linear-gradient(135deg, var(--gov-green), #2ecc71);
    color: var(--white);
    border: 3px solid var(--gov-gold);
}

.header-org {
    font-size: 13px;
    color: var(--gov-blue);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--gov-blue-dark);
    line-height: 1.2;
}

.header-subtitle {
    font-size: 13px;
    color: var(--gov-blue-light);
    font-weight: 500;
    margin-top: 2px;
}

/* ===== NAVIGATION ===== */
.main-navbar {
    background: linear-gradient(90deg, var(--gov-blue) 0%, var(--gov-blue-light) 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.main-navbar .nav-link {
    color: rgba(255,255,255,0.85) !important;
    padding: 14px 18px !important;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}

.main-navbar .nav-link:hover,
.main-navbar .nav-link.active {
    color: var(--white) !important;
    background: rgba(255,255,255,0.15);
    border-bottom-color: var(--gov-gold);
}

.main-navbar .dropdown-menu {
    background: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    border-top: 3px solid var(--gov-blue);
    min-width: 200px;
}

.main-navbar .dropdown-item {
    color: var(--gray-700);
    padding: 8px 16px;
    font-size: 13px;
    transition: var(--transition);
}

.main-navbar .dropdown-item:hover {
    background: var(--gray-100);
    color: var(--gov-blue);
}

.navbar-toggler {
    border-color: rgba(255,255,255,0.5) !important;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

.auto-refresh-badge {
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.9);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    padding: 24px 0;
    min-height: calc(100vh - 300px);
}

/* ===== PAGE HEADER ===== */
.page-header {
    background: linear-gradient(135deg, var(--gov-blue) 0%, var(--gov-blue-light) 100%);
    color: var(--white);
    padding: 24px 32px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.page-header::after {
    content: '';
    position: absolute;
    right: -50px;
    top: -50px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
}

.page-header::before {
    content: '';
    position: absolute;
    right: 50px;
    bottom: -80px;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 4px 0;
}

.page-header .subtitle {
    font-size: 13px;
    opacity: 0.85;
}

.page-badge {
    background: rgba(255,255,255,0.2);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.3);
}

/* ===== STATS CARDS ===== */
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

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

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.stat-card.blue::before { background: var(--gov-blue); }
.stat-card.green::before { background: var(--gov-green); }
.stat-card.red::before { background: var(--gov-red); }
.stat-card.orange::before { background: var(--gov-orange); }
.stat-card.gold::before { background: var(--gov-gold); }

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-icon.blue { background: #e8f0fe; color: var(--gov-blue); }
.stat-icon.green { background: #e8f5e8; color: var(--gov-green); }
.stat-icon.red { background: #fde8e8; color: var(--gov-red); }
.stat-icon.orange { background: #fef3e8; color: var(--gov-orange); }
.stat-icon.gold { background: #fdf8e8; color: var(--gov-gold); }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
    margin: 8px 0 4px 0;
}

.stat-label {
    font-size: 12px;
    color: var(--gray-500);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-sub {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}

/* ===== CURRENT READING CARD ===== */
.current-reading-card {
    background: linear-gradient(135deg, var(--gov-blue) 0%, var(--gov-blue-light) 100%);
    color: var(--white);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.current-reading-card::after {
    content: '';
    position: absolute;
    right: -30px;
    top: -30px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
}

.reading-value {
    font-size: 52px;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.reading-unit {
    font-size: 16px;
    opacity: 0.8;
    font-weight: 400;
}

.reading-label {
    font-size: 13px;
    opacity: 0.8;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.reading-threshold {
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 10px 16px;
    margin-top: 16px;
    border: 1px solid rgba(255,255,255,0.2);
}

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

.status-compliant {
    background: #22c55e;
    color: white;
}

.status-violation {
    background: var(--gov-red);
    color: white;
}

/* ===== CARDS & PANELS ===== */
.data-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

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

.data-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--gov-blue-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.data-card-body {
    padding: 20px 24px;
}

/* ===== TABLE STYLES ===== */
.gov-table {
    width: 100%;
    font-size: 13px;
}

.gov-table thead th {
    background: var(--gov-blue);
    color: var(--white);
    font-weight: 600;
    padding: 12px 14px;
    border: none;
    white-space: nowrap;
    font-size: 12px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.gov-table tbody tr {
    border-bottom: 1px solid var(--gray-100);
    transition: var(--transition);
}

.gov-table tbody tr:hover {
    background: #f0f4ff;
}

.gov-table tbody td {
    padding: 11px 14px;
    vertical-align: middle;
    color: var(--gray-700);
}

.gov-table tbody tr:nth-child(even) {
    background: var(--gray-50);
}

.gov-table tbody tr:nth-child(even):hover {
    background: #f0f4ff;
}

/* Status pills in table */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.pill-success { background: #dcfce7; color: #15803d; }
.pill-danger { background: #fee2e2; color: #dc2626; }
.pill-warning { background: #fef9c3; color: #a16207; }

/* ===== CHART AREA ===== */
.chart-wrapper {
    position: relative;
    height: 280px;
}

/* ===== PROGRESS / COMPLIANCE BAR ===== */
.compliance-bar {
    height: 10px;
    border-radius: 5px;
    background: var(--gray-200);
    overflow: hidden;
}

.compliance-bar-fill {
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, var(--gov-green), #22c55e);
    transition: width 1s ease;
}

/* ===== ALERT / NOTIFICATION CARD ===== */
.alert-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    gap: 12px;
}

.alert-item.alert-info {
    background: #eff6ff;
    border-left: 4px solid var(--gov-blue);
}

.alert-item.alert-success {
    background: #f0fdf4;
    border-left: 4px solid var(--gov-green);
}

.alert-item.alert-danger {
    background: #fef2f2;
    border-left: 4px solid var(--gov-red);
}

.alert-item.alert-warning {
    background: #fefce8;
    border-left: 4px solid var(--gov-gold);
}

.alert-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.alert-text-main {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-800);
}

.alert-text-sub {
    font-size: 12px;
    color: var(--gray-500);
}

/* ===== FOOTER ===== */
.main-footer {
    background: var(--gov-blue-dark);
    color: rgba(255,255,255,0.75);
    margin-top: 40px;
}

.footer-brand {
    font-size: 15px;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 4px;
}

.footer-env-icons {
    color: var(--gov-gold);
    font-size: 16px;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}

/* ===== MONTHLY VIEW CALENDAR NAV ===== */
.month-nav-btn {
    background: var(--white);
    border: 2px solid var(--gov-blue);
    color: var(--gov-blue);
    border-radius: var(--radius-sm);
    padding: 8px 20px;
    font-weight: 600;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.month-nav-btn:hover {
    background: var(--gov-blue);
    color: var(--white);
}

/* ===== ANNUAL REPORT ===== */
.month-card {
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 16px;
    border: 1px solid var(--gray-200);
    text-align: center;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    display: block;
}

.month-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--gov-blue);
    color: var(--gov-blue-dark);
}

.month-card-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--gov-blue-dark);
}

.month-card-count {
    font-size: 22px;
    font-weight: 700;
    color: var(--gov-blue);
    line-height: 1.2;
    margin: 6px 0;
}

/* ===== LIVE INDICATOR ===== */
.live-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    display: inline-block;
    animation: pulse-live 1.5s infinite;
}

@keyframes pulse-live {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ===== BREADCRUMB ===== */
.gov-breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 13px;
}

.gov-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    content: '›';
    color: rgba(255,255,255,0.6);
}

.gov-breadcrumb .breadcrumb-item a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
}

.gov-breadcrumb .breadcrumb-item.active {
    color: var(--white);
}

/* ===== BUTTONS ===== */
.btn-gov {
    background: var(--gov-blue);
    color: var(--white);
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

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

.btn-gov-outline {
    background: transparent;
    color: var(--gov-blue);
    border: 2px solid var(--gov-blue);
    padding: 7px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-gov-outline:hover {
    background: var(--gov-blue);
    color: var(--white);
}

.btn-export {
    background: var(--gov-green);
    color: var(--white);
    border: none;
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-export:hover {
    background: #155d30;
    color: var(--white);
}

/* ===== DATATABLES OVERRIDE ===== */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 13px;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 5px 8px;
    font-size: 13px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--gov-blue) !important;
    color: var(--white) !important;
    border-radius: var(--radius-sm);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header-title { font-size: 16px; }
    .header-org { font-size: 11px; }
    .reading-value { font-size: 36px; }
    .stat-value { font-size: 22px; }
    .page-header h1 { font-size: 18px; }
    .logo-circle { width: 52px; height: 52px; font-size: 20px; }
    .data-card-body { padding: 14px; }
}

/* ===== PRINT ===== */
@media print {
    .main-navbar, .gov-topbar, .main-footer, .btn-export, .dt-buttons { display: none !important; }
    .main-content { padding: 0; }
    .page-header { background: var(--gov-blue) !important; -webkit-print-color-adjust: exact; }
}
