/* assets/css/style.css */
/* SaaS Dashboard Theme - Light Minimalist */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ========================================
   CSS Variables - Design Tokens
   ======================================== */
:root {
    /* Colors - Light Theme */
    --bg-primary: #F8FAFC;
    --bg-secondary: #F1F5F9;
    --bg-card: #FFFFFF;

    /* Primary Accent - Soft Emerald */
    --primary: #10B981;
    --primary-light: #D1FAE5;
    --primary-dark: #059669;

    /* Secondary Accent - Soft Blue */
    --secondary: #3B82F6;
    --secondary-light: #DBEAFE;

    /* Text Colors */
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;

    /* Borders & Dividers */
    --border: #E2E8F0;
    --border-light: #F1F5F9;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

    /* Status Colors */
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;

    /* Layout */
    --sidebar-width: 280px;
    /* Increased from 260px for better visibility */
    --header-height: 64px;
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;
}

/* ========================================
   Base Reset & Typography
   ======================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8f9fa;
    /* Light gray background for entire page */
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 {
    font-size: 1.875rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 1.125rem;
}

/* Typography Utilities */
.text-xs {
    font-size: 0.875rem;
    /* Increased from 0.8125rem */
}

/* Increased from 0.75rem */
.text-sm {
    font-size: 0.9375rem;
}

/* Increased from 0.875rem */
.text-base {
    font-size: 1rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-xl {
    font-size: 1.25rem;
}

p {
    color: var(--text-secondary);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* ========================================
   Scrollbar - Minimal
   ======================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========================================
   Layout - App Container
   ======================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ========================================
   Sidebar Navigation
   ======================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-slow);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 1.25rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
}

.nav-brand img {
    height: 32px;
    width: auto;
}

.sidebar nav {
    flex: 1;
    padding: 1rem 0.75rem;
}

.nav-section-title {
    font-size: 0.8125rem;
    /* Increased from 0.7rem */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 1rem 1rem 0.5rem;
    margin-top: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    /* Increased from 0.875rem */
    font-weight: 500;
    border-radius: var(--radius);
    margin-bottom: 2px;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.nav-link:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.nav-link i {
    width: 20px;
    font-size: 1rem;
    text-align: center;
    opacity: 0.7;
}

.nav-link.active i {
    opacity: 1;
}

/* Nav Toggle with Chevron */
.nav-toggle {
    justify-content: space-between;
}

.nav-toggle .fa-chevron-down {
    font-size: 0.8125rem;
    /* Increased from 0.7rem */
    transition: transform var(--transition);
}

.nav-toggle.open .fa-chevron-down {
    transform: rotate(180deg);
}

/* Submenu */
.submenu {
    display: none;
    padding-left: 0.5rem;
    margin-left: 1.5rem;
    border-left: 2px solid var(--border-light);
    margin-bottom: 0.5rem;
}

.submenu.open {
    display: block;
    animation: slideDown var(--transition) ease-out;
}

.submenu .nav-link {
    font-size: 0.875rem;
    /* Increased from 0.8125rem */
    padding: 0.5rem 0.75rem;
}

/* ========================================
   Main Content Area
   ======================================== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: calc(100% - var(--sidebar-width));
    /* Prevent content overflow */
}

/* Top Header */
.top-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.top-header p {
    font-size: 0.875rem;
    margin: 0;
}

/* Content Area */
.content {
    flex: 1;
    padding: 1.5rem 2rem 2rem;
}

/* ========================================
   Cards
   ======================================== */
.glass-card,
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
}

.glass-card:hover,
.card:hover {
    box-shadow: var(--shadow-md);
}

/* Remove old glass effects */
.glass-card::before {
    display: none;
}

/* ========================================
   Stats Cards
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    /* Increased from 0.75rem */
    font-weight: 500;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card.primary .stat-value {
    color: var(--primary);
}

.stat-card.warning .stat-value {
    color: var(--warning);
}

.stat-card.danger .stat-value {
    color: var(--danger);
}

.stat-card.info .stat-value {
    color: var(--info);
}

/* ========================================
   Tables - Clean & Readable
   ======================================== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    background: var(--bg-secondary);
    padding: 1rem 1.25rem;
    text-align: left;
    font-size: 0.875rem;
    /* Increased from 0.8125rem */
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

td {
    padding: 1.25rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: 0.9375rem;
    /* Increased from 0.875rem */
}

/* Zebra Stripes */
tbody tr:nth-child(even) {
    background: var(--bg-secondary);
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: var(--primary-light);
}

