:root {
    --primary-color: #1e293b;
    /* Slate 800 */
    --primary-light: #334155;
    /* Slate 700 */
    --secondary-color: #2563eb;
    /* Blue 600 */
    --accent-color: #f59e0b;
    /* Amber 500 */
    --success-color: #10b981;
    /* Emerald 500 */
    --danger-color: #ef4444;
    /* Red 500 */
    --background-color: #f1f5f9;
    /* Slate 100 */
    --surface-color: #ffffff;
    --text-color: #0f172a;
    /* Slate 900 */
    --text-light: #64748b;
    /* Slate 500 */
    --white: #ffffff;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1.25rem;
    --radius-full: 9999px;

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

[data-bs-theme="dark"] {
    --primary-color: #cbd5e1;
    /* Slate 300 */
    --primary-light: #94a3b8;
    /* Slate 400 */
    --secondary-color: #3b82f6;
    /* Blue 500 */
    --background-color: #0f172a;
    /* Slate 900 */
    --surface-color: #1e293b;
    /* Slate 800 */
    --text-color: #f1f5f9;
    /* Slate 100 */
    --text-light: #94a3b8;
    /* Slate 400 */
    --white: #1e293b;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.7);
}

[data-bs-theme="dark"] .app-header {
    background: rgba(15, 23, 42, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .bottom-nav {
    background: #1e293b;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .card {
    border: 1px solid rgba(255, 255, 255, 0.1);
}


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

body {
    font-family: var(--font-body);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    font-size: 16px;
    /* Base size for readability */
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--text-color);
    font-weight: 700;
    line-height: 1.2;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

/* Layout Container (Mobile First) */
.app-container {
    max-width: 480px;
    /* Constrain width for mobile feel on desktop */
    margin: 0 auto;
    background-color: var(--background-color);
    /* Matches body */
    min-height: 100vh;
    position: relative;
    padding-bottom: 80px;
    /* Space for bottom nav */
    box-shadow: var(--shadow-lg);
}

/* Header */
.app-header {
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary-color);
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: var(--secondary-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* Components */
.card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.5);
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    border-color: rgba(37, 99, 235, 0.2);
}

.card-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--white);
}

.bg-primary-gradient {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    transition: transform 0.2s;
}

.bg-danger-gradient {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    transition: transform 0.2s;
}

.bg-secondary-gradient {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    /* Slate 500 to 600 */
    transition: transform 0.2s;
    color: white;
}

.bg-success-gradient {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    /* Emerald 500 to 600 */
    transition: transform 0.2s;
}

.custom-action-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md) !important;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-item {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 0.5rem;
    width: 100%;
    /* Mobile friendly default */
}

.btn-primary {
    background: var(--secondary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-accent {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.section-title {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--white);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-around;
    padding: 0.75rem;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-light);
    gap: 0.25rem;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    flex: 1;
}

.nav-item.active {
    color: var(--secondary-color);
    background: rgba(59, 130, 246, 0.08);
    /* faint blue bg */
    font-weight: 600;
}

.nav-icon {
    font-size: 1.5rem;
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.fw-bold {
    font-weight: 700;
}

.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

/* Soft Glow Animation (No scaling to avoid 'blink' jitter) */
@keyframes status-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Ultra-Subtle Glow Animation (No scaling, no jitter) */
@keyframes status-glow {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}

@keyframes danger-glow {
    0% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.4;
    }
}

.status-indicator-live {
    animation: status-glow 3s infinite ease-in-out;
}

.danger-glow-live {
    animation: danger-glow 4s infinite ease-in-out;
}

.clickable-card:active {
    opacity: 0.8;
    transition: opacity 0.1s;
}

/* Glassmorphism for Modals */
.modal-content {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Responsive adjustments */
@media (min-width: 481px) {
    body {
        background-color: var(--background-color);
        opacity: 1;
    }
}

[data-bs-theme="dark"] .bg-white {
    background-color: var(--surface-color) !important;
}

[data-bs-theme="dark"] .bg-light {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

[data-bs-theme="dark"] .text-muted {
    color: var(--text-light) !important;
}

[data-bs-theme="dark"] .modal-content {
    background: var(--surface-color) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .text-dark {
    color: var(--text-color) !important;
}