/* ============================================================
   Eduvivo Design System — CSS Foundation (Phase F.5a)
   Tokens sampled from Docs/design/eduvivo-mockups/
   ============================================================ */

:root {
    /* Brand colors */
    --ev-primary:           #7B6FE8;
    --ev-primary-deep:      #5E4FCF;
    --ev-primary-soft:      #E8E4FC;

    /* Brand gradient (logo + hero accents) */
    --ev-gradient-start:    #8B5CF6;
    --ev-gradient-mid:      #6B92F0;
    --ev-gradient-end:      #7AD7D1;
    --ev-gradient:          linear-gradient(135deg, #8B5CF6, #6B92F0, #7AD7D1);

    /* Surfaces */
    --ev-bg:                #F8F7FF;
    --ev-bg-alt:            #FAFAFE;
    --ev-surface:           #FFFFFF;
    --ev-surface-glass:     rgba(255, 255, 255, 0.72);

    /* Text */
    --ev-text-dark:         #1A1D3A;
    --ev-text-body:         #3C4266;
    --ev-text-muted:        #8B93A7;

    /* Borders */
    --ev-border:            #EDEBF5;
    --ev-border-hover:      #D8D4EC;

    /* Status */
    --ev-success:           #10B981;
    --ev-warning:           #F59E0B;
    --ev-danger:            #EF4444;
    --ev-info:              #3B82F6;

    /* Radii */
    --ev-radius-sm:         8px;
    --ev-radius-md:         12px;
    --ev-radius-lg:         16px;
    --ev-radius-xl:         24px;

    /* Shadows (purple-tinted to blend with bg) */
    --ev-shadow-soft:       0 4px 20px rgba(123, 111, 232, 0.08);
    --ev-shadow-hover:      0 8px 32px rgba(123, 111, 232, 0.15);
    --ev-shadow-card:       0 2px 8px rgba(26, 29, 58, 0.04);

    /* Layout */
    --ev-sidebar-width:     240px;
    --ev-header-height:     64px;
    --ev-bottombar-height:  64px;

    /* Focus ring */
    --ev-focus-ring:        0 0 0 3px rgba(123, 111, 232, 0.18);
}

/* ============================================================
   Base
   ============================================================ */
html, body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
                 Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ev-text-body);
    background-color: var(--ev-bg);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 15px;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--ev-text-dark);
    font-weight: 700;
    line-height: 1.25;
    margin-top: 0;
}

a {
    color: var(--ev-primary);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover {
    color: var(--ev-primary-deep);
}

.text-muted {
    color: var(--ev-text-muted) !important;
}

/* ============================================================
   Buttons — override Bootstrap primary with Eduvivo brand
   ============================================================ */
.btn {
    border-radius: var(--ev-radius-md);
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--ev-primary);
    border-color: var(--ev-primary);
    color: #fff;
}
.btn-primary:hover,
.btn-primary:focus {
    background: var(--ev-primary-deep);
    border-color: var(--ev-primary-deep);
    color: #fff;
    box-shadow: var(--ev-focus-ring);
}
.btn-primary:disabled {
    background: var(--ev-primary);
    border-color: var(--ev-primary);
    opacity: 0.55;
}

.btn-outline-primary {
    background: transparent;
    border-color: var(--ev-primary);
    color: var(--ev-primary);
}
.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background: var(--ev-primary-soft);
    border-color: var(--ev-primary);
    color: var(--ev-primary-deep);
    box-shadow: var(--ev-focus-ring);
}

.btn-ev-gradient {
    background: var(--ev-gradient);
    border: 0;
    color: #fff;
    box-shadow: var(--ev-shadow-soft);
}
.btn-ev-gradient:hover,
.btn-ev-gradient:focus {
    filter: brightness(1.05);
    color: #fff;
    box-shadow: var(--ev-shadow-hover);
}

/* ============================================================
   Form controls — align with Eduvivo tokens
   ============================================================ */
.form-control,
.form-select {
    border: 1px solid var(--ev-border);
    border-radius: var(--ev-radius-sm);
    padding: 0.625rem 0.875rem;
    background: var(--ev-surface);
    color: var(--ev-text-dark);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--ev-primary);
    box-shadow: var(--ev-focus-ring);
    outline: 0;
}

