/* WB-Turnos - Global Styles (Light Theme) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── CSS Variables ─────────────────────────────────── */
:root {
    --primary: #10b981; /* Emerald */
    --primary-dark: #059669;
    --primary-light: #d1fae5; /* Mint green for active backgrounds */
    --primary-text: #065f46;
    --secondary: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --warning-text: #b45309;
    --danger: #ef4444;
    --danger-light: #fbb2b2;
    --danger-text: #b91c1c;
    --main-bg: #f3f4f6; /* Light gray background */
    --surface: #ffffff; /* White cards */
    --surface-hover: #f8fafc;
    --sidebar-bg: #111827; /* Dark blue/gray */
    --sidebar-border: #1f2937;
    --sidebar-text: #f1f5f9;
    --sidebar-muted: #94a3b8;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 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);
    --sidebar-w: 260px;
    --topbar-h: 70px;
    --transition: 0.2s ease;
}

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

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--main-bg);
    color: var(--text);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

    a:hover {
        color: var(--primary-dark);
    }

/* ─── App Shell ──────────────────────────────────────── */
.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ─── Sidebar ────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width var(--transition);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--sidebar-text);
}

.logo-icon {
    font-size: 1.5rem;
    color: var(--primary);
}

.nav-section {
    padding: 1rem 0.75rem;
    flex: 1;
}

.nav-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--sidebar-muted);
    padding: 0.5rem 0.75rem;
    text-transform: uppercase;
    margin-top: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-sm);
    color: var(--sidebar-muted);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 4px;
}

    .nav-link:hover {
        color: var(--sidebar-text);
        background: rgba(255, 255, 255, 0.05);
    }

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

.nav-icon {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.nav-link.active .nav-icon {
    color: var(--primary-dark);
}

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--sidebar-border);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.6rem 0.85rem;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--sidebar-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

    .logout-btn:hover {
        background: rgba(239,68,68,0.1);
        color: var(--danger);
    }

/* ─── Sidebar Toggle (Burger) ────────────────────────── */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.25rem 1rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--sidebar-muted);
    font-size: 1.1rem;
    padding: 0.25rem 0.4rem;
    border-radius: var(--radius-sm);
    line-height: 1;
    transition: all var(--transition);
    flex-shrink: 0;
}

    .sidebar-toggle:hover {
        color: var(--sidebar-text);
        background: rgba(255,255,255,0.08);
    }

/* ─── Sidebar Collapsed State ────────────────────────── */
.sidebar.collapsed {
    width: 64px;
    min-width: 64px;
}

    .sidebar.collapsed .logo-text {
        display: none;
    }

    .sidebar.collapsed .nav-text {
        display: none;
    }

    .sidebar.collapsed .nav-label {
        display: none;
    }

    .sidebar.collapsed .sidebar-logo {
        justify-content: center;
    }

    .sidebar.collapsed .sidebar-header {
        justify-content: center;
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem 0.5rem;
    }

    .sidebar.collapsed .sidebar-toggle {
        font-size: 1.25rem;
    }

    .sidebar.collapsed .nav-section {
        padding: 1rem 0.5rem;
    }

    .sidebar.collapsed .nav-link {
        justify-content: center;
        padding: 0.6rem;
    }

    .sidebar.collapsed .nav-icon {
        width: auto;
    }

    .sidebar.collapsed .sidebar-footer {
        padding: 1rem 0.5rem;
    }

    .sidebar.collapsed .logout-btn {
        justify-content: center;
        padding: 0.6rem;
    }

