@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800&family=Nunito:wght@400;500;700;800&display=swap');

:root {
    --studifyx-primary: #2438C8;
    --studifyx-accent: #22C55E;
    --studifyx-text-secondary: #6B7280;
    --studifyx-text-primary: #111827;
    --studifyx-bg: #FFFFFF;
    --studifyx-bg-soft: #F9FAFB;
    --studifyx-bg-panel: #EBF0FF;
    --studifyx-border: #D1D5DB;
    --studifyx-radius: 14px;
    --studifyx-space-1: 0.25rem;
    --studifyx-space-2: 0.5rem;
    --studifyx-space-3: 0.75rem;
    --studifyx-space-4: 1rem;
    --studifyx-space-5: 1.25rem;
    --studifyx-space-6: 1.5rem;
    --studifyx-space-8: 2rem;
    --studifyx-space-10: 2.5rem;
    --studifyx-space-12: 3rem;
    --studifyx-content-width: 1100px;
    --studifyx-radius-card: 20px;
    --studifyx-focus-ring: 0 0 0 3px rgba(79, 70, 229, 0.45);
}

/* Dark mode CSS variable overrides */
html[data-dark="true"] {
    --studifyx-primary: #5B72F0;
    --studifyx-bg-panel: #1E2A4A;
    --studifyx-accent: #4ADE80;
    --studifyx-text-secondary: #9CA3AF;
    --studifyx-text-primary: #F9FAFB;
    --studifyx-bg: #1F2937;
    --studifyx-bg-soft: #111827;
    --studifyx-border: #374151;
    color-scheme: dark;
}

/* Logo blend mode: multiply breaks on dark backgrounds */
html[data-dark="true"] .studifyx-logo-image,
html[data-dark="true"] .public-hero-logo img,
html[data-dark="true"] .dashboard-hero-logo,
html[data-dark="true"] .public-buddy-avatar,
html[data-dark="true"] .pricing-buddy-avatar,
html[data-dark="true"] .about-mascot,
html[data-dark="true"] .contact-mascot,
html[data-dark="true"] .support-mascot,
html[data-dark="true"] .dashboard-buddy-image,
html[data-dark="true"] .conversations-mascot,
html[data-dark="true"] .empty-state-mascot,
html[data-dark="true"] .public-drawer-mascot {
    mix-blend-mode: normal;
    filter: drop-shadow(0 12px 26px rgba(79, 70, 229, 0.3)) saturate(1.05) brightness(1.05);
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: "Nunito", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--studifyx-bg-soft);
    color: var(--studifyx-text-primary);
}

* {
    box-sizing: border-box;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: "Baloo 2", "Nunito", "Segoe UI", sans-serif;
    letter-spacing: 0.01em;
}

h1:focus {
    outline: none;
}

/* Ghost buttons zijn altijd wit — nooit transparant op gekleurde panels */
[class*="ghost"], [class*="-ghost"] {
    background: var(--studifyx-bg) !important;
}

/* Skip-link: verborgen tot focus */
.skip-link {
    position: absolute;
    left: 1rem;
    top: 1rem;
    z-index: 9999;
    transform: translateY(-200%);
    background: var(--studifyx-primary);
    color: #ffffff;
    padding: 0.6rem 1.1rem;
    border-radius: var(--studifyx-radius);
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.15s ease;
}

.skip-link:focus {
    transform: translateY(0);
    outline: 3px solid var(--studifyx-accent);
    outline-offset: 2px;
}

a {
    color: var(--studifyx-primary);
    text-decoration: none;
    font-weight: 700;
}

a:hover,
a:focus-visible {
    color: var(--studifyx-accent);
    outline: 2px solid var(--studifyx-primary);
    outline-offset: 2px;
    border-radius: 3px;
}

.mud-button-root {
    border-radius: var(--studifyx-radius);
}

.mud-input>input,
.mud-input-control,
.mud-input-slot,
.mud-input-outlined-border {
    border-radius: var(--studifyx-radius);
}

.mud-paper,
.mud-card {
    border-radius: var(--studifyx-radius);
    border: 1px solid var(--studifyx-border);
    box-shadow: none;
}

.mud-appbar.studifyx-appbar {
    background-color: var(--studifyx-bg);
    color: var(--studifyx-text-primary);
}

.mud-drawer.studifyx-drawer {
    background-color: var(--studifyx-bg);
    color: var(--studifyx-text-primary);
}

.mud-nav-link {
    border-radius: 10px;
    margin: 0.1rem 0;
}

.mud-nav-link:hover {
    background-color: rgba(34, 197, 94, 0.12);
}

.mud-nav-link.active {
    background-color: rgba(79, 70, 229, 0.14);
    color: var(--studifyx-primary);
}

.mud-main-content {
    min-height: calc(100vh - 64px);
    background-color: var(--studifyx-bg-soft);
}

