/* ══════════════════════════════════════════════════════
   RehabPortal — Professional Design System
   ══════════════════════════════════════════════════════ */
:root {
    --brand-primary: #7c3aed;
    --brand-primary-hover: #6d28d9;
    --brand-primary-light: rgba(124, 58, 237, 0.12);
    --brand-gradient: linear-gradient(135deg, #7c3aed, #6366f1);
    --brand-dark: #0f0c29;
    --brand-dark-2: #1a1145;

    --surface-bg: #f0f2f5;
    --surface-card: #ffffff;
    --surface-card-hover: #fafbfc;

    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --border-subtle: rgba(0, 0, 0, 0.06);
    --border-radius: 16px;
    --border-radius-sm: 12px;
    --border-radius-xs: 8px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
    --shadow-brand: 0 8px 30px rgba(124, 58, 237, 0.25);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--surface-bg);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
}

/* ── Professional Navbar ─────────────────────────────── */
.app-navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0.75rem 0;
    background: rgba(15, 12, 41, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    transition: var(--transition);
}

.app-navbar.scrolled {
    background: rgba(15, 12, 41, 0.98);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.25);
    padding: 0.5rem 0;
}

.app-nav-logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: #fff;
    padding: 0;
    margin-right: 0;
}

.app-nav-logo:hover,
.app-nav-logo:focus {
    color: #fff;
    text-decoration: none;
}

.logo-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--brand-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    box-shadow: var(--shadow-brand);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, #c4b5fd, #e0e7ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-nav-toggle {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #fff;
    padding: 0.4rem 0.6rem;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: none;
}

.app-nav-toggle:focus {
    box-shadow: 0 0 0 0.2rem rgba(124, 58, 237, 0.3);
}

.app-nav-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-nav-link {
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 0.9rem;
    border-radius: 10px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.app-nav-link:hover,
.app-nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.app-nav-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 0.5rem;
}

.app-user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--brand-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #fff;
}

.user-name {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    font-weight: 500;
}

.app-nav-btn-logout {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.4rem 0.9rem;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-family: inherit;
}

.app-nav-btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fecaca;
}

/* ── Main Content Area ───────────────────────────────── */
.app-main {
    flex: 1;
    padding: 2rem 0 3rem;
}

/* ── Alert ───────────────────────────────────────────── */
.app-alert {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.9), rgba(99, 102, 241, 0.9));
    color: #fff;
    padding: 0.85rem 1.25rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.92rem;
    font-weight: 500;
    box-shadow: var(--shadow-brand);
}

.app-alert span { flex: 1; }

/* ── Professional Footer ─────────────────────────────── */
.app-footer {
    background: var(--brand-dark);
    padding: 1.5rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: auto;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 700;
    font-size: 1.05rem;
}

.footer-logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--brand-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #fff;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.45);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    transition: color 0.3s;
}

.footer-links a:hover { color: rgba(255, 255, 255, 0.8); }

.footer-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.footer-copy {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.82rem;
    margin: 0;
}

/* ── Dashboard Components ────────────────────────────── */

/* Page Header */
.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.dash-header-left h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
}

.dash-header-left p {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin: 0.25rem 0 0;
}

.dash-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.9rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
}

.dash-badge-primary {
    background: var(--brand-primary-light);
    color: var(--brand-primary);
}

.dash-badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

/* Quick Stat Cards */
.quick-stat {
    background: var(--surface-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    height: 100%;
}

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

.quick-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.quick-stat-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.quick-stat-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

/* Info Section Card */
.info-section {
    background: var(--surface-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.info-section:hover {
    box-shadow: var(--shadow-card);
}

.info-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    background: linear-gradient(135deg, #fafbff, #f8f9fc);
}

.info-section-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.info-section-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.info-section-body {
    padding: 1.25rem 1.5rem;
}

/* Info Grid (label-value pairs) */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-xs);
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    transition: var(--transition);
}

.info-item:hover {
    background: #f0f4ff;
    border-color: rgba(124, 58, 237, 0.1);
}

.info-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.info-value {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
}

.info-value.empty {
    color: var(--text-muted);
    font-style: italic;
    font-weight: 400;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn-brand {
    background: var(--brand-gradient);
    color: #fff;
    border: none;
    border-radius: var(--border-radius-xs);
    padding: 0.7rem 1.5rem;
    font-weight: 600;
    transition: var(--transition);
    font-family: inherit;
}

.btn-brand:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-brand);
}

/* ── Auth Card (kept for OTP page) ───────────────────── */
.auth-card {
    max-width: 440px;
    margin: 3rem auto;
    background: var(--surface-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-card);
    padding: 2.5rem;
    border: 1px solid var(--border-subtle);
}

.auth-card .auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-card .auth-header h2 {
    font-weight: 700;
    color: var(--brand-dark);
}

.auth-card .auth-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ── Form Controls ───────────────────────────────────── */
.form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 0.2rem rgba(124, 58, 237, 0.15);
}

.form-floating > label {
    color: var(--text-muted);
}

/* ── OTP Input ───────────────────────────────────────── */
.otp-input {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.75rem;
    padding: 0.75rem;
}

/* ── Legacy stat-card (kept for compatibility) ───────── */
.stat-card {
    background: var(--surface-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-card);
    padding: 1.5rem;
    transition: var(--transition);
    border: 1px solid var(--border-subtle);
}

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

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

/* ── Table ────────────────────────────────────────────── */
.table-modern {
    background: var(--surface-card);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.table-modern thead th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid #e2e8f0;
}

/* ── Animations ──────────────────────────────────────── */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background: rgba(15, 12, 41, 0.98);
        border-radius: 0 0 12px 12px;
        padding: 0.5rem 1rem 1rem;
        margin-top: 0.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
    .app-nav-menu {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 0.5rem 0;
    }
    .app-nav-link {
        padding: 0.65rem 1rem;
        border-radius: 8px;
    }
    .app-nav-divider {
        width: 100%;
        height: 1px;
        margin: 0.5rem 0;
    }
    .app-user-badge {
        justify-content: center;
        padding: 0.5rem 1rem;
    }
    .app-nav-btn-logout {
        justify-content: center;
        width: 100%;
        padding: 0.6rem 1rem;
    }
    .d-inline {
        display: block !important;
    }
}

@media (max-width: 576px) {
    .auth-card {
        margin: 1.5rem 1rem;
        padding: 1.5rem;
    }
    .info-grid {
        grid-template-columns: 1fr;
    }
    .dash-header {
        flex-direction: column;
        align-items: flex-start;
    }
}