/* ─── Main Content ───────────────────────────────────── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--main-bg);
}

/* ─── Top Bar ────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
    overflow: hidden;
}

    .user-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.notification-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

    .notification-btn:hover {
        background: var(--surface-hover);
    }

/* ─── Content Wrapper ────────────────────────────────── */
.content-wrapper {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ─── Cards ──────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

/* ─── Buttons ────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

    .btn-primary:hover {
        background: var(--primary-dark);
    }

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

    .btn-outline:hover {
        background: var(--surface-hover);
    }

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

/* ─── Tables ─────────────────────────────────────────── */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

    .table th {
        background: var(--surface);
        color: var(--text-muted);
        font-weight: 500;
        padding: 0.75rem 1rem;
        text-align: left;
        border-bottom: 1px solid var(--border);
    }

    .table td {
        padding: 1rem;
        border-bottom: 1px solid var(--border);
        color: var(--text);
        vertical-align: middle;
    }

    .table tbody tr:hover {
        background: var(--surface-hover);
    }

    .table tbody tr:last-child td {
        border-bottom: none;
    }

/* ─── Badges / Status ────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

    .badge::before {
        content: '';
        display: block;
        width: 6px;
        height: 6px;
        border-radius: 50%;
    }

.badge-success {
    background: var(--primary-light);
    color: var(--primary-text);
}

    .badge-success::before {
        background: var(--primary);
    }

.badge-warning {
    background: var(--warning-light);
    color: var(--warning-text);
}

    .badge-warning::before {
        background: var(--warning);
    }

.badge-danger {
    background: var(--danger-light);
    color: var(--danger-text);
}

    .badge-danger::before {
        background: var(--danger);
    }

/* ─── Forms ──────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.875rem;
    transition: all var(--transition);
    outline: none;
}

    .form-control:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-light);
    }

    .form-control::placeholder {
        color: var(--text-muted);
    }

/* ─── Alert ──────────────────────────────────────────── */
.alert {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.alert-danger {
    background: #fef2f2;
    border: 1px solid #f87171;
    color: #b91c1c;
}

/* ─── Stats Grid & Cards ────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 540px) {
    .stats-grid { grid-template-columns: 1fr; }
}

.stat-card {
    background: var(--sc-bg, var(--surface));
    border-radius: var(--radius);
    padding: 1.4rem 1.6rem 1.6rem;
    border: 1px solid var(--border);
    border-left: 5px solid var(--sc, var(--primary));
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: .9rem;
    transition: box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.stat-top {
    display: flex;
    align-items: center;
    gap: .6rem;
}

/* icono de stat-card (usado desde Home y Admin Dashboard) */
.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.stat-label {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
    line-height: 1.3;
}

.stat-value {
    font-size: 2.75rem;
    font-weight: 900;
    color: var(--text);
    line-height: 1;
    letter-spacing: -.03em;
}

/* ─── Dashboard Specifics ────────────────────────────── */
.reporte-section-title {
    padding: .6rem 1rem;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-subtle, rgba(0,0,0,.03));
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

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

@media (max-width: 768px) {
    .overview-grid {
        grid-template-columns: 1fr;
    }
}

.overview-card {
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.overview-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1rem;
}

.overview-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

    .overview-item:last-child {
        margin-bottom: 0;
    }

.overview-item-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text);
    font-weight: 500;
}

.overview-item-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--main-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

    .overview-item-icon.success {
        background: var(--primary-light);
        color: var(--primary-dark);
    }

.progress-bar-container {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    width: 60px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--sidebar-bg);
    border-radius: 4px;
}

.overview-value {
    font-weight: 600;
    font-size: 0.875rem;
}

.donut-chart-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0;
}

.donut-chart {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: conic-gradient(var(--sidebar-bg) 0% 60%, var(--primary-light) 60% 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .donut-chart::after {
        content: '';
        position: absolute;
        width: 120px;
        height: 120px;
        background: var(--surface);
        border-radius: 50%;
    }

.donut-text {
    position: relative;
    z-index: 1;
    text-align: center;
}

.donut-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.donut-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.patient-info {
    display: flex;
    flex-direction: column;
}

.patient-name {
    font-weight: 600;
    color: var(--text);
}

.patient-type {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.staff-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.staff-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--border);
}

/* ─── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: #94a3b8;
    }

#blazor-error-ui {
    background: #fef2f2;
    border: 1px solid #f87171;
    border-radius: var(--radius-sm);
    bottom: 1rem;
    right: 1rem;
    padding: 0.75rem 1.25rem;
    position: fixed;
    display: none;
    z-index: 9999;
    color: #b91c1c;
    font-size: 0.875rem;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow);
}

    #blazor-error-ui.blazor-error-boundary {
        display: flex;
    }

/* ─── Nodo hoja (genera turno) ──────────────────────────── */
.opcion-hoja {
    padding: 1.2rem 1rem;
    font-size: 1.3rem;
    display: flex;
    font-weight: 700;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid var(--border) !important;
    background: var(--surface) !important;
    color: var(--text) !important;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
}

    .opcion-hoja:hover {
        /*background: var(--primary-light) !important;*/
        /*border-color: var(--primary) !important;*/
        color: var(--primary-text) !important;
        box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2) !important;
    }

    .opcion-hoja .icon-hoja {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 30px;
        height: 30px;
        border-radius: 8px;
        background: var(--primary-light);
        font-size: 0.9rem;
        flex-shrink: 0;
    }

/* ─── Nodo padre (expande/colapsa) ──────────────────────── */
.opcion-padre-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    border: 1px solid var(--border) !important;
    background: #f8fafc !important;
    color: var(--text) !important;
    font-weight: 600 !important;
    transition: background 0.15s ease, border-color 0.15s ease !important;
}

    .opcion-padre-btn:hover,
    .opcion-padre-btn.abierto {
        background: #e0f2fe !important;
        border-color: var(--secondary) !important;
        color: #0369a1 !important;
    }

    .opcion-padre-btn .icon-folder {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 30px;
        height: 30px;
        border-radius: 8px;
        background: rgba(14, 165, 233, 0.12);
        font-size: 0.9rem;
        flex-shrink: 0;
    }

    .opcion-padre-btn .chevron {
        margin-left: auto;
        font-size: 0.65rem;
        color: var(--text-muted);
        transition: transform 0.2s ease;
    }

    .opcion-padre-btn.abierto .chevron {
        transform: rotate(180deg);
        color: var(--secondary);
    }

/* ─── Subárbol indentado ────────────────────────────────── */
.subarbol {
    padding-left: 1.1rem;
    padding-top: 0.4rem;
    margin-left: 0.6rem;
    border-left: 2px solid var(--border);
}
