/* ═══════════════════════════════════════════════════════════════════
   EduPlatform — Main Stylesheet
   Apple-inspired design language: clean, light, refined
   ═══════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
    --color-bg:           #f5f5f7;
    --color-surface:      #ffffff;
    --color-surface-hover:#f0f0f2;
    --color-text:         #1d1d1f;
    --color-text-secondary:#6e6e73;
    --color-text-tertiary: #86868b;
    --color-accent:       #0071e3;
    --color-accent-hover: #0077ed;
    --color-accent-light: #e8f2fd;
    --color-border:       #d2d2d7;
    --color-border-light: #e8e8ed;
    --color-success:      #34c759;
    --color-warning:      #ff9500;
    --color-danger:       #ff3b30;
    --color-glass:        rgba(255,255,255,0.72);
    --color-glass-border: rgba(0,0,0,0.08);

    --shadow-sm:   0 1px 3px rgba(0,0,0,0.04);
    --shadow-md:   0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg:   0 8px 30px rgba(0,0,0,0.08);
    --shadow-xl:   0 20px 60px rgba(0,0,0,0.10);
    --shadow-card-hover: 0 12px 40px rgba(0,0,0,0.12);

    --radius-sm:   8px;
    --radius-md:   14px;
    --radius-lg:   20px;
    --radius-xl:   28px;
    --radius-full: 9999px;

    --font-sans:   'Inter', 'PingFang HK', 'SF Pro Text', 'SF Pro Icons',
                   'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
    --font-mono:   'SF Mono', 'Fira Code', 'Fira Mono', 'Menlo', monospace;

    --transition-fast:   0.15s cubic-bezier(0.25, 0.1, 0.25, 1);
    --transition-normal: 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition-smooth: 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);

    --blur-nav:    saturate(180%) blur(20px);
    --blur-modal:  saturate(200%) blur(30px);
}

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

html {
    font-size: 106.25%; /* 17px base — matches Apple */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    overflow-x: hidden;
}

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

img { max-width: 100%; height: auto; display: block; }

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

ul, ol { list-style: none; }

/* ── Typography ── */
h1 { font-size: 2.8rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
h2 { font-size: 2.2rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
h3 { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.005em; line-height: 1.25; }
h4 { font-size: 1.2rem; font-weight: 600; line-height: 1.3; }

.text-secondary { color: var(--color-text-secondary); }
.text-tertiary  { color: var(--color-text-tertiary); }
.text-accent    { color: var(--color-accent); }
.text-center    { text-align: center; }
.text-sm        { font-size: 0.85rem; }
.text-lg        { font-size: 1.15rem; }

/* ── Layout ── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Glass Navigation Bar ── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--color-glass);
    backdrop-filter: var(--blur-nav);
    -webkit-backdrop-filter: var(--blur-nav);
    border-bottom: 1px solid var(--color-glass-border);
    transition: all var(--transition-normal);
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: var(--color-text);
}
.navbar-brand img { height: 26px; width: auto; }
.navbar-brand span {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-nav a, .navbar-nav button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--color-text);
    transition: all var(--transition-fast);
}
.navbar-nav a:hover, .navbar-nav button:hover {
    background: rgba(0,0,0,0.05);
    color: var(--color-text);
}
.navbar-nav a.active {
    background: rgba(0,0,0,0.06);
    color: var(--color-accent);
}

.navbar-lang {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}
.navbar-lang a {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
}
.navbar-lang a.active-lang {
    color: var(--color-accent);
    font-weight: 600;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
}

.navbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: var(--color-accent-light);
    color: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    transition: all var(--transition-spring);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--color-accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,113,227,0.3);
}
.btn-primary:hover {
    background: #0077ed;
    box-shadow: 0 4px 16px rgba(0,113,227,0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}
.btn-secondary:hover {
    background: var(--color-surface-hover);
    border-color: #b0b0b8;
}

.btn-ghost {
    background: transparent;
    color: var(--color-accent);
}
.btn-ghost:hover { background: var(--color-accent-light); }

.btn-danger {
    background: var(--color-danger);
    color: #fff;
}
.btn-danger:hover { background: #e0352b; }

.btn-sm  { padding: 8px 16px; font-size: 0.82rem; }
.btn-lg  { padding: 16px 36px; font-size: 1.05rem; }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: var(--radius-full); }

/* ── Cards ── */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
    padding: 2rem;
    transition: all var(--transition-normal);
}
.card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

.card-glass {
    background: var(--color-glass);
    backdrop-filter: var(--blur-nav);
    -webkit-backdrop-filter: var(--blur-nav);
    border: 1px solid var(--color-glass-border);
}

.card-clickable {
    cursor: pointer;
}

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

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

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--color-text);
    background: var(--color-surface);
    transition: all var(--transition-fast);
    outline: none;
}
.form-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(0,113,227,0.12);
}
.form-input::placeholder {
    color: var(--color-text-tertiary);
}