.form-label {
    color: var(--ev-text-dark);
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.375rem;
}

.form-check-input:checked {
    background-color: var(--ev-primary);
    border-color: var(--ev-primary);
}
.form-check-input:focus {
    border-color: var(--ev-primary);
    box-shadow: var(--ev-focus-ring);
}

/* ============================================================
   Cards
   ============================================================ */
.ev-card {
    background: var(--ev-surface);
    border: 1px solid var(--ev-border);
    border-radius: var(--ev-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--ev-shadow-card);
}
.ev-card-hover {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.ev-card-hover:hover {
    box-shadow: var(--ev-shadow-hover);
    transform: translateY(-2px);
}

.ev-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

/* ============================================================
   Auth shell (Login, Register, Confirm, SetPassword)
   ============================================================ */
.ev-auth-shell {
    min-height: 100vh;
    background: var(--ev-bg);
    background-image:
        radial-gradient(ellipse 80% 60% at 15% 10%, rgba(139, 92, 246, 0.12), transparent 60%),
        radial-gradient(ellipse 70% 50% at 85% 90%, rgba(122, 215, 209, 0.12), transparent 60%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.ev-auth-card {
    background: var(--ev-surface);
    border: 1px solid var(--ev-border);
    border-radius: var(--ev-radius-lg);
    box-shadow: var(--ev-shadow-soft);
    padding: 2.5rem 2rem;
    max-width: 440px;
    width: 100%;
}

.ev-auth-logo {
    display: block;
    margin: 0 auto 1rem;
    width: 72px;
    height: auto;
}

.ev-auth-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ev-text-dark);
    margin-bottom: 0.25rem;
}

.ev-auth-subtitle {
    text-align: center;
    font-size: 0.9rem;
    color: var(--ev-text-muted);
    margin-bottom: 1.5rem;
}

.ev-auth-footer {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.9rem;
}
.ev-auth-footer a {
    color: var(--ev-primary);
    font-weight: 600;
    margin-left: 0.375rem;
}

/* ============================================================
   App shell (authenticated dashboard)
   ============================================================ */
.ev-app {
    display: grid;
    grid-template-rows: var(--ev-header-height) 1fr;
    grid-template-columns: var(--ev-sidebar-width) 1fr;
    grid-template-areas:
        "sidebar header"
        "sidebar content";
    min-height: 100vh;
    background: var(--ev-bg);
}

/* Header */
.ev-header {
    grid-area: header;
    background: var(--ev-surface);
    border-bottom: 1px solid var(--ev-border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
}
.ev-header-logo {
    height: 32px;
    width: auto;
}
.ev-header-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ev-text-dark);
    flex: 1;
}
.ev-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.ev-header-org {
    font-size: 0.875rem;
    color: var(--ev-text-muted);
}
.ev-header-icon {
    background: transparent;
    border: none;
    color: var(--ev-text-muted);
    width: 40px;
    height: 40px;
    border-radius: var(--ev-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}
.ev-header-icon:hover {
    background: var(--ev-primary-soft);
    color: var(--ev-primary);
}

/* Sidebar */
.ev-sidebar {
    grid-area: sidebar;
    background: var(--ev-surface);
    border-right: 1px solid var(--ev-border);
    padding: 1.25rem 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.ev-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.25rem 0.75rem 1.25rem;
}
.ev-sidebar-brand img {
    width: 32px;
    height: 32px;
    border-radius: var(--ev-radius-sm);
}
.ev-sidebar-brand span {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--ev-primary);
    letter-spacing: -0.01em;
}
.ev-sidebar-section {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--ev-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0 0.75rem;
    margin-top: 0.75rem;
    margin-bottom: 0.375rem;
}
.ev-sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}
.ev-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--ev-radius-sm);
    color: var(--ev-text-body);
    text-decoration: none;
    font-size: 0.925rem;
    font-weight: 500;
    transition: all 0.15s ease;
}
.ev-sidebar-link:hover {
    background: var(--ev-primary-soft);
    color: var(--ev-primary);
}
.ev-sidebar-link.active {
    background: var(--ev-primary-soft);
    color: var(--ev-primary);
    font-weight: 600;
}
.ev-sidebar-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* Content area */
.ev-content {
    grid-area: content;
    padding: 1.75rem 2rem;
    overflow-y: auto;
}

