@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

html,
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f6f8f7;
    color: #1f2937;
    margin: 0;
    padding: 0;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

h1:focus {
    outline: none;
}

a,
.btn-link {
    color: inherit;
    text-decoration: none;
}

.content {
    padding-top: 0;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #22c55e;
}

.invalid {
    outline: 1px solid #ef4444;
}

.validation-message {
    color: #dc2626;
}

#blazor-error-ui {
    background: #fff3cd;
    bottom: 0;
    box-shadow: 0 -1px 6px rgba(0, 0, 0, 0.15);
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 2000;
    color: #664d03;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: linear-gradient(135deg, #b91c1c, #7f1d1d);
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: 14px;
}

    .blazor-error-boundary::after {
        content: "An error has occurred.";
    }

/* =========================
   MAIN APP LAYOUT
========================= */

.app-layout {
    display: flex;
    min-height: 100vh;
    background: #f6f8f7;
}

.sidebar {
    width: 300px;
    min-height: 100vh;
    background: radial-gradient(circle at top left, rgba(34, 197, 94, 0.16), transparent 28%), linear-gradient(180deg, #0b1f17 0%, #10281d 35%, #123524 100%);
    color: white;
    position: sticky;
    top: 0;
    overflow-y: auto;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.18);
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 24px;
}

.content-wrapper {
    width: 100%;
    max-width: 100%;
}

/* =========================
   MODERN FLOATING SIDEBAR
========================= */

.sidebar-shell {
    padding: 18px 14px;
    min-height: 100vh;
}

.sidebar-container {
    min-height: calc(100vh - 36px);
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(25, 55, 40, 0.96) 0%, rgba(13, 27, 21, 0.98) 100%);
    border: 1px solid rgba(150, 255, 190, 0.08);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 22px 45px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 16px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    text-decoration: none;
    min-width: 0;
}

    .sidebar-brand:hover {
        color: white;
        text-decoration: none;
    }

.sidebar-logo-wrap {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(38, 87, 58, 0.95), rgba(20, 52, 35, 0.98));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 10px 24px rgba(0,0,0,0.22);
    flex-shrink: 0;
}

.sidebar-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-title {
    font-size: 1.08rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.15;
    letter-spacing: 0.2px;
}

.sidebar-subtitle {
    font-size: 0.78rem;
    color: rgba(220, 255, 230, 0.68);
    margin-top: 3px;
}

.admin-toggler {
    border: none;
    background: rgba(255,255,255,0.08);
    border-radius: 12px;
    width: 42px;
    height: 42px;
    display: none;
    align-items: center;
    justify-content: center;
}

    .admin-toggler:focus {
        box-shadow: none;
        outline: none;
    }

    .admin-toggler .navbar-toggler-icon {
        filter: invert(1);
    }

.sidebar-menu {
    flex: 1;
    display: block;
    padding: 16px 14px 14px 14px;
}

    .sidebar-menu.collapsed {
        display: block;
    }

.admin-nav {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: calc(100vh - 150px);
}

.nav-section,
.nav-auth-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-auth-section {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.nav-item {
    width: 100%;
}

.admin-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 56px;
    padding: 14px 16px;
    border-radius: 18px;
    color: #f5fff7 !important;
    text-decoration: none;
    background: rgba(255,255,255,0.02);
    border: 1px solid transparent;
    transition: all 0.28s ease;
    overflow: hidden;
}

    .admin-nav-link::before {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: inherit;
        background: linear-gradient(90deg, rgba(34,197,94,0.16), rgba(34,197,94,0.04));
        opacity: 0;
        transition: opacity 0.28s ease;
    }

    .admin-nav-link:hover {
        transform: translateX(4px) scale(1.01);
        background: rgba(255,255,255,0.05);
        border-color: rgba(249, 115, 22, 0.35);
        box-shadow: 0 0 0 1px rgba(249,115,22,0.18), 0 0 18px rgba(249,115,22,0.30), 0 0 34px rgba(249,115,22,0.18);
        color: #ffffff !important;
    }

        .admin-nav-link:hover::before {
            opacity: 1;
        }

    .admin-nav-link.active {
        background: linear-gradient(90deg, rgba(21, 128, 61, 0.55), rgba(11, 59, 31, 0.95));
        border-color: rgba(134, 239, 172, 0.16);
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 12px 26px rgba(0,0,0,0.22);
        color: #ffffff !important;
    }

.nav-icon {
    width: 26px;
    min-width: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    z-index: 1;
}

.nav-text {
    flex: 1;
    font-size: 0.96rem;
    font-weight: 600;
    letter-spacing: 0.1px;
    z-index: 1;
}

.nav-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.18);
    box-shadow: 0 0 0 transparent;
    transition: all 0.28s ease;
    z-index: 1;
}

.admin-nav-link:hover .nav-dot {
    background: #fb923c;
    box-shadow: 0 0 8px rgba(251,146,60,0.95), 0 0 18px rgba(251,146,60,0.55);
}

.admin-nav-link.active .nav-dot {
    background: #86efac;
    box-shadow: 0 0 10px rgba(134,239,172,0.9), 0 0 18px rgba(134,239,172,0.45);
}

/* =========================
   BUTTONS
========================= */