.form-input-icon {
    position: relative;
}
.form-input-icon .icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-tertiary);
    font-size: 1.1rem;
}
.form-input-icon input {
    padding-left: 44px;
}

.form-error {
    font-size: 0.8rem;
    color: var(--color-danger);
    margin-top: 0.3rem;
}

/* ── Animations ── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

.animate-in {
    animation: fadeInUp 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

/* Stagger children animations */
.stagger > * {
    opacity: 0;
    animation: fadeInUp 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }
.stagger > *:nth-child(7) { animation-delay: 0.35s; }
.stagger > *:nth-child(8) { animation-delay: 0.4s; }
.stagger > *:nth-child(9) { animation-delay: 0.45s; }
.stagger > *:nth-child(10){ animation-delay: 0.5s; }

/* ── Loading Skeleton ── */
.skeleton {
    background: linear-gradient(90deg, #e8e8ed 25%, #f0f0f2 50%, #e8e8ed 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

/* ── Badge / Tag ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.badge-success { background: #e8f8ed; color: #1a7f3a; }
.badge-warning { background: #fff3e0; color: #b05d00; }
.badge-danger  { background: #ffeaea; color: #c4281b; }
.badge-info    { background: var(--color-accent-light); color: var(--color-accent); }

/* ── Modal / Dialog ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}
.modal {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: fadeInScale 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.modal-header h3 { font-size: 1.3rem; }
.modal-close {
    width: 32px; height: 32px;
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    color: var(--color-text-tertiary);
    font-size: 1.3rem;
    transition: all var(--transition-fast);
}
.modal-close:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

/* ── Table ── */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
}

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

thead th {
    text-align: left;
    padding: 14px 20px;
    font-weight: 600;
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--color-border-light);
    background: #fafafc;
    white-space: nowrap;
}

tbody td {
    padding: 14px 20px;
    border-bottom: 1px solid #f0f0f2;
    vertical-align: middle;
}

tbody tr {
    transition: background var(--transition-fast);
}
tbody tr:hover { background: #fafafc; }
tbody tr:last-child td { border-bottom: none; }

/* ── Toast / Notification ── */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    animation: fadeInUp 0.3s ease-out;
    border-left: 4px solid var(--color-accent);
}
.toast-success { border-left-color: var(--color-success); }
.toast-error   { border-left-color: var(--color-danger); }
.toast-warning { border-left-color: var(--color-warning); }

/* ── Responsive ── */
@media (max-width: 768px) {
    html { font-size: 100%; }
    .container { padding: 0 1rem; }
    h1 { font-size: 2rem; }
    h2 { font-size: 1.6rem; }
    h3 { font-size: 1.3rem; }
    .navbar-inner { padding: 0 1rem; }
    .modal { padding: 1.5rem; width: 95%; }
}

/* ── Utility ── */
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); border: 0;
}
.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.mt-2  { margin-top: 0.5rem; }
.mt-4  { margin-top: 1rem; }
.mt-6  { margin-top: 1.5rem; }
.mt-8  { margin-top: 2rem; }
.mb-4  { margin-bottom: 1rem; }
.mb-6  { margin-bottom: 1.5rem; }
.mb-8  { margin-bottom: 2rem; }
