/* Premium Rural Design System */
:root {
    /* Color Palette - Emerald & Gold (High Contrast) */
    --primary-color: #047857;
    /* Emerald 700 - Darker for better text contrast */
    --primary-dark: #065f46;
    /* Emerald 800 */
    --primary-light: #10b981;
    /* Emerald 500 */
    --accent-color: #d97706;
    /* Amber 600 */
    --accent-light: #fbbf24;
    /* Amber 400 */

    /* Neutrals */
    --bg-body: #f3f4f6;
    /* Gray 100 */
    --bg-surface: #ffffff;
    --text-main: #111827;
    /* Gray 900 */
    --text-muted: #374151;
    /* Gray 700 - Significantly darker than 500 for readability */

    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.92);
    --glass-border: rgba(255, 255, 255, 0.5);
    --blur: blur(12px);

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

html,
body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Typography Enhancements */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-dark);
}

/* Premium Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    box-shadow: var(--shadow-md);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
}

/* Glassmorphism Cards */
.card {
    background: var(--glass-bg);
    backdrop-filter: var(--blur);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
}

/* Layout Overrides */
.page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
    padding: 2rem;
}

.sidebar {
    background: linear-gradient(180deg, #064e3b 0%, #065f46 100%);
    color: white;
}

/* Responsive Sidebar */
@media (min-width: 641px) {

    /* Layout Overrides */
    .page {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
    }

    main {
        flex: 1;
        padding: 0;
        /* Remove default padding, handle in inner articles */
        background-color: #f8fafc;
        /* Ensure main bg differs slightly if needed */
    }

    /* Sidebar Styling */
    .sidebar {
        background: linear-gradient(160deg, #064e3b 0%, #065f46 100%);
        color: white;
        /* Mobile defaults */
        width: 100%;
        z-index: 1020;
    }

    /* Responsive Sidebar */
    @media (min-width: 768px) {

        /* Match md breakpoint */
        .page {
            flex-direction: row;
        }

        .sidebar {
            width: 280px;
            /* Slightly wider */
            height: 100vh;
            position: sticky;
            top: 0;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            /* Prevent double scrollbars, let NavMenu handle it */
            box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
            /* Restore shadow here or keep in premium section */
        }
    }
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(to right, var(--primary-dark), var(--primary-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-section {
    padding: 4rem 0;
    text-align: center;
}

/* Social Share Buttons */
.btn-icon-square {
    width: 31px;
    height: 31px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-whatsapp {
    background-color: #198754;
    /* Bootstrap success */
    border-color: #198754;
    color: white;
}

.btn-whatsapp:hover {
    background-color: #157347;
    border-color: #146c43;
    color: white;
}

.btn-telegram {
    background-color: #24A1DE;
    border-color: #24A1DE;
    color: white;
}

.btn-telegram:hover {
    background-color: #2086bf;
    border-color: #2086bf;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    /* Critical: Hide by default */
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* =========================================
   PREMIUM DASHBOARD REFACTOR (ADDED)
   ========================================= */

/* Sidebar Gradient & Shadow */
.sidebar {
    background: linear-gradient(160deg, #064e3b 0%, #065f46 100%);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

.offcanvas-body {
    background: linear-gradient(160deg, #064e3b 0%, #065f46 100%);
}

/* Nav Link Enhancements */
.nav-link {
    color: rgba(255, 255, 255, 0.85) !important;
    transition: all 0.2s ease-in-out;
    padding: 0.75rem 1rem;
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff !important;
    transform: translateX(4px);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

/* TopBar Styling */
.top-bar {
    z-index: 1030;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* Offcanvas Styling */
.offcanvas {
    border-right: none;
}

.offcanvas-header {
    background-color: #f8fafc;
}

/* Card & Content Refinements */
.card {
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    /* Modern Radius */
    overflow: hidden;
}

.shadow-hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* Avatar Circle */
.avatar-circle {
    font-size: 0.9rem;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color)) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Scrollbar Polish */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.4);
}

/* High Contrast Tabs Override */
.nav-tabs .nav-link {
    color: var(--primary-dark) !important;
    background-color: rgba(255, 255, 255, 0.7);
    border: 1px solid #ddd;
    margin-right: 2px;
    font-weight: 600;
}

.nav-tabs .nav-link.active {
    color: white !important;
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

.nav-tabs .nav-link:hover {
    background-color: #e9ecef;
    color: var(--primary-dark);
}

/* Panic Dashboard Redesign - Soft UI & Modern Palette */
:root {
    --panic-red: #D32F2F;
    /* Deep Red */
    --panic-bg: #F5F7FA;
    /* Off-White */
    --action-green: #2D6A4F;
    /* Emerald */
    --shadow-soft: 0px 4px 20px rgba(0, 0, 0, 0.05);
}

.bg-panic-red {
    background-color: var(--panic-red) !important;
}

.text-panic-red {
    color: var(--panic-red) !important;
}

.bg-panic-bg {
    background-color: var(--panic-bg) !important;
}

.card-soft {
    border: none !important;
    border-radius: 12px !important;
    box-shadow: var(--shadow-soft) !important;
    background-color: white !important;
    overflow: hidden;
    /* For rounded corners */
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 8px;
    padding: 6px 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-ghost:hover {
    background-color: rgba(4, 120, 87, 0.1);
    /* transparent emerald */
}

.chat-bubble {
    border-radius: 18px;
    padding: 10px 16px;
    position: relative;
    max-width: 80%;
}

.chat-bubble.admin {
    background-color: var(--primary-color);
    /* Emerald */
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-bubble.sender {
    background-color: #E9ECEF;
    color: #212529;
    border-bottom-left-radius: 4px;
}

/* Modern Modal Override */
.modal-content.panic-modern {
    border: none;
    border-radius: 16px;
    overflow: hidden;
}

.panic-header {
    background-color: var(--panic-red);
    color: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panic-timer-badge {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: bold;
}