/* First/Last cell radius */
tbody tr:last-child td {
    border-bottom: none;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Primary Button */
.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Secondary Button */
.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

/* Outline/Ghost Button */
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary-light);
}

/* Danger Button */
.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
}

/* Small Button */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    /* Increased from 0.8125rem */
}

/* Block Button */
.btn-block {
    width: 100%;
}

/* ========================================
   Form Inputs
   ======================================== */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.9375rem;
    /* Increased from 0.8125rem */
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

/* Search Input */
.search-input {
    position: relative;
}

.search-input input {
    padding-left: 2.5rem;
}

.search-input i {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* ========================================
   Badges & Status
   ========================================*/
/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 0.875rem;
    /* Increased from 0.8125rem */
    font-weight: 600;
}

.badge-sm {
    padding: 1px 8px;
    font-size: 0.75rem;
}

.badge-success {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.badge-warning {
    background: #FEF3C7;
    color: #92400E;
}

.badge-danger {
    background: #FEE2E2;
    color: #991B1B;
}

.badge-info {
    background: var(--secondary-light);
    color: #1E40AF;
}

/* ========================================
   Progress Bar
   ======================================== */
.progress {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width var(--transition-slow);
}

.progress-bar.success {
    background: var(--success);
}

.progress-bar.warning {
    background: var(--warning);
}

.progress-bar.danger {
    background: var(--danger);
}

/* ========================================
   Modals
   ======================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform var(--transition);
}

.modal-overlay.open .modal {
    transform: scale(1);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ========================================
   Login Page
   ======================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    height: 64px;
    margin-bottom: 1rem;
}

.login-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ========================================
   Utility Classes
   ======================================== */
.text-primary {
    color: var(--text-primary);
}


/* ========================================
   Public Dashboard specific styles 
   (Restored from inline CSS)
   ======================================== */
.public-container {
    max-width: 100%;
    /* Full width, not constrained */
    margin: 0;
    padding: 0;
    background-color: transparent;
    /* Let body background show through */
    min-height: 100vh;
}

/* Map Container */
#map {
    height: 500px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    z-index: 1;
}

/* Charts and Map Layout - Full Width */
.charts-map-wrapper {
    display: block;
}



.public-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-section img {
    height: 40px;
}

.logo-section h1 {
    font-size: 1.5rem;
    margin: 0;
}

.filter-section {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* Header Section with Gradient */
.header-section {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    padding: 2.5rem 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    box-shadow: 0 10px 25px -5px rgba(22, 163, 74, 0.2);
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.header-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -10%;
    width: 40%;
    height: 200%;
    background: rgba(255, 255, 255, 0.05);
    transform: rotate(25deg);
}

.header-title-box h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.025em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-title-box p {
    margin-top: 0.5rem;
    opacity: 0.9;
    font-size: 1rem;
    font-weight: 500;
}

/* Live Clock */
.live-clock {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: right;
    min-width: 220px;
}

#clock-time {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
    font-family: 'Courier New', monospace;
}

#clock-date {
    font-size: 0.8125rem;
    opacity: 0.8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@media (max-width: 768px) {
    .header-section {
        padding: 1.5rem;
        text-align: center;
        justify-content: center;
    }

    .live-clock {
        text-align: center;
        margin-top: 0.5rem;
    }

    .header-title-box h1 {
        font-size: 1.5rem;
    }
}

.text-secondary {
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

.bg-primary {
    background: var(--primary-light);
}

.bg-success {
    background: #D1FAE5;
}

.bg-warning {
    background: #FEF3C7;
}

.bg-danger {
    background: #FEE2E2;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 0.75rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn var(--transition) ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp var(--transition) ease-out;
}

/* Staggered animation for stat cards */
.stat-card:nth-child(1) {
    animation: fadeInUp 0.4s ease-out 0.05s both;
}

.stat-card:nth-child(2) {
    animation: fadeInUp 0.4s ease-out 0.1s both;
}

.stat-card:nth-child(3) {
    animation: fadeInUp 0.4s ease-out 0.15s both;
}

.stat-card:nth-child(4) {
    animation: fadeInUp 0.4s ease-out 0.2s both;
}

/* ========================================
   Mobile Responsive
   ======================================== */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .top-header {
        padding: 1rem;
    }

    .content {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .top-header h1 {
        font-size: 1.125rem;
    }

    /* Stack table responsively */
    table {
        font-size: 0.8125rem;
    }

    th,
    td {
        padding: 0.625rem 0.5rem;
    }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.open {
    display: block;
}