/* ==========================================================================
   DENR PENRO Leyte Asset Registry System - Modern Light Theme CSS
   Design Philosophy: Figma-inspired minimalism, high contrast, subtle elevation,
   spacious environmental palette (DENR Sage, Forest Green & Pale Earth).
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-app: #F8F9FA;
    --bg-surface: #FFFFFF;
    --bg-subtle: #F1F4F2;
    --bg-sidebar: #FFFFFF;
    
    /* DENR Brand Greens */
    --brand-primary: #2D6A4F;       /* Deep Forest Green */
    --brand-primary-hover: #1E4D38; /* Darker Forest */
    --brand-secondary: #52796F;     /* Muted Sage */
    --brand-light: #E8F3ED;         /* Pale Mint/Sage surface */
    --brand-accent: #74A892;        /* Soft Sage Accent */
    --earth-soft: #FAF3E0;          /* Soft Pale Earth */
    --sky-soft: #E0F2FE;            /* Soft Sky Blue */
    --sky-dark: #0369A1;

    /* High Contrast Slate/Charcoal Typography */
    --text-primary: #1F2927;        /* Dark Slate Green / Deep Charcoal */
    --text-secondary: #5C6F68;      /* Muted Slate */
    --text-muted: #8E9E98;          /* Light Muted Gray */
    --text-inverse: #FFFFFF;

    /* Crisp Borders */
    --border-light: #E5EAE7;
    --border-medium: #CBD5E1;
    --border-focus: #2D6A4F;

    /* Status Colors */
    --status-serv-bg: #DCFCE7;
    --status-serv-text: #166534;
    --status-serv-border: #BBF7D0;
    
    --status-unserv-bg: #FEE2E2;
    --status-unserv-text: #991B1B;
    --status-unserv-border: #FECACA;

    /* Elevation & Shadows (Figma-style soft diffuse) */
    --shadow-subtle: 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-card: 0 1px 3px rgba(31, 41, 39, 0.04), 0 4px 12px rgba(31, 41, 39, 0.02);
    --shadow-dropdown: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Rounded Corners */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

/* Reset & Box Sizing */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--brand-primary);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover {
    color: var(--brand-primary-hover);
}

/* App Container Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* --------------------------------------------------------------------------
   Sidebar Navigation
   -------------------------------------------------------------------------- */
.sidebar {
    width: 270px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-light);
}

.brand-emblem {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;  /* Removes the green background */
    box-shadow: none;          /* Removes the green box shadow */
    width: auto;               /* Allows natural image sizing */
    height: auto;              /* Prevents forcing a 42x42 square container */
    padding: 0;
    /* width: 42px;
    height: 42px;
    background: var(--brand-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-weight: 700;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(45, 106, 79, 0.25); */
}
.brand-emblem img {
    max-height: 40px;          /* Controls the height of the logo */
    width: auto;
    display: block;
    object-fit: contain;
}

.brand-info h1 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
    line-height: 1.2;
}

.brand-info span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--brand-secondary);
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 8px 12px 4px;
    margin-top: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 13.5px;
    transition: all 0.15s ease;
}

.nav-item:hover {
    background: var(--brand-light);
    color: var(--brand-primary);
}

.nav-item.active {
    background: var(--brand-light);
    color: var(--brand-primary);
    font-weight: 600;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
    flex-shrink: 0;
}

.nav-item.active svg {
    stroke: var(--brand-primary);
}

.nav-badge {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    background: var(--border-light);
    color: var(--text-secondary);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-light);
    background: #FCFDFD;
}

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

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--brand-light);
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    border: 1px solid var(--border-light);
}

