@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
    /* Refined Color Palette - Minimalist */
    --primary-dark: #0f172a;
    --primary: #1e3a5f;
    --primary-light: #2d5080;
    --accent: #00d9ff;
    --accent-dark: #00b8d4;
    --neutral-bg: #f8fafc;
    --neutral-light: #f1f5f9;
    --neutral-text: #334155;
    --neutral-muted: #64748b;
    --border: #e2e8f0;

    /* Gradients - Minimal */
    --gradient-subtle: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    --gradient-accent: linear-gradient(135deg, #00d9ff 0%, #00b8d4 100%);

    /* Spacing & Sizing */
    --card-radius: 16px;
    --button-radius: 10px;

    /* Shadows - Refined */
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.12);
    --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.15);
    --shadow-xl: 0 12px 40px rgba(15, 23, 42, 0.2);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--neutral-bg);
    color: var(--neutral-text);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============ TYPOGRAPHY ============ */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--primary-dark);
}

h1 {
    font-size: 2.25rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}

h2 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

p {
    color: var(--neutral-text);
    font-weight: 400;
    font-size: 0.95rem;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
    font-weight: 500;
}

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

/* ============ NAVBAR ============ */
.navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    box-shadow: var(--shadow-sm);
}

/* ============ PUBLIC NAVBAR ============ */
.main-nav {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    border-bottom: 3px solid #00d9ff;
    padding: 1rem 0;
}
.main-nav .navbar-brand {
    color: white !important;
    font-weight: 700;
}
.main-nav .navbar-brand i {
    color: #00d9ff;
}

/* ============ ADMIN NAVBAR ============ */
.admin-nav {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    border-bottom: 3px solid #00d9ff;
    padding: 1rem 0;
}
.admin-nav .navbar-brand {
    color: white !important;
    font-weight: 700;
}
.admin-nav .navbar-brand i {
    color: #00d9ff;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand i {
    color: var(--accent);
    font-size: 1.5rem;
}

/* ============ CARDS ============ */
.card {
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

.card-body {
    padding: 1.5rem;
}

/* ============ SUBJECT CARDS ============ */
.subject-card {
    cursor: pointer;
    position: relative;
    overflow: visible;
}

.subject-card::after {
    content: '';
    position: absolute;
    top: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: transparent;
    transition: background var(--transition);
}

.subject-card:hover::after {
    background: var(--accent);
}

.subject-color-bar {
    height: 3px;
    width: 100%;
    background: var(--accent);
    opacity: 0.6;
}

.subject-icon {
    font-size: 1.75rem;
    color: var(--primary);
    transition: all var(--transition);
}

.subject-card:hover .subject-icon {
    transform: scale(1.15);
    color: var(--accent);
}

/* ============ BADGES ============ */
.badge {
    border-radius: 8px;
    padding: 0.35rem 0.75rem;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: var(--accent);
    color: var(--primary-dark);
    box-shadow: var(--shadow-sm);
}

.badge-warning {
    background: #fbbf24;
    color: var(--primary-dark);
}

.badge-secondary {
    background: var(--neutral-light);
    color: var(--neutral-muted);
}

.badge-success {
    background: #10b981;
    color: white;
}

.badge-info {
    background: var(--accent);
    color: var(--primary-dark);
}

/* ============ TIMELINE ============ */
.timeline-card {
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--card-radius) var(--card-radius) 0;
    background: #ffffff;
    position: relative;
}

.timeline-card::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 1.5rem;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid var(--accent);
}

.date-badge {
    background: var(--primary-dark);
    color: var(--accent);
    border-radius: 10px;
    padding: 0.65rem 0.85rem;
    text-align: center;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    min-width: 65px;
}

.date-badge > div:first-child {
    font-size: 1.35rem;
}

.date-badge > div:last-child {
    font-size: 0.65rem;
    opacity: 0.85;
}

