/* ===== EduKula — Minimal CSS ===== */

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

:root {
    --white: #FFFFFF;
    --black: #1A1A1A;
    --blue: #2563EB;
    --blue-hover: #1D4ED8;
    --red: #DC2626;
    --red-hover: #B91C1C;
    --orange: #F59E0B;
    --green: #16A34A;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --radius: 8px;
    --radius-lg: 12px;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--black);
    background: var(--gray-50);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Layout --- */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 0 1.25rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 0.75rem;
}

.sidebar-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--blue);
}

.sidebar-role {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.sidebar-nav {
    flex: 1;
    list-style: none;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.25rem;
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}

.sidebar-nav a:hover {
    background: var(--gray-100);
    color: var(--black);
    text-decoration: none;
}

.sidebar-nav a.active {
    background: var(--blue);
    color: var(--white);
}

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

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

.sidebar-footer .user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--black);
}

.sidebar-footer .logout-btn {
    font-size: 0.75rem;
    color: var(--gray-500);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0;
}

.sidebar-footer .logout-btn:hover {
    color: var(--red);
}

.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 1.5rem;
    max-width: 100%;
}

/* Mobile hamburger */
.hamburger {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 200;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.5rem;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--black);
    margin: 4px 0;
    transition: 0.3s;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 99;
}

@media (max-width: 768px) {
    .hamburger { display: block; }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 3.5rem 1rem 1rem;
    }
}

/* --- Page header --- */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--black);
}

.page-header p {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* --- Cards --- */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

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

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--blue);
    color: var(--white);
}
.btn-primary:hover:not(:disabled) {
    background: var(--blue-hover);
}

.btn-danger {
    background: var(--red);
    color: var(--white);
}
.btn-danger:hover:not(:disabled) {
    background: var(--red-hover);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--gray-300);
}

.btn-sm {
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    padding: 0.375rem 0.5rem;
}
.btn-ghost:hover {
    background: var(--gray-100);
}

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

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--black);
    transition: border-color 0.15s;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.form-check input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--blue);
}

.form-check label {
    font-size: 0.875rem;
    color: var(--gray-700);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* --- Tables --- */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

th {
    text-align: left;
    padding: 0.625rem 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

tr:hover td {
    background: var(--gray-50);
}

/* --- Status badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    white-space: nowrap;
}

.badge-ok {
    background: rgba(37, 99, 235, 0.1);
    color: var(--blue);
}

.badge-partial {
    background: rgba(245, 158, 11, 0.1);
    color: var(--orange);
}

.badge-bad {
    background: rgba(220, 38, 38, 0.1);
    color: var(--red);
}

.badge-success {
    background: rgba(22, 163, 74, 0.1);
    color: var(--green);
}

.badge-gray {
    background: var(--gray-100);
    color: var(--gray-500);
}

.badge-role-owner {
    background: rgba(37, 99, 235, 0.1);
    color: var(--blue);
}

.badge-role-mentor {
    background: rgba(22, 163, 74, 0.1);
    color: var(--green);
}

.badge-role-student {
    background: rgba(245, 158, 11, 0.1);
    color: var(--orange);
}

/* --- Modal --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--gray-400);
    padding: 0.25rem;
    line-height: 1;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--gray-200);
}

/* --- Filters bar --- */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: flex-end;
}

.filters-bar .form-group {
    margin-bottom: 0;
    min-width: 140px;
}

.filters-bar .form-label {
    font-size: 0.6875rem;
}

.filters-bar .form-input,
.filters-bar .form-select {
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
}

/* --- Progress indicators --- */
.progress-ring {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    position: relative;
}

.progress-text {
    font-size: 0.75rem;
    font-weight: 700;
}

/* --- Student module cards --- */
.module-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: box-shadow 0.15s;
}

.module-card:hover {
    box-shadow: var(--shadow-md);
}

.module-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.module-status-dot.not-started { background: var(--gray-300); }
.module-status-dot.completed   { background: var(--green); }
.module-status-dot.partial     { background: var(--orange); }

.module-card-info {
    flex: 1;
    min-width: 0;
}

.module-card-title {
    font-weight: 600;
    font-size: 0.9375rem;
}

.module-card-subtitle {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* --- Session screen (swipe cards) --- */
.session-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--gray-50);
    z-index: 500;
    display: none;
    flex-direction: column;
}

.session-screen.active {
    display: flex;
}

.session-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.session-progress {
    width: 100%;
    height: 4px;
    background: var(--gray-200);
    flex-shrink: 0;
}

.session-progress-bar {
    height: 100%;
    background: var(--blue);
    transition: width 0.3s ease;
}