/* Bottom nav (mobile) */
.ev-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--ev-bottombar-height);
    background: var(--ev-surface);
    border-top: 1px solid var(--ev-border);
    z-index: 10;
    box-shadow: 0 -2px 8px rgba(26, 29, 58, 0.04);
}
.ev-bottom-nav ul {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}
.ev-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    color: var(--ev-text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    text-decoration: none;
    height: 100%;
}
.ev-bottom-nav a.active {
    color: var(--ev-primary);
}
.ev-bottom-nav a i {
    font-size: 1.2rem;
}

/* Responsive: collapse sidebar below md */
@media (max-width: 991px) {
    .ev-app {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "content";
    }
    .ev-sidebar {
        display: none;
    }
    .ev-bottom-nav {
        display: block;
    }
    .ev-content {
        padding: 1rem;
        padding-bottom: calc(var(--ev-bottombar-height) + 1.5rem);
    }
}

/* ============================================================
   Alerts
   ============================================================ */
.alert {
    border-radius: var(--ev-radius-sm);
    padding: 0.75rem 1rem;
    border-width: 1px;
}
.alert-success {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.25);
    color: #065F46;
}
.alert-danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
    color: #991B1B;
}
.alert-warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.25);
    color: #92400E;
}

/* ============================================================
   Dashboard KPI cards + supporting blocks
   ============================================================ */
.ev-kpi-card {
    background: var(--ev-surface);
    border: 1px solid var(--ev-border);
    border-radius: var(--ev-radius-lg);
    padding: 1.25rem 1.25rem;
    box-shadow: var(--ev-shadow-card);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: 100%;
}
.ev-kpi-label {
    font-size: 0.8rem;
    color: var(--ev-text-muted);
    font-weight: 500;
    letter-spacing: 0.01em;
}
.ev-kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--ev-text-dark);
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.ev-kpi-sub {
    font-size: 0.82rem;
    color: var(--ev-text-muted);
}
.ev-kpi-delta {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ev-success);
}
.ev-kpi-delta.down {
    color: var(--ev-danger);
}
.ev-kpi-bar {
    height: 6px;
    background: var(--ev-border);
    border-radius: 999px;
    overflow: hidden;
}
.ev-kpi-bar-fill {
    height: 100%;
    background: var(--ev-gradient);
    border-radius: 999px;
}

.ev-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ev-text-dark);
    margin: 0 0 0.75rem;
}