/* ============ SUMMARY CONTENT ============ */
.summary-content {
    line-height: 1.85;
}

.summary-content h1,
.summary-content h2,
.summary-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-dark);
}

.summary-content p {
    margin-bottom: 1rem;
    color: var(--neutral-text);
}

.summary-content strong {
    color: var(--primary-dark);
    font-weight: 600;
}

.summary-content code {
    background: var(--neutral-light);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 0.85em;
    font-weight: 500;
    font-family: 'Space Mono', monospace;
}

.summary-content pre {
    background: var(--primary-dark);
    color: var(--accent);
    border-radius: 12px;
    padding: 1.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
}

.summary-content pre code {
    background: none;
    color: var(--accent);
    padding: 0;
}

.summary-content ul,
.summary-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.summary-content li {
    margin-bottom: 0.5rem;
    color: var(--neutral-text);
}

.summary-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1.25rem;
    margin: 1.5rem 0;
    color: var(--neutral-muted);
    font-style: italic;
}

.summary-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.summary-content th,
.summary-content td {
    padding: 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.summary-content th {
    background: var(--primary-dark);
    color: var(--accent);
    font-weight: 600;
}

.summary-content tr:hover {
    background: var(--neutral-light);
}

/* ============ BUTTONS ============ */
.btn {
    border: none;
    border-radius: var(--button-radius);
    font-weight: 600;
    padding: 0.65rem 1.25rem;
    transition: all var(--transition-fast);
    font-family: 'Sora', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

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

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

.btn-success {
    background: #10b981;
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover {
    background: #059669;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-danger {
    background: #ef4444;
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-outline-secondary {
    border: 1.5px solid var(--border);
    color: var(--neutral-text);
    background: transparent;
}

.btn-outline-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(0, 217, 255, 0.05);
}

.btn-outline-light {
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    color: white;
    background: transparent;
}

.btn-outline-light:hover {
    border-color: white;
    background: rgba(255, 255, 255, 0.1);
}

/* ============ FORMS ============ */
.form-control,
.form-select {
    border: 1.5px solid var(--border);
    border-radius: var(--button-radius);
    padding: 0.65rem 0.85rem;
    font-family: 'Sora', sans-serif;
    background: #ffffff;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
    background: #ffffff;
}

.form-label {
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ============ EXAM FULLSCREEN MODE ============ */
body.exam-mode .navbar,
body.exam-mode .sidebar {
    display: none;
}

body.exam-mode .app-layout {
    height: 100vh;
}

.exam-back-btn {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 900;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    border: 2px solid var(--border);
    border-radius: var(--button-radius);
    padding: 0.45rem 1rem;
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.exam-back-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: var(--shadow-md);
}

/* ============ CHAT ============ */
.chat-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    width: 420px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.chat-container.chat-collapsed .chat-messages,
.chat-container.chat-collapsed .chat-input-area {
    display: none;
}

.chat-header {
    background: var(--primary-dark);
    color: white;
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
    padding: 1rem;
    border-bottom: 2px solid var(--accent);
}

.chat-collapsed .chat-header {
    border-radius: 16px;
    border-bottom: none;
}

.chat-header .fw-bold {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-header i {
    color: var(--accent);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    height: 440px;
}

.message {
    max-width: 85%;
    padding: 0.7rem 0.95rem;
    border-radius: 12px;
    font-size: 0.85rem;
    word-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.4;
}

.message-user {
    background: var(--primary-dark);
    color: white;
    align-self: flex-end;
    border-radius: 12px 12px 2px 12px;
}

.message-ai {
    background: var(--neutral-light);
    color: var(--neutral-text);
    align-self: flex-start;
    border-radius: 12px 12px 12px 2px;
}

.chat-input-area {
    flex-shrink: 0;
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.chat-input-area .input-group {
    gap: 0.5rem;
}

.chat-input-area .btn {
    padding: 0.65rem 0.85rem;
    min-width: 40px;
}

/* ============ ALERTS ============ */
.alert {
    border: 1px solid;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    font-weight: 500;
}

.alert-info {
    background: rgba(0, 217, 255, 0.08);
    border-color: var(--accent);
    color: var(--primary);
}

.alert-success {
    background: rgba(16, 185, 129, 0.08);
    border-color: #10b981;
    color: #059669;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: #ef4444;
    color: #dc2626;
}

.alert-warning {
    background: rgba(251, 191, 36, 0.08);
    border-color: #fbbf24;
    color: #b45309;
}

/* ============ MODALS ============ */
.modal-content {
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    background: #ffffff;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1.5rem;
    background: var(--neutral-light);
}

.modal-title {
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    color: var(--primary-dark);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    background: var(--neutral-light);
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--primary-dark);
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.btn-close:hover {
    opacity: 1;
}

/* ============ TABLES ============ */
.table {
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table thead {
    background: var(--primary-dark);
    color: var(--accent);
}

.table th {
    font-weight: 600;
    padding: 1rem;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

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

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

.table-light {
    background: transparent;
}

/* ============ SPINNERS ============ */
.spinner-border {
    border-color: var(--border) !important;
    border-right-color: var(--accent) !important;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============ BREADCRUMB ============ */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1.5rem;
}

.breadcrumb-item {
    color: var(--neutral-muted);
}

.breadcrumb-item.active {
    color: var(--primary-dark);
    font-weight: 600;
}

.breadcrumb-item a {
    color: var(--accent);
}

.breadcrumb-item a:hover {
    color: var(--accent-dark);
}

/* ============ ANIMATIONS ============ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============ UTILITY CLASSES ============ */
.text-primary {
    color: var(--primary) !important;
}

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

.bg-light {
    background: var(--neutral-light) !important;
}

.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.min-vh-100 {
    min-height: 100vh;
}

/* ============ EXAM TYPE BADGES ============ */
.badge-type-klassenarbeit { background: #1e3a5f; color: white; }
.badge-type-pruefung      { background: #dc3545; color: white; }
.badge-type-projektarbeit { background: #198754; color: white; }
.badge-type-praesentation { background: #7c3aed; color: white; }

/* ============ SIDEBAR LAYOUT ============ */
.app-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.sidebar {
    width: 220px;
    background: linear-gradient(180deg, #0f172a 0%, #1a2f4a 100%);
    border-right: 1px solid rgba(0, 217, 255, 0.12);
    flex-shrink: 0;
    padding: 1.5rem 0;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 150ms;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    color: white;
    background: rgba(0, 217, 255, 0.08);
    border-left-color: rgba(0, 217, 255, 0.4);
}

.sidebar-link.active {
    color: #00d9ff;
    background: rgba(0, 217, 255, 0.1);
    border-left-color: #00d9ff;
}

.sidebar-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 2rem;
    overflow-y: auto;
    height: 100%;
}

/* ============ PAGE TITLES ============ */
.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2rem;
    position: relative;
    padding-bottom: 1rem;
}
.page-title::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 80px; height: 4px;
    background: #00d9ff;
    border-radius: 2px;
}
.exams-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.75rem;
}
.exams-title::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 50px; height: 3px;
    background: #00d9ff;
    border-radius: 2px;
}
.month-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    margin: 1.5rem 0 0.75rem;
}
.month-label:first-child { margin-top: 0; }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.35rem;
    }

    .chat-container {
        width: 100%;
        right: 0;
        left: 0;
        border-radius: 16px 16px 0 0;
    }

    .container {
        padding: 1rem;
    }

    .card-body {
        padding: 1.25rem;
    }
}

@media (max-width: 576px) {
    h1 {
        font-size: 1.5rem;
    }

    .container-fluid {
        padding: 1rem;
    }

    .summary-content {
        max-width: 100%;
    }

    .btn {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
    }
}
