@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-glow: rgba(99,102,241,0.15);
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #f43f5e;
    --danger-light: #ffe4e6;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.07),0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.08),0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.08),0 8px 10px -6px rgba(0,0,0,0.04);
    --radius-sm: 8px;
    --radius: 14px;
    --radius-full: 9999px;
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.6;
}

/* Navbar */
.navbar {
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.02em;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.navbar-nav {
    display: flex;
    gap: 4px;
    list-style: none;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 4px;
}

.nav-link {
    padding: 0.4rem 1rem;
    border-radius: var(--radius-full);
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.nav-link:hover { color: var(--text); background: rgba(0,0,0,0.04); }
.nav-link.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

/* Layout */
.container { max-width: 960px; margin: 0 auto; padding: 2.5rem 1.5rem; }

.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 0.35rem; }
.page-header p { color: var(--text-secondary); font-size: 0.9rem; }

/* Card */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow);
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 3.5rem 2rem;
    text-align: center;
    transition: all 0.25s;
    cursor: pointer;
    background: linear-gradient(145deg,#fafbff,#f5f7ff);
    position: relative;
    overflow: hidden;
    margin-bottom: 0;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: linear-gradient(145deg,#f0f0ff,#ebebff);
}

.upload-icon-wrap {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary-glow), rgba(129,140,248,0.15));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
}

.upload-icon-wrap svg { width: 36px; height: 36px; stroke: var(--primary); }
.upload-zone h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.4rem; }
.upload-zone p { color: var(--text-muted); font-size: 0.85rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
    letter-spacing: -0.01em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 2px 8px var(--primary-glow),inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-light), var(--primary)); box-shadow: 0 4px 16px var(--primary-glow); transform: translateY(-1px); }

.btn-success { background: linear-gradient(135deg, var(--success), #059669); color: white; box-shadow: 0 2px 8px rgba(16,185,129,0.2); }
.btn-success:hover { background: linear-gradient(135deg, #34d399, var(--success)); transform: translateY(-1px); }

.btn-danger { background: linear-gradient(135deg, var(--danger), #e11d48); color: white; }
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(244,63,94,0.3); }

.btn-outline { background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary); box-shadow: var(--shadow-sm); }
.btn-outline:hover { background: var(--surface-2); color: var(--text); }

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

.btn-sm { padding: 0.38rem 0.75rem; font-size: 0.78rem; border-radius: 6px; }
.btn-lg { padding: 0.8rem 2.5rem; font-size: 0.95rem; }

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-weight: 600; margin-bottom: 0.5rem; font-size: 0.82rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }

.form-control {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: all 0.18s;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
textarea.form-control { resize: vertical; min-height: 80px; line-height: 1.6; }

/* Checkbox */
.checkbox-group { display: flex; flex-direction: column; gap: 0.5rem; }
.checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.18s;
    background: var(--surface);
}
.checkbox-item:hover { border-color: var(--primary-light); background: #fafaff; box-shadow: 0 0 0 3px var(--primary-glow); }
.checkbox-item input[type="checkbox"] { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--primary); flex-shrink: 0; }
.checkbox-item label { cursor: pointer; font-size: 0.88rem; line-height: 1.5; }
.checkbox-item label small { display: block; color: var(--text-muted); font-size: 0.78rem; margin-top: 2px; }

/* Radio */
.radio-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.radio-item { flex: 1; min-width: 110px; }
.radio-item input[type="radio"] { display: none; }
.radio-item label {
    display: block;
    padding: 0.65rem 0.75rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.18s;
    background: var(--surface);
    color: var(--text-secondary);
}
.radio-item input[type="radio"]:checked + label { border-color: var(--primary); background: linear-gradient(135deg,#f0f0ff,#ebebff); color: var(--primary-dark); box-shadow: 0 0 0 3px var(--primary-glow); font-weight: 600; }
.radio-item label:hover { border-color: var(--primary-light); color: var(--text); }

/* Question Card */
.question-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, transform 0.2s;
    overflow: hidden;
}
.question-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.question-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: linear-gradient(to right, var(--surface-2), var(--surface));
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.question-card-body { padding: 1.25rem; }

.question-number { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.q-num {
    width: 28px; height: 28px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.question-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
}
.badge-mc { background: #dbeafe; color: #1d4ed8; }
.badge-sa { background: #fef3c7; color: #b45309; }
.badge-chapter {
    background: var(--surface-2);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    font-size: 0.72rem;
    padding: 0.18rem 0.5rem;
    border-radius: var(--radius-full);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.question-actions { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }

/* Choices */
.choices-section { margin-bottom: 1rem; }
.choice-item { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.choice-num {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}
.alert-success { background: var(--success-light); color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: var(--danger-light); color: #9f1239; border: 1px solid #fecdd3; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: var(--warning-light); color: #78350f; border: 1px solid #fde68a; }

/* Stats */
.stats-bar { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.stat-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}
.stat-value { font-weight: 700; color: var(--primary); font-size: 1rem; }

/* Filter */
.filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow-sm);
}
.filter-label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* Empty state */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
.empty-icon {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--surface-2), #eef2ff);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    border: 1px solid var(--border);
}
.empty-icon svg { width: 32px; height: 32px; stroke: var(--text-muted); stroke-width: 1.5; }
.empty-state h3 { font-size: 1.05rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.35rem; }
.empty-state p { font-size: 0.875rem; }

/* Saved badge */
.saved-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    background: var(--success-light);
    color: #065f46;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(248,250,252,0.85);
    backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
.loading-text { margin-top: 1rem; color: var(--text-secondary); font-size: 0.875rem; font-weight: 500; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    z-index: 1001;
    animation: slideUp 0.3s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-lg);
    max-width: 320px;
}
.toast-success { background: linear-gradient(135deg, var(--success), #059669); }
.toast-error   { background: linear-gradient(135deg, var(--danger), #e11d48); }
@keyframes slideUp { from { transform: translateY(1rem); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Section title */
.section-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.75rem; }

/* Steps */
.steps { display: flex; flex-direction: column; gap: 0.85rem; margin-top: 0.5rem; }
.step { display: flex; gap: 0.9rem; align-items: flex-start; }
.step-num {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}
.step p { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.5; }

/* Demo banner */
.demo-banner {
    background: linear-gradient(135deg,#fffbeb,#fef3c7);
    border: 1px solid #fde68a;
    color: #78350f;
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .container { padding: 1.25rem 1rem; }
    .navbar { padding: 0 1rem; }
    .grid-2 { grid-template-columns: 1fr; }
    .radio-group { flex-direction: column; }
    .question-card-header { flex-direction: column; align-items: flex-start; }
    .stats-bar { flex-direction: column; }
    .navbar-nav { display: none; }
}