.public-hero-logo,
.dashboard-hero-brand,
.public-buddy-avatar-wrap,
.pricing-buddy-panel,
.about-buddy-panel,
.contact-buddy-panel,
.support-buddy-panel,
.public-drawer-hero,
.conversations-title-group,
.empty-state {
    isolation: isolate;
}

.studifyx-logo-image,
.public-hero-logo img,
.dashboard-hero-logo,
.public-buddy-avatar,
.pricing-buddy-avatar,
.about-mascot,
.contact-mascot,
.support-mascot,
.dashboard-buddy-image,
.conversations-mascot,
.empty-state-mascot,
.public-drawer-mascot {
    mix-blend-mode: multiply;
    filter:
        drop-shadow(0 12px 26px rgba(79, 70, 229, 0.12)) saturate(1.02) contrast(1.02);
}

.public-hero-logo,
.dashboard-hero-brand,
.public-buddy-avatar-wrap,
.pricing-buddy-panel,
.about-buddy-panel,
.contact-buddy-panel,
.support-buddy-panel,
.public-drawer-hero {
    position: relative;
}

.public-hero-logo::before,
.dashboard-hero-brand::before,
.public-buddy-avatar-wrap::before,
.pricing-buddy-panel::before,
.about-buddy-panel::before,
.contact-buddy-panel::before,
.support-buddy-panel::before,
.public-drawer-hero::before {
    content: "";
    position: absolute;
    inset: 8% 10%;
    z-index: -1;
    border-radius: 24px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0));
    filter: blur(18px);
    pointer-events: none;
}

/* Legacy class bridge to keep older pages visually consistent with Mud theme */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 1px solid transparent;
    border-radius: var(--studifyx-radius);
    padding: 0.6rem 1rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn-primary {
    background: var(--studifyx-primary);
    border-color: var(--studifyx-primary);
    color: var(--studifyx-bg);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background: var(--studifyx-accent);
    border-color: var(--studifyx-accent);
    color: var(--studifyx-bg);
}

.btn-secondary {
    background: var(--studifyx-bg);
    border-color: var(--studifyx-border);
    color: var(--studifyx-text-secondary);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
    border-color: var(--studifyx-accent);
    color: var(--studifyx-accent);
}

.btn-outline {
    background: var(--studifyx-bg);
    border: 2px solid var(--studifyx-primary);
    color: var(--studifyx-primary);
}

.btn-outline:hover,
.btn-outline:focus-visible {
    background: var(--studifyx-primary);
    border-color: var(--studifyx-primary);
    color: var(--studifyx-bg);
}

.btn-danger {
    background: #ef4444;
    border-color: #ef4444;
    color: var(--studifyx-bg);
}

.btn-danger:hover,
.btn-danger:focus-visible {
    background: #dc2626;
    border-color: #dc2626;
}

.section,
.empty-state,
.profile-card,
.recent-card,
.folder-create,
.conversation-row,
.faq article,
.plan {
    border: 1px solid var(--studifyx-border);
    border-radius: var(--studifyx-radius);
    background: var(--studifyx-bg);
    box-shadow: none;
}

.form-input,
.form-control,
.chat-input,
.folder-select {
    border: 1px solid var(--studifyx-border);
    border-radius: var(--studifyx-radius);
    color: var(--studifyx-text-primary);
    background: var(--studifyx-bg);
}

.form-input:focus,
.form-control:focus,
.chat-input:focus,
.folder-select:focus {
    outline: none;
    border-color: var(--studifyx-primary);
}

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 1rem;
}

.auth-card {
    width: min(560px, 100%);
    border: 1px solid var(--studifyx-border);
    border-radius: var(--studifyx-radius);
    background: var(--studifyx-bg);
    padding: 1.25rem;
}

.auth-card.error {
    border-color: #fca5a5;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--studifyx-accent);
}

.invalid {
    outline: 1px solid #ef4444;
}

.validation-message {
    color: #dc2626;
    font-weight: 700;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    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;
}

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: #d1d5db;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--studifyx-primary);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Studifyx laden");
}

code {
    color: #4338ca;
}

/* ── F039: Mobile header ── */
.mobile-header {
    display: none;
}

@media (max-width: 768px) {

    /* Verberg MudBlazor desktop-shell */
    .app-appbar  { display: none !important; }
    .app-drawer  { display: none !important; }

    /* Toon mobile header */
    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.9rem 1rem 0.85rem;
        background: var(--studifyx-bg);
        border-bottom: 1.5px solid var(--studifyx-border);
        position: sticky;
        top: 0;
        z-index: 100;
    }

    /* Content: geen left-margin van drawer, ruimte voor bottom nav */
    .mud-main-content {
        margin-left: 0 !important;
        padding-bottom: 70px !important;
        padding-top: 0 !important;
    }

    .app-content-container {
        padding: 1rem !important;
    }
}

.mobile-header-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.mobile-header-logo {
    height: 38px;
    width: auto;
    display: block;
}

