/* ═══════════════════════════════════════════════════════
   AMS-School — Premium Design System
   ═══════════════════════════════════════════════════════ */

/* ── Typography ────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Sidebar ───────────────────────────────────────── */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    letter-spacing: 0.01em;
}

.dark .sidebar-link {
    color: #94a3b8;
}

.sidebar-link:hover {
    background-color: #f1f5f9;
    color: #0f172a;
    transform: translateX(2px);
}

.dark .sidebar-link:hover {
    background-color: rgba(51, 65, 85, 0.5);
    color: #f1f5f9;
}

.sidebar-link.active {
    background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
    color: #7C1010;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.1);
}

.dark .sidebar-link.active {
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.3) 0%, rgba(30, 64, 175, 0.2) 100%);
    color: #F87171;
    box-shadow: 0 1px 3px rgba(96, 165, 250, 0.1);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: #A01414;
    border-radius: 0 3px 3px 0;
}

.dark .sidebar-link.active::before {
    background: #F87171;
}

/* ── Cards ─────────────────────────────────────────── */
.card {
    background: white;
    border-radius: 0.875rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    padding: 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.02);
}

.dark .card {
    background: #1e293b;
    border-color: rgba(51, 65, 85, 0.6);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.dark .card:hover {
    border-color: rgba(71, 85, 105, 0.6);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* ── Data Tables ───────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 1;
}

.dark .data-table th {
    color: #64748b;
    border-bottom-color: #334155;
    background: #1e293b;
}

.data-table td {
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.dark .data-table td {
    border-bottom-color: rgba(51, 65, 85, 0.4);
    color: #cbd5e1;
}

.data-table tbody tr {
    transition: background-color 0.15s ease;
}

.data-table tbody tr:hover td {
    background-color: #f8fafc;
}

.dark .data-table tbody tr:hover td {
    background-color: rgba(30, 41, 59, 0.5);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ── Buttons ───────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, #A01414 0%, #7C1010 100%);
    color: white;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3), 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #7C1010 0%, #5C0A0A 100%);
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3), 0 2px 4px rgba(37, 99, 235, 0.2);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: white;
    color: #475569;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.dark .btn-secondary {
    background: #334155;
    color: #e2e8f0;
    border-color: #475569;
    box-shadow: none;
}

.dark .btn-secondary:hover {
    background: #3b4f6b;
    border-color: #64748b;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

/* ── Form Inputs ───────────────────────────────────── */
.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    background: white;
    color: #1e293b;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.dark .form-input {
    background: #1e293b;
    border-color: #475569;
    color: #f1f5f9;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.form-input:hover {
    border-color: #cbd5e1;
}

.dark .form-input:hover {
    border-color: #64748b;
}

.form-input:focus {
    outline: none;
    border-color: #A01414;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.dark .form-input:focus {
    border-color: #F87171;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

.form-input::placeholder {
    color: #94a3b8;
}

.form-label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #475569;
    letter-spacing: 0.01em;
}

.dark .form-label {
    color: #cbd5e1;
}

/* ── Scrollbar ─────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb {
    background: #475569;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* ── Badges / Status pills ─────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* ── Page transitions ──────────────────────────────── */
main {
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Flash messages ────────────────────────────────── */
.flash-message {
    animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ── Selection ─────────────────────────────────────── */
::selection {
    background: rgba(37, 99, 235, 0.15);
    color: inherit;
}

/* ── Focus visible (keyboard only) ─────────────────── */
:focus-visible {
    outline: 2px solid #A01414;
    outline-offset: 2px;
    border-radius: 0.25rem;
}

/* ── Checkbox / Radio polish ───────────────────────── */
input[type="checkbox"],
input[type="radio"] {
    accent-color: #A01414;
}

/* ── Reduced motion ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Print ─────────────────────────────────────────── */
@media print {
    aside, header, nav, .btn, .sidebar-link { display: none !important; }
    .card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
    main { margin: 0 !important; padding: 0.5in !important; }
}
