/* ==========================================================================
   1. SYSTEM VARIABLES & CORE PROPERTIES RESET
   ========================================================================== */
:root {
    --primary-color: #dc3545;
    --primary-hover: #bd2130;
    --brand-primary: #dc2626;
    --brand-hover: #ef4444;
    --brand-dark: #0f172a;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    --gray-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --transition: all 0.3s ease;
    --transition-fast: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --nav-bg: #ffffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 16px;
    color: var(--dark-color);
    background-color: #f4f6f9;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==========================================================================
   2. MOBILE-FIRST UTILITY GRID (FLUID SYSTEM)
   ========================================================================== */
.container {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

/* Mobile Layout Default Base: Stacked vertical */
.col {
    flex-basis: 0;
    flex-grow: 1;
    max-width: 100%;
    padding: 15px;
}

.col-12 { flex: 0 0 100%; max-width: 100%; padding: 15px; }
.col-6  { flex: 0 0 50%; max-width: 50%; padding: 15px; }

/* ==========================================================================
   3. MODERN NAVBAR & TIRANGA HAMBURGER TRIGGER
   ========================================================================== */
.navbar {
    background-color: var(--nav-bg);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 99999;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    max-width: 1340px;
    margin: 0 auto;
    position: relative;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--brand-dark);
    text-decoration: none;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.logo i {
    color: var(--brand-primary);
    font-size: 1.5rem;
}

.logo span {
    color: var(--brand-primary);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-menu a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 11px;
    color: #475569;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 6px;
    transition: var(--transition-fast);
    border-bottom: 2px solid transparent;
}

/* Dynamic Active Route Highlighters */
.nav-menu a.active:not(.login-nav-btn),
.nav-menu a:hover:not(.login-nav-btn) {
    background-color: #f8fafc;
    color: var(--brand-primary);
}

.nav-menu a.active:not(.login-nav-btn) {
    border-bottom-color: var(--brand-primary);
    border-radius: 6px 6px 0 0;
    background-color: #f1f5f9;
}

/* Special Pill Buttons */
.nav-menu a.emergency-pill {
    color: #dc2626 !important;
    background-color: #fef2f2 !important;
}

.nav-menu a.emergency-pill.active,
.nav-menu a.emergency-pill:hover {
    background-color: #fee2e2 !important;
    box-shadow: inset 0 0 0 1px rgba(220,38,38,0.1);
}

.nav-menu a.login-nav-btn {
    background: #dc2626; 
    color: #ffffff !important; 
    font-weight: 700; 
    margin-left: 5px;
    border-radius: 6px;
}

/* Custom CSS Tiranga Hamburger Button */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    width: 44px;
    height: 40px;
    position: relative;
    z-index: 100000;
    outline: none;
}

.hamburger-box {
    width: 28px;
    height: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.hamburger-box span {
    display: block;
    width: 100%;
    height: 3px;
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
    transform-origin: center;
}

/* Tiranga Configuration Setup */
.hamburger-box span:nth-child(1) { background-color: #FF9933; } /* Saffron */
.hamburger-box span:nth-child(2) { background-color: #FFFFFF; border: 0.5px solid #cbd5e1; } /* White Wrapper */
.hamburger-box span:nth-child(3) { background-color: #138808; } /* India Green */

/* Hamburger Transformation Open States */
.menu-toggle.open-active .hamburger-box span:nth-child(1) {
    transform: translateY(9.5px) rotate(45deg);
    background-color: var(--brand-primary);
}

.menu-toggle.open-active .hamburger-box span:nth-child(2) {
    opacity: 0;
    transform: translateX(-20px);
}

.menu-toggle.open-active .hamburger-box span:nth-child(3) {
    transform: translateY(-9.5px) rotate(-45deg);
    background-color: var(--brand-primary);
}

/* ==========================================================================
   4. RESPONSIVE FORMS & CONTROLS LAYOUT
   ========================================================================== */
.form-group {
    margin-bottom: 1.2rem;
    display: flex;
    flex-direction: column;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--brand-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    text-align: center;
    padding: 12px 24px;
    font-size: 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
    width: 100%; /* Mobile structural full click rules */
}

.btn-primary { background-color: var(--brand-primary); color: #fff; }
.btn-primary:hover { background-color: var(--brand-hover); }

/* ==========================================================================
   5. ANTI-BREAK RESPONSIVE DATA TABLES
   ========================================================================== */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.app-table, .table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

.app-table th, .table th {
    background: #f1f5f9;
    padding: 14px;
    color: var(--brand-dark);
    font-weight: 700;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.app-table td, .table td {
    padding: 14px;
    border-bottom: 1px solid #e2e8f0;
    color: #475569;
    vertical-align: middle;
    white-space: nowrap;
}

/* ==========================================================================
   6. CARDS UTILITIES (SPA Dashboard Dynamic Views)
   ========================================================================== */
.data-card {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin-top: 20px;
}

/* ==========================================================================
   7. BREAKPOINTS SCROLL ADJUSTMENTS (Tablets & Desktops)
   ========================================================================== */

/* Tablets & Laptops Breakpoint View (Up to 1140px) */
@media (max-width: 1140px) {
    .menu-toggle {
        display: block;
    }

    .nav-menu {
        position: absolute;
        top: 100%; left: 0; right: 0;
        background-color: var(--nav-bg);
        flex-direction: column;
        align-items: stretch;
        padding: 15px 20px 20px;
        gap: 5px;
        border-top: 1px solid #f1f5f9;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
        opacity: 0;
        transform: translateY(-8px);
        pointer-events: none;
        transition: var(--transition-fast);
    }

    .nav-menu.mobile-open {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    .nav-menu a {
        padding: 12px 14px;
        width: 100%;
        border-radius: 6px !important;
        border-bottom: none !important;
        border-left: 3px solid transparent;
    }

    .nav-menu a.active:not(.login-nav-btn) {
        border-left-color: var(--brand-primary);
        background-color: #f1f5f9;
    }

    .nav-menu a.login-nav-btn {
        text-align: center;
        justify-content: center;
        margin-top: 8px;
        padding: 12px;
    }
}

/* Desktop Scale Restoring Rules (768px and up) */
@media (min-width: 768px) {
    .container { max-width: 720px; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
    .col-md-3 { flex: 0 0 25%; max-width: 25%; }
    
    .btn { width: auto; }
    .form-row { display: flex; gap: 15px; }

    /* Admin Sidebar Layout structures integration */
    .admin-wrapper { display: flex; }
    .sidebar { width: 250px; }
    .main-content { flex: 1; }
}

/* Wide Desktop Screens Breakpoint Configuration Layer (1200px and up) */
@media (min-width: 1200px) {
    .container { max-width: 1140px; }
    .col-lg-3 { flex: 0 0 25%; max-width: 25%; }
    .col-lg-4 { flex: 0 0 33.333%; max-width: 33.333%; }
}