/* ==========================================================================
   1. CORE FABRIC & DESIGN THEME VARIABLES
   ========================================================================== */
:root {
    --sidebar: #0f172a;
    --sidebar-hover: #1e293b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --header: rgba(255, 255, 255, 0.96);
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #64748b;
    --radius: 14px;
    --border: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ==========================================================================
   2. AUTHENTICATION ROOT CARD LAYOUT
   ========================================================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-wrapper {
    width: 100%;
    max-width: 440px;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 35px;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.login-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.login-logo {
    height: 60px;
    max-width: 45%;
    object-fit: contain;
}

.system-title {
    text-align: center;
    margin-bottom: 24px;
}

.system-title h1 {
    font-size: 24px;
    font-weight: 800;
    color: #1e3a8a;
}

.system-title p {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.input-group label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted);
}

.input-group input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

.btn-primary {
    width: 100%;
    height: 44px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}

#loginError {
    margin-top: 12px;
    color: var(--danger);
    font-size: 13px;
    text-align: center;
    font-weight: 600;
}

/* ==========================================================================
   3. APP SHELL FRAMEWORK & PERSISTENT APP DRAWER NAVIGATION
   ========================================================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: var(--header);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 1000;
}

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

.header-title {
    font-weight: 800;
    font-size: 20px;
    color: #1e3a8a;
}

#menuBtn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

.header-search-location-bar {
    flex: 1;
    max-width: 550px;
    margin: 0 24px;
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px 6px;
}

.location-scope-icon { padding: 0 8px; color: var(--muted); }

.header-location-selector {
    border: none;
    background: transparent;
    height: 34px;
    font-size: 13px;
    font-weight: 700;
    color: #1e3a8a;
    outline: none;
    cursor: pointer;
    border-right: 1px solid var(--border);
    padding-right: 8px;
}

.header-global-input-search {
    flex: 1;
    border: none;
    background: transparent;
    height: 34px;
    padding: 0 12px;
    font-size: 13px;
    outline: none;
}

.user-box { display: flex; align-items: center; gap: 12px; }

#userRole {
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

#logoutBtn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    color: var(--danger);
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
}

#logoutBtn:hover { background: var(--danger); color: #fff; }

.sidebar {
    position: fixed;
    top: 80px;
    left: 0;
    width: 260px;
    height: calc(100vh - 80px);
    background: var(--sidebar);
    padding: 20px 12px;
    overflow-y: auto;
    z-index: 998;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 600;
}

.menu-item:hover, .menu-item.active {
    background: var(--primary);
    color: #ffffff;
}

.main-content {
    margin-left: 260px;
    margin-top: 80px;
    padding: 32px;
    min-height: calc(100vh - 80px);
}

/* ==========================================================================
   4. EXECUTIVE CONTROL HUB MANAGEMENT SECTIONS
   ========================================================================== */
.dashboard-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
}

/* Horizontal summary strips for Headquarters, Staff Accomm, Stations */
.location-summary-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 12px;
}

.summary-segment-box {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.summary-segment-box h4 {
    font-size: 14px;
    font-weight: 700;
    color: #1e3a8a;
    margin-bottom: 12px;
}

.segment-metrics-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px dashed var(--border);
    padding-top: 10px;
    margin-top: 8px;
}

.segment-datapoint {
    display: flex;
    flex-direction: column;
}

.segment-datapoint span {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    font-weight: 600;
}

.segment-datapoint val {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

/* Core System KPIs Metrics Blocks Counters Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
}

.kpi-card {
    background: #ffffff;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.kpi-card h3 {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 6px;
    font-weight: 700;
}

.kpi-card p {
    font-size: 28px;
    font-weight: 700;
}

/* ==========================================================================
   5. THE 16 CORE AMC SERVICES SERVICES TILES COMPONENT GRID
   ========================================================================== */
.services-section-wrapper {
    margin-top: 24px;
}

.services-section-wrapper h3 {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.services-main-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.service-card-item {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.01);
    transition: transform 0.2s, box-shadow 0.2s;
}

.service-card-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.04);
}

.service-card-item h4 {
    font-size: 14px;
    font-weight: 700;
    color: #1e3a8a;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 6px;
}

.service-card-item p {
    font-size: 13px;
    color: var(--text);
    display: flex;
    justify-content: space-between;
}

.service-card-item p span {
    color: var(--muted);
    font-weight: 500;
}

/* ==========================================================================
   6. INTERACTIVE SLIDE-OUT OVERLAY DRAWER PANEL SYSTEMS
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-panel {
    width: 100%; max-width: 440px;
    background: #ffffff; height: 100vh; padding: 30px;
    box-shadow: -5px 0 25px rgba(0,0,0,0.15);
    display: flex; flex-direction: column;
    transform: translateX(100%); transition: transform 0.2s ease;
    overflow-y: auto;
}

.modal-overlay.active .modal-panel { transform: translateX(0); }

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

.modal-header h2 { font-size: 18px; font-weight: 700; color: #1e3a8a; }
.close-modal-btn { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); }

.modal-form { display: flex; flex-direction: column; gap: 14px; }
.form-input-container { display: flex; flex-direction: column; gap: 4px; }
.form-input-container label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }

.modal-form input, .modal-form select, .modal-form textarea {
    width: 100%; height: 40px; padding: 0 12px;
    border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; outline: none;
}
.modal-form textarea { height: 80px; padding: 10px 12px; resize: none; }

/* ==========================================================================
   7. ASSET MATRIX REGISTRY DATA TABLES SPECIFICATIONS
   ========================================================================== */
.asset-action-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

.btn-success {
    height: 40px; padding: 0 16px; background: var(--success); color: white;
    border: none; border-radius: 6px; font-weight: 700; font-size: 13px; cursor: pointer;
    display: flex; align-items: center; gap: 6px;
}

.data-table-wrapper { background: #ffffff; border: 1px solid var(--border); border-radius: 8px; overflow-x: auto; }
.enterprise-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
.enterprise-table th { background: #f8fafc; color: var(--muted); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.enterprise-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.enterprise-table tr:hover td { background: #f8fafc; }

/* Operational Status Tokens Badge Matrix */
.badge { display: inline-block; padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.badge-operational, .badge-resolved { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-breakdown, .badge-critical { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-pending_approval, .badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-active { background: rgba(37, 99, 235, 0.1); color: var(--primary); }

/* ==========================================================================
   8. RESPONSIVE COMPONENT ADJUSTMENTS OVERRIDES
   ========================================================================== */
@media (max-width: 1400px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } .services-main-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1024px) { .location-summary-strip { grid-template-columns: 1fr; } }
@media (max-width: 768px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } .services-main-grid { grid-template-columns: 1fr; } .sidebar { left: -260px; } .main-content { margin-left: 0; padding: 16px; } }
