/* EduGenixAI Shared Design System */

@import url('/fonts/fonts.css');

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

:root {
    /* Backgrounds */
    --bg: #FAF8F5;
    --surface: #FFFFFF;
    --surface-2: #F5F3EF;
    --surface-3: #EEEAE3;
    /* Borders */
    --border: #E4DDD3;
    --border-strong: #C9C0B4;
    --border-focus: #6366F1;
    /* Text */
    --ink: #1A1523;
    --ink-2: #4A4558;
    --ink-3: #9591A4;
    --ink-inv: #FFFFFF;
    /* Primary — Deep Indigo */
    --blue: #4F46E5;
    --blue-light: #EEF2FF;
    --blue-mid: #C7D2FE;
    --blue-dark: #3730A3;
    --blue-glow: rgba(79,70,229,0.15);
    /* Secondary — Saffron/Amber */
    --amber: #D4700A;
    --amber-light: #FFF7ED;
    --amber-mid: #FED7AA;
    --amber-dark: #B45309;
    /* Success — Jade Green */
    --green: #0F9B6E;
    --green-light: #ECFDF5;
    --green-mid: #A7F3D0;
    /* Danger — Rose */
    --red: #DC2153;
    --red-light: #FFF1F4;
    --red-mid: #FECDD3;
    /* Accent extras */
    --purple: #7C3AED;
    --purple-light: #F5F3FF;
    --teal: #0D9488;
    --teal-light: #F0FDFA;

    /* Spacing */
    --space-4: 4px;
    --space-8: 8px;
    --space-12: 12px;
    --space-16: 16px;
    --space-20: 20px;
    --space-24: 24px;
    --space-32: 32px;
    --space-48: 48px;

    /* Border Radius */
    --r-sm: 6px;
    --r-md: 8px;
    --r-lg: 12px;
    --r-xl: 16px;

    /* Shadows (warm-tinted) */
    --s-1: 0 1px 3px rgba(26,21,35,0.07), 0 1px 2px rgba(26,21,35,0.04);
    --s-2: 0 4px 12px rgba(26,21,35,0.09), 0 2px 6px rgba(26,21,35,0.05);
    --s-3: 0 12px 40px rgba(26,21,35,0.13), 0 4px 16px rgba(26,21,35,0.07);
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'DM Sans', -apple-system, system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
}

/* Base Typography Scale */
h1 { font-size: 32px; letter-spacing: -0.02em; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
h4 { font-size: 16px; }

small { font-size: 13px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    font-family: inherit;
    font-weight: 500;
    font-size: 14px;
    border-radius: var(--r-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 150ms ease;
    text-decoration: none;
    gap: 8px;
    user-select: none;
}

.btn-primary {
    background: var(--blue);
    color: #FFF;
}
.btn-primary:hover { background: var(--blue-dark); }

.btn-ghost {
    background: #FFF;
    border-color: var(--border);
    color: var(--ink-2);
}
.btn-ghost:hover { border-color: var(--border-strong); background: var(--surface-2); }

.btn-danger {
    background: var(--red-light);
    color: var(--red);
    border: 1px solid var(--red-mid);
}
.btn-danger:hover { background: #ffe4e8; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 16px; min-height: 48px; }

.btn-icon {
    padding: 10px;
    width: 44px;
    height: 44px;
}

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

/* Form Fields */
.form-group {
    margin-bottom: var(--space-16);
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: var(--space-8);
    color: var(--ink-2);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: #FFF;
    transition: all 150ms ease;
    outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--blue-glow);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}
.table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-3);
    background: var(--surface-2);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.table thead th:first-child { border-radius: var(--r-md) 0 0 0; }
.table thead th:last-child { border-radius: 0 var(--r-md) 0 0; }
.table tbody td {
    padding: 14px 16px;
    color: var(--ink);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr { transition: background 120ms ease; }

/* Badges */
.badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-amber { background: var(--amber-light); color: var(--amber); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-gray { background: var(--surface-2); color: var(--ink-3); }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(26,21,35, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: #FFF;
    border-radius: var(--r-xl);
    width: 400px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--s-3);
    padding: var(--space-32);
    transform: translateY(20px);
    transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-wide { width: 640px; }
.modal.extra-wide { width: 800px; }

.modal-header { margin-bottom: var(--space-24); flex-shrink: 0; }
.modal-body { overflow-y: auto; flex: 1; min-height: 0; }
.modal-footer { margin-top: var(--space-32); display: flex; gap: 12px; justify-content: flex-end; flex-shrink: 0; }

/* Toast System */
.toast-container {
    position: fixed;
    bottom: var(--space-24);
    right: var(--space-24);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 2000;
}

.toast {
    min-width: 280px;
    padding: 16px 20px;
    border-radius: var(--r-lg);
    background: #FFF;
    color: var(--ink);
    box-shadow: var(--s-2);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    animation: slideInRight 250ms cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 4px solid var(--border);
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

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

/* Utils */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(26,21,35,0.1);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 800ms linear infinite;
}

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

.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--ink-3);
}

.shake {
    animation: shake 400ms cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }

/* Inline SVG Icon alignment */
.icon {
    display: inline-flex;
    vertical-align: middle;
    flex-shrink: 0;
}