.mobile-avatar-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 2.5px solid var(--studifyx-accent);
    background: var(--studifyx-bg-panel);
    cursor: pointer;
    overflow: hidden;
    padding: 0;
    display: flex; align-items: center; justify-content: center;
    transition: border-color 0.15s, transform 0.15s;
}
.mobile-avatar-btn:hover { border-color: var(--studifyx-primary); transform: scale(1.05); }
.mobile-avatar-btn img   { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.mobile-avatar-initial   { font-weight: 800; font-size: 0.95rem; color: var(--studifyx-primary); }

/* ── Bottom nav ── */
.mobile-bottomnav {
    display: none;
}

@media (max-width: 768px) {
    .mobile-bottomnav {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        background: var(--studifyx-bg);
        border-top: 1.5px solid var(--studifyx-border);
        z-index: 100;
        padding: 0.45rem 0 env(safe-area-inset-bottom, 0.55rem);
    }
}

.mobile-nav-item {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
    padding: 0.28rem 0;
    color: var(--studifyx-text-secondary);
    font-size: 0.64rem; font-weight: 700;
    border: none; background: none; font-family: 'Nunito', sans-serif;
    text-decoration: none; cursor: pointer;
    transition: color 0.12s;
}
.mobile-nav-item.active { color: var(--studifyx-primary); }
.mobile-nav-dot {
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--studifyx-primary);
}

/* ── Menu bottom sheet ── */
.mobile-sheet-backdrop {
    position: fixed; inset: 0;
    background: rgba(17,24,39,0.45);
    z-index: 200;
    animation: backdropIn 0.2s ease;
}

.mobile-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--studifyx-bg);
    border-radius: 24px 24px 0 0;
    z-index: 201;
    padding: 0 0 env(safe-area-inset-bottom, 1rem);
    box-shadow: 0 -4px 32px rgba(0,0,0,0.12);
    animation: sheetUp 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes sheetUp     { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes backdropIn  { from { opacity: 0; } to { opacity: 1; } }

.mobile-sheet-handle {
    width: 36px; height: 4px;
    background: var(--studifyx-border);
    border-radius: 99px;
    margin: 0.75rem auto 0;
}

.mobile-sheet-user {
    display: flex; align-items: center; gap: 0.85rem;
    padding: 1rem 1.25rem 0.85rem;
    border-bottom: 1.5px solid var(--studifyx-border);
}

.mobile-sheet-avatar {
    width: 46px; height: 46px;
    border-radius: 50%;
    border: 2.5px solid var(--studifyx-accent);
    overflow: hidden; flex-shrink: 0;
    background: var(--studifyx-bg-panel);
    display: flex; align-items: center; justify-content: center;
}
.mobile-sheet-avatar img { width: 100%; height: 100%; object-fit: cover; }

.mobile-sheet-name  { font-weight: 800; font-size: 0.95rem; color: var(--studifyx-text-primary); }
.mobile-sheet-email { font-size: 0.75rem; color: var(--studifyx-text-secondary); }

.mobile-sheet-items { padding: 0.5rem 0.75rem; }

.mobile-sheet-item {
    display: flex; align-items: center; gap: 0.85rem;
    padding: 0.8rem 0.6rem;
    border-radius: var(--studifyx-radius);
    cursor: pointer;
    color: var(--studifyx-text-primary); font-weight: 700; font-size: 0.92rem;
    border: none; background: none; font-family: 'Nunito', sans-serif; width: 100%;
    text-decoration: none; text-align: left;
    transition: background 0.12s;
}
.mobile-sheet-item:hover { background: var(--studifyx-bg-soft); }
.mobile-sheet-item.danger { color: #dc2626; }

.mobile-sheet-icon {
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--studifyx-bg-panel); color: var(--studifyx-primary);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.mobile-sheet-item.danger .mobile-sheet-icon { background: rgba(239,68,68,0.10); color: #dc2626; }

.mobile-sheet-divider { height: 1px; background: var(--studifyx-border); margin: 0.35rem 0.6rem; }

/* ── F039 dark mode aanvullingen ── */
html[data-dark="true"] .mobile-header     { background: var(--studifyx-bg); border-color: var(--studifyx-border); }
html[data-dark="true"] .mobile-sheet      { background: var(--studifyx-bg); }
html[data-dark="true"] .mobile-sheet-name { color: var(--studifyx-text-primary); }

/* ── F040 PWA update banner ── */
.pwa-update-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 1rem;
    background: var(--studifyx-primary);
    color: #fff;
    font-family: 'Nunito', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    box-shadow: 0 2px 12px color-mix(in srgb, var(--studifyx-primary) 25%, transparent);
    animation: bannerSlideDown 0.3s ease;
}
@keyframes bannerSlideDown {
    from { transform: translateY(-100%); }
    to   { transform: translateY(0); }
}
.pwa-update-btn {
    flex-shrink: 0;
    padding: 0.35rem 0.9rem;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.7);
    background: transparent;
    color: #fff;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s;
}
.pwa-update-btn:hover { background: rgba(255,255,255,0.15); }
html[data-dark="true"] .mobile-bottomnav  { background: var(--studifyx-bg); border-color: var(--studifyx-border); }