.session-body {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.session-card {
    width: 100%;
    max-width: 600px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
    transition: transform 0.3s ease, opacity 0.3s ease;
    touch-action: pan-y;
}

.session-card.swiping-left {
    transform: translateX(-100px);
    opacity: 0.5;
}

.session-card-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: var(--gray-400);
    margin-bottom: 0.75rem;
}

.session-card-content {
    font-size: 1rem;
    line-height: 1.6;
}

.session-card-content p { margin-bottom: 0.75rem; }
.session-card-content ul, .session-card-content ol { margin-left: 1.25rem; margin-bottom: 0.75rem; }
.session-card-content strong { font-weight: 600; }
.session-card-content code { background: var(--gray-100); padding: 0.125rem 0.375rem; border-radius: 4px; font-size: 0.875rem; }

.session-footer {
    padding: 0.75rem 1rem;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.session-hint {
    text-align: center;
    padding: 0.5rem;
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* Evaluation buttons */
.eval-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1.5rem;
    border: 2px solid;
    border-radius: var(--radius-lg);
    background: var(--white);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: background 0.15s;
    min-width: 80px;
}

.eval-btn.eval-ok {
    border-color: var(--blue);
    color: var(--blue);
}
.eval-btn.eval-ok:hover, .eval-btn.eval-ok.selected {
    background: var(--blue);
    color: var(--white);
}

.eval-btn.eval-partial {
    border-color: var(--orange);
    color: var(--orange);
}
.eval-btn.eval-partial:hover, .eval-btn.eval-partial.selected {
    background: var(--orange);
    color: var(--white);
}

.eval-btn.eval-bad {
    border-color: var(--red);
    color: var(--red);
}
.eval-btn.eval-bad:hover, .eval-btn.eval-bad.selected {
    background: var(--red);
    color: var(--white);
}

/* --- Markdown preview --- */
.md-editor {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.md-preview {
    padding: 0.75rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    min-height: 80px;
    font-size: 0.875rem;
    line-height: 1.6;
}

.md-preview p { margin-bottom: 0.5rem; }
.md-preview ul, .md-preview ol { margin-left: 1.25rem; margin-bottom: 0.5rem; }
.md-preview strong { font-weight: 600; }
.md-preview em { font-style: italic; }
.md-preview code { background: var(--gray-200); padding: 0.125rem 0.375rem; border-radius: 4px; font-size: 0.8125rem; }

.md-tabs {
    display: flex;
    gap: 0.25rem;
}

.md-tab {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius) var(--radius) 0 0;
    cursor: pointer;
    color: var(--gray-500);
    font-weight: 500;
}

.md-tab.active {
    background: var(--white);
    color: var(--black);
    border: 1px solid var(--gray-200);
    border-bottom: 1px solid var(--white);
    margin-bottom: -1px;
}

/* --- Sort handle --- */
.sort-handle {
    cursor: grab;
    color: var(--gray-400);
    padding: 0.25rem;
    user-select: none;
}
.sort-handle:active { cursor: grabbing; }

/* --- Toast notifications --- */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-left: 4px solid var(--blue);
    animation: toast-in 0.3s ease;
    max-width: 360px;
}

.toast.toast-error { border-left-color: var(--red); }
.toast.toast-success { border-left-color: var(--green); }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(1rem); }
    to { opacity: 1; transform: translateX(0); }
}

/* --- Loading spinner --- */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* --- Empty state --- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-400);
}

.empty-state .empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.empty-state p {
    font-size: 0.875rem;
}

/* --- Login page --- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--gray-50);
    padding: 1rem;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    width: 100%;
    max-width: 380px;
}

.login-logo {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--blue);
    margin-bottom: 0.25rem;
}

.login-subtitle {
    text-align: center;
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.login-error {
    background: rgba(220, 38, 38, 0.1);
    color: var(--red);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    margin-bottom: 1rem;
    display: none;
}

/* --- Tabs --- */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 1.25rem;
}

.tab-btn {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-500);
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s;
}

.tab-btn:hover { color: var(--black); }

.tab-btn.active {
    color: var(--blue);
    border-bottom-color: var(--blue);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* --- Confirm dialog --- */
.confirm-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1100;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.confirm-overlay.open {
    display: flex;
}

.confirm-box {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    padding: 1.5rem;
    max-width: 380px;
    width: 100%;
    text-align: center;
}

.confirm-box p {
    margin-bottom: 1.25rem;
    font-size: 0.9375rem;
}

.confirm-box .btn-group {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* --- Utilities --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 0.8125rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.w-full { width: 100%; }
.hidden { display: none !important; }