.btn-primary {
    color: #fff;
    background-color: #166534;
    border-color: #166534;
    border-radius: 10px;
    transition: all 0.2s ease;
}

    .btn-primary:hover,
    .btn-primary:focus {
        background-color: #14532d;
        border-color: #14532d;
        color: #fff;
    }

.dashboard-action-btn {
    background: #166534;
    color: white !important;
    border-radius: 12px;
    padding: 10px 18px;
    border: none;
    font-weight: 600;
    transition: all 0.22s ease;
}

    .dashboard-action-btn:hover {
        background: #f97316;
        color: white !important;
        transform: translateY(-2px);
    }

/* =========================
   DASHBOARD
========================= */

.dashboard-page {
    width: 100%;
}

.dashboard-hero {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-radius: 22px;
    overflow: hidden;
}

.dashboard-logo-wrap {
    width: 96px;
    height: 96px;
    border-radius: 22px;
    background: rgba(20, 83, 45, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dashboard-logo {
    width: 68px;
    height: 68px;
    object-fit: contain;
}

.dashboard-title {
    font-size: 2rem;
    font-weight: 800;
    color: #14532d;
    margin: 0;
}

.dashboard-subtitle {
    font-size: 1rem;
    color: #4b5563;
    max-width: 700px;
}

.dashboard-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #166534;
    color: white;
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 600;
    white-space: nowrap;
}

.stats-card {
    border-radius: 18px;
    transition: all 0.22s ease;
    overflow: hidden;
}

    .stats-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 14px 30px rgba(0, 0, 0, 0.08) !important;
    }

.stats-green {
    background: linear-gradient(180deg, #ffffff, #f8fffb);
    border: 1px solid #e5efe8;
}

.stats-icon {
    font-size: 1.9rem;
    margin-bottom: 10px;
}

.stats-label {
    font-size: 0.92rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 6px;
}

.stats-value {
    font-size: 2rem;
    font-weight: 800;
    color: #166534;
    line-height: 1.1;
    margin-bottom: 6px;
}

.quick-actions-card {
    border-radius: 20px;
}

/* =========================
   PREMIUM UI COMPONENTS
========================= */

.card {
    border-radius: 18px;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
}

.form-control,
.form-select {
    border-radius: 12px;
    border: 1px solid #d1d5db;
    padding: 0.75rem 0.9rem;
    background-color: #fff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

    .form-control:focus,
    .form-select:focus {
        border-color: #16a34a;
        box-shadow: 0 0 0 0.18rem rgba(22, 163, 74, 0.15);
    }

.table-custom {
    border-collapse: separate;
    border-spacing: 0 8px;
    width: 100%;
    margin-top: -8px;
}

    .table-custom thead th {
        border-bottom: none;
        font-weight: 600;
        color: #6b7280;
        padding: 12px 16px;
        text-transform: uppercase;
        font-size: 0.82rem;
        letter-spacing: 0.5px;
    }

    .table-custom tbody tr {
        background: #fff;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
        border-radius: 12px;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

        .table-custom tbody tr:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
        }

    .table-custom tbody td {
        padding: 16px;
        vertical-align: middle;
        border: none;
    }

        .table-custom tbody td:first-child {
            border-top-left-radius: 12px;
            border-bottom-left-radius: 12px;
        }

        .table-custom tbody td:last-child {
            border-top-right-radius: 12px;
            border-bottom-right-radius: 12px;
        }

.badge-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.8rem;
    display: inline-block;
}

.badge-active {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-inactive {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-type {
    background-color: #e0e7ff;
    color: #3730a3;
}

.badge-prevention {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-treatment {
    background-color: #dbeafe;
    color: #1e40af;
}

.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    color: #6b7280;
}

.dashboard-quick-btn {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

    .dashboard-quick-btn:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 25px rgba(0,0,0,0.08) !important;
        border-color: #34d399 !important;
        background-color: #f8fafc;
    }

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 991.98px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-height: auto;
        position: relative;
    }

    .sidebar-shell {
        padding: 10px;
        min-height: auto;
    }

    .sidebar-container {
        min-height: auto;
        border-radius: 22px;
    }

    .main-content {
        padding: 16px;
    }

    .admin-toggler {
        display: inline-flex;
    }

    .sidebar-menu {
        display: block;
        padding-top: 12px;
    }

        .sidebar-menu.collapsed {
            display: none;
        }

    .admin-nav {
        min-height: auto;
    }

    .dashboard-title {
        font-size: 1.6rem;
    }

    .dashboard-logo-wrap {
        width: 82px;
        height: 82px;
    }

    .dashboard-logo {
        width: 58px;
        height: 58px;
    }
}

@media (max-width: 575.98px) {
    .main-content {
        padding: 12px;
    }

    .sidebar-header {
        padding: 14px 14px 16px 14px;
    }

    .sidebar-title {
        font-size: 0.98rem;
    }

    .sidebar-subtitle {
        font-size: 0.76rem;
    }

    .admin-nav-link {
        padding: 12px 12px;
        font-size: 0.93rem;
        min-height: 52px;
    }

    .dashboard-title {
        font-size: 1.35rem;
    }

    .stats-value {
        font-size: 1.7rem;
    }

    .dashboard-badge {
        width: 100%;
        justify-content: center;
    }
}
