﻿/* ── CSS Variables ─────────────────────────────────────────── */
:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-bg: #eef2ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --sidebar-bg: #0f172a;
    --sidebar-w: 240px;
    --sidebar-w-col: 64px;
    --topbar-h: 60px;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --border-dark: #cbd5e1;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
    --shadow-md: 0 4px 24px rgba(0,0,0,.10);
    --transition: .18s ease;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Page Header ───────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

    .page-header > div {
        display: flex;
        flex-direction: column;
    }

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Title icon */
.title-icon svg {
    width: 22px;
    height: 22px;
    stroke: var(--primary);
}

/* ── Button ───────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    transition: transform var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    opacity: 0.95;
}

    .btn-primary:hover .btn-icon svg {
        transform: rotate(90deg) scale(1.1);
    }

.btn-primary:active {
    transform: translateY(0);
}

/* ── Class Grid ───────────────────────────────────────────── */
.class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* ── Card ─────────────────────────────────────────────────── */
.class-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

    .class-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-md);
    }

/* Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

    .card-header h3 {
        font-size: 16px;
        font-weight: 700;
    }

/* Badge */
.badge {
    background: var(--primary-bg);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Card Body */
.card-body p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

/* Actions */
.card-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

/* Edit Button */
.btn-edit {
    flex: 1;
    padding: 8px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}

    .btn-edit:hover {
        background: var(--primary-dark);
    }

/* Delete Button */
.btn-delete {
    flex: 1;
    padding: 8px;
    border-radius: var(--radius-sm);
    background: #fee2e2;
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}

    .btn-delete:hover {
        background: #fecaca;
    }

.btn-deleteModal {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: #fee2e2;
    color: var(--danger);
    font-weight: 600;
    transition: var(--transition);
}

    .btn-deleteModal:hover {
        background: #fecaca;
    }

/* ── Modal Overlay ───────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

/* ── Modal Card ─────────────────────────────────────────── */
.modal-card {
    width: 100%;
    max-width: 500px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    animation: modalFade 0.25s ease;
    max-height: 90vh;
    overflow: hidden;
}

/* Animation */
@keyframes modalFade {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Header ─────────────────────────────────────────────── */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

    .modal-header h2 {
        font-size: 20px;
        font-weight: 700;
    }

.modal-close {
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
}

/* ── Body ───────────────────────────────────────────────── */
.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    max-height: 60vh;
}

    .modal-body::-webkit-scrollbar {
        width: 6px;
    }

    .modal-body::-webkit-scrollbar-track {
        background: transparent;
    }

    .modal-body::-webkit-scrollbar-thumb {
        background: var(--border-dark);
        border-radius: 10px;
    }

/* Form */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

    .form-group label {
        font-size: 13px;
        font-weight: 600;
    }

.form-input {
    width: 100%; /* important */
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    font-size: 14px;
    background: var(--bg);
    transition: var(--transition);
}

    .form-input:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(99,102,241,.15);
        outline: none;
        background: #fff;
    }

/* ── Actions ────────────────────────────────────────────── */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

/* Secondary */
.btn-secondary {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: #f1f5f9;
    font-weight: 600;
}

    .btn-secondary:hover {
        background: #e2e8f0;
    }

/* ── Tablet Responsive ───────────────────────────────────── */
@media (max-width: 768px) {

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
    }
}

/* ── Mobile Responsive ───────────────────────────────────── */
@media (max-width: 480px) {

    .page-title {
        font-size: 20px;
    }

    .page-subtitle {
        font-size: 13px;
    }

    /* Floating Add Button */
    .btn-primary {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        padding: 0;
        justify-content: center;
        box-shadow: var(--shadow-md);
        z-index: 1000;
    }

    .additional-button {
        position: fixed;
        bottom: 80px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        padding: 0;
        justify-content: center;
        box-shadow: var(--shadow-md);
        z-index: 1000;
    }

    /* Icon only */
    .btn-primary span:not(.btn-icon) {
        display: none;
    }

    /* Prevent overlap */
    .class-grid {
        grid-template-columns: 1fr;
        padding-bottom: 80px;
    }

    .modal-card {
        max-width: 100%;
        border-radius: var(--radius);
    }

    .modal-actions {
        flex-direction: column;
    }

    .btn-secondary {
        width: 100%;
    }
}