.ev-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.ev-list-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--ev-border);
}
.ev-list-item:last-child {
    border-bottom: 0;
}
.ev-list-time {
    font-size: 0.8rem;
    color: var(--ev-text-muted);
    font-variant-numeric: tabular-nums;
    width: 90px;
    flex-shrink: 0;
}
.ev-list-primary {
    font-weight: 600;
    color: var(--ev-text-dark);
    font-size: 0.93rem;
}
.ev-list-secondary {
    font-size: 0.82rem;
    color: var(--ev-text-muted);
}
.ev-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--ev-primary-soft);
    color: var(--ev-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* ============================================================
   Tabs (e.g. /einstellungen/team: Mitglieder · Einladungen)
   ============================================================ */
.ev-tabs {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.25rem;
    background: var(--ev-border);
    border-radius: var(--ev-radius-md);
    margin-bottom: 1.5rem;
}
.ev-tab {
    background: transparent;
    border: 0;
    padding: 0.5rem 1rem;
    border-radius: var(--ev-radius-sm);
    color: var(--ev-text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.ev-tab:hover {
    color: var(--ev-text-dark);
}
.ev-tab.active {
    background: var(--ev-surface);
    color: var(--ev-primary);
    box-shadow: var(--ev-shadow-card);
}

.ev-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.ev-badge-primary { background: var(--ev-primary-soft); color: var(--ev-primary-deep); }
.ev-badge-success { background: rgba(16,185,129,0.12); color: #065F46; }
.ev-badge-warning { background: rgba(245,158,11,0.12); color: #92400E; }
.ev-badge-muted   { background: var(--ev-border); color: var(--ev-text-muted); }

/* ============================================================
   Empty-state (stub pages: /termine, /schuler, etc.)
   ============================================================ */
.ev-empty-state {
    text-align: center;
    padding: 4rem 1.5rem;
    max-width: 480px;
    margin: 0 auto;
}
.ev-empty-state-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--ev-radius-xl);
    background: var(--ev-primary-soft);
    color: var(--ev-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    margin-bottom: 1.25rem;
}
.ev-empty-state h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}
.ev-empty-state p {
    color: var(--ev-text-muted);
    font-size: 0.95rem;
}

/* ============================================================
   Blazor loading / error overlays
   ============================================================ */
.loading-progress {
    position: fixed;
    display: block;
    width: 8rem;
    height: 8rem;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.loading-progress circle {
    fill: none;
    stroke: var(--ev-border);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}
.loading-progress circle:last-child {
    stroke: var(--ev-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: 500;
    inset: calc(20% + 2rem) 0 auto 0.2rem;
    color: var(--ev-text-muted);
}
.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Laden...");
}

#blazor-error-ui {
    background: var(--ev-danger);
    color: #fff;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    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;
    color: #fff;
}

/* ═══════════════════════════════════════════
   ACTION SHEET (Bottom-Sheet auf Mobile)
   ═══════════════════════════════════════════ */

.ev-action-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    padding: 1rem;
}

.ev-action-sheet {
    background: var(--ev-surface);
    border-radius: var(--ev-radius-lg);
    max-width: 420px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
}

@media (max-width: 767px) {
    .ev-action-sheet-overlay {
        align-items: flex-end;
        padding: 0;
    }
    .ev-action-sheet {
        position: relative;
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        animation: ev-slide-up 0.25s ease-out;
    }
}

@keyframes ev-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.ev-action-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 8px;
    font-weight: 600;
    font-size: 1rem;
    color: var(--ev-text-dark, var(--ev-text));
}

.ev-action-sheet-close {
    background: none;
    border: none;
    color: var(--ev-text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    line-height: 1;
}

.ev-action-sheet-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 20px;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s;
    min-height: 56px;
}

.ev-action-sheet-item:hover {
    background: var(--ev-bg);
}

.ev-action-sheet-item:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ev-action-sheet-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 36px;
    text-align: center;
}

.ev-action-sheet-label {
    display: flex;
    flex-direction: column;
}

.ev-action-sheet-label-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--ev-text-dark, var(--ev-text));
}

.ev-action-sheet-label-desc {
    font-size: 0.8rem;
    color: var(--ev-text-muted);
}

/* ═══════════════════════════════════════════
   TIMELINE ENTRIES (Assets + Notizen)
   ═══════════════════════════════════════════ */

.ev-timeline-entry {
    background: var(--ev-surface);
    border: 1px solid var(--ev-border);
    border-radius: var(--ev-radius-md);
    padding: 14px 16px;
    margin-bottom: 10px;
}

.ev-timeline-entry-pinned {
    border-left: 3px solid var(--ev-primary);
}

.ev-timeline-entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

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

.ev-timeline-entry-actions {
    display: flex;
    gap: 4px;
}

.ev-timeline-action-btn {
    background: none;
    border: none;
    color: var(--ev-text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: color 0.15s, background 0.15s;
}

.ev-timeline-action-btn:hover {
    background: var(--ev-bg);
    color: var(--ev-text);
}

.ev-timeline-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--ev-text-muted);
}

/* ═══════════════════════════════════════════
   SESSION CARD (Einheit-Karte in Lernmappe)
   ═══════════════════════════════════════════ */

.ev-session-card {
    background: var(--ev-surface);
    border: 1px solid var(--ev-border);
    border-radius: var(--ev-radius-lg);
    margin-bottom: 1rem;
    overflow: hidden;
}

.ev-session-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.1s;
}

.ev-session-card-header:hover {
    background: var(--ev-bg);
}

.ev-session-card-body {
    padding: 0 1.25rem 1.25rem;
    border-top: 1px solid var(--ev-border);
}

.ev-session-status-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}

.ev-session-status-open {
    background: #f0f0f0;
    color: #666;
}

.ev-session-status-ok {
    background: #d1fae5;
    color: #065f46;
}

.ev-session-status-problem {
    background: #fee2e2;
    color: #991b1b;
}