.user-meta {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role-badge {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: var(--radius-xs);
    letter-spacing: 0.3px;
}

.role-admin {
    background: #E0E7FF;
    color: #3730A3;
}

.role-ordinary {
    background: #FEF3C7;
    color: #92400E;
}

.btn-logout-icon {
    color: var(--text-muted);
    padding: 6px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-logout-icon:hover {
    color: #EF4444;
    background: #FEE2E2;
}

/* --------------------------------------------------------------------------
   Main Content Area
   -------------------------------------------------------------------------- */
.main-wrapper {
    flex: 1;
    margin-left: 270px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 64px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}
.breadcrumbs .current {
    color: var(--text-primary);
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.office-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 10px;
    background: var(--brand-light);
    color: var(--brand-primary);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(45, 106, 79, 0.15);
}

.content-body {
    padding: 28px 32px 48px;
    max-width: 1480px;
    width: 100%;
}

/* --------------------------------------------------------------------------
   Cards & Layout Components (Figma Minimalist Aesthetic)
   -------------------------------------------------------------------------- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    transition: border-color 0.15s ease;
}

.card:hover {
    border-color: #D5DDD8;
}

/* KPI Summary Metric Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.metric-card {
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

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

.metric-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.metric-icon-box {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.metric-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.metric-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* --------------------------------------------------------------------------
   Filter & Toolbar Area
   -------------------------------------------------------------------------- */
.filter-card {
    padding: 16px 20px;
    margin-bottom: 20px;
}

/* Classification Tabs */
.tabs-scroll-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.tab-pill {
    white-space: nowrap;
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: #FFFFFF;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tab-pill:hover {
    background: var(--bg-subtle);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.tab-pill.active {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #FFFFFF;
    font-weight: 600;
}

.tab-pill.active .badge-count {
    background: rgba(255, 255, 255, 0.25);
    color: #FFFFFF;
}

.tab-pill.icte-highlight {
    border-color: var(--brand-accent);
}

.badge-count {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    background: var(--bg-subtle);
    color: var(--text-secondary);
}

/* Toolbar Form Controls */
.toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    flex-wrap: wrap;
}

.form-select, .form-input {
    height: 38px;
    padding: 0 12px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: #FFFFFF;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-select:focus, .form-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.12);
}

.search-input-wrap {
    position: relative;
    min-width: 260px;
    flex: 1;
}

.search-input-wrap svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.search-input-wrap .form-input {
    width: 100%;
    padding-left: 36px;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --------------------------------------------------------------------------
   Buttons (Figma High-Contrast Style)
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--brand-primary);
    color: #FFFFFF;
}
.btn-primary:hover {
    background: var(--brand-primary-hover);
    color: #FFFFFF;
}

.btn-secondary {
    background: #FFFFFF;
    border-color: var(--border-medium);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background: var(--bg-subtle);
    border-color: #94A3B8;
}

.btn-success-soft {
    background: #ECFDF5;
    border-color: #A7F3D0;
    color: #065F46;
}
.btn-success-soft:hover {
    background: #D1FAE5;
}

.btn-danger-soft {
    background: #FEF2F2;
    border-color: #FECACA;
    color: #991B1B;
}
.btn-danger-soft:hover {
    background: #FEE2E2;
}

.btn-sm {
    height: 30px;
    padding: 0 10px;
    font-size: 12px;
}

/* --------------------------------------------------------------------------
   Data Table
   -------------------------------------------------------------------------- */
.table-card {
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

.data-table th {
    background: #F8FAF9;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background-color 0.12s ease;
}

.data-table tbody tr:hover {
    background-color: #F8FAF9;
}

.cell-property-no {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--brand-primary);
}

.cell-article-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.cell-desc {
    font-size: 12px;
    color: var(--text-muted);
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Status Badges */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 11.5px;
    font-weight: 600;
    border: 1px solid transparent;
}

.status-serviceable {
    background: var(--status-serv-bg);
    color: var(--status-serv-text);
    border-color: var(--status-serv-border);
}

.status-unserviceable {
    background: var(--status-unserv-bg);
    color: var(--status-unserv-text);
    border-color: var(--status-unserv-border);
}

.ageing-badge {
    display: inline-block;
    padding: 3px 8px;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 11.5px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.table-footer {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #FCFDFD;
    border-top: 1px solid var(--border-light);
    font-size: 12.5px;
    color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Flash Alerts
   -------------------------------------------------------------------------- */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 13.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid transparent;
}

.alert-success {
    background: #ECFDF5;
    border-color: #A7F3D0;
    color: #065F46;
}

.alert-danger {
    background: #FEF2F2;
    border-color: #FECACA;
    color: #991B1B;
}

.alert-warning {
    background: #FFFBEB;
    border-color: #FDE68A;
    color: #92400E;
}

.alert-info {
    background: #F0F9FF;
    border-color: #BAE6FD;
    color: #0369A1;
}

.alert-close {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
}
.alert-close:hover {
    opacity: 1;
}

/* --------------------------------------------------------------------------
   Forms & Inputs (Manual Entry & Edit)
   -------------------------------------------------------------------------- */
.form-card {
    padding: 28px 32px;
    max-width: 980px;
    margin: 0 auto;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

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

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-label .required {
    color: #EF4444;
}

.form-hint {
    font-size: 11.5px;
    color: var(--text-muted);
}

textarea.form-input {
    height: auto;
    min-height: 85px;
    padding: 10px 12px;
    resize: vertical;
}

/* Live Ageing Calculator Box in Form */
.live-ageing-box {
    background: #F8FAF9;
    border: 1px dashed var(--border-medium);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.live-ageing-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.live-ageing-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--brand-primary);
    padding: 3px 10px;
    background: var(--brand-light);
    border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   Authentication / Login Screen
   -------------------------------------------------------------------------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F4F7F5;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: #FFFFFF;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal);
    padding: 36px 32px;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-emblem {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    background: transparent;  /* Removes the green background */
    box-shadow: none;          /* Removes the green square shadow */
    width: auto;               /* Allows the image to dictate size */
    height: auto;              /* Prevents forcing a square shape */
    /* Removed width, height, background, border-radius, color, and box-shadow */
    /* width: 54px;
    height: 54px;
    background: var(--brand-primary);
    border-radius: var(--radius-md);
    color: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 22px;
    margin-bottom: 14px;
    box-shadow: 0 6px 16px rgba(45, 106, 79, 0.28); */
}
.auth-emblem img {
    max-height: 50px;
    width: auto;
    display: block;
  
}

.auth-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-primary);
}

.auth-subtitle {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.demo-credentials-box {
    margin-top: 24px;
    padding: 14px 16px;
    background: #F8FAF9;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 12px;
}

.demo-chip {
    cursor: pointer;
    padding: 4px 10px;
    background: #FFFFFF;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xs);
    font-weight: 600;
    color: var(--brand-primary);
    display: inline-block;
    margin: 4px 4px 0 0;
    transition: all 0.12s ease;
}
.demo-chip:hover {
    background: var(--brand-light);
    border-color: var(--brand-primary);
}

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

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }
    .main-wrapper {
        margin-left: 0;
    }
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
    .content-body {
        padding: 18px 16px 36px;
    }
}

/* --------------------------------------------------------------------------
   Field Station Interactive Component (Bug 2 UI Fix)
   -------------------------------------------------------------------------- */
.field-stations-container {
    padding: 0 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.station-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s ease;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    width: 100%;
    text-align: left;
    user-select: none;
    pointer-events: auto !important;
}

.station-btn:hover {
    background: var(--bg-subtle);
    color: var(--brand-primary);
}

.station-btn.active {
    background: var(--brand-light);
    color: var(--brand-primary);
    font-weight: 600;
    border-color: rgba(45, 106, 79, 0.2);
}

.station-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    background: var(--border-light);
    color: var(--text-secondary);
}

.station-btn.active .station-badge {
    background: var(--brand-primary);
    color: #FFFFFF;
}