/* ── Reset & Base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f0f2f5; color: #2c3e50; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ── Layout ───────────────────────────────────────── */
.wrap { max-width: 960px; margin: 0 auto; padding: 1.5rem 1rem; }

/* ── Cards ────────────────────────────────────────── */
.card { background: white; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); padding: 1.5rem; margin-bottom: 1.25rem; }

/* ── Buttons ──────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .6rem 1.2rem; border-radius: 8px; font-weight: 600; font-size: .9rem; cursor: pointer; border: none; transition: all .2s; text-decoration: none; }
.btn-primary   { background: #667eea; color: #fff; }
.btn-primary:hover { background: #5a6fd6; transform: translateY(-1px); }
.btn-success   { background: #27ae60; color: #fff; }
.btn-success:hover { background: #219a52; }
.btn-danger    { background: #e74c3c; color: #fff; }
.btn-danger:hover  { background: #c0392b; }
.btn-secondary { background: #95a5a6; color: #fff; }
.btn-sm { padding: .35rem .7rem; font-size: .82rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Forms ────────────────────────────────────────── */
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .35rem; color: #2c3e50; }
.form-control { width: 100%; padding: .7rem 1rem; border: 2px solid #e2e8f0; border-radius: 8px; font-size: .95rem; font-family: inherit; transition: border-color .2s; }
.form-control:focus { outline: none; border-color: #667eea; }
textarea.form-control { min-height: 80px; resize: vertical; }

/* ── Alerts ───────────────────────────────────────── */
.alert { padding: .85rem 1.2rem; border-radius: 8px; margin-bottom: 1.25rem; font-weight: 600; font-size: .92rem; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ── Tables ───────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { background: #f8f9fa; padding: .65rem 1rem; text-align: left; font-size: .82rem; color: #6c757d; border-bottom: 2px solid #dee2e6; white-space: nowrap; }
.table td { padding: .7rem 1rem; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.table tr:hover td { background: #fafafa; }

/* ── Progress bar ─────────────────────────────────── */
.progress-wrap { background: #e9ecef; border-radius: 10px; height: 8px; }
.progress-fill { height: 8px; border-radius: 10px; background: linear-gradient(90deg,#667eea,#764ba2); transition: width .5s; }

/* ── Tabs ─────────────────────────────────────────── */
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; border-bottom: 2px solid #e2e8f0; margin-bottom: 1.5rem; padding-bottom: 0; }
.tab-btn { padding: .55rem 1.1rem; background: none; border: none; border-bottom: 3px solid transparent; margin-bottom: -2px; font-size: .9rem; font-weight: 600; color: #6c757d; cursor: pointer; transition: all .2s; white-space: nowrap; }
.tab-btn:hover { color: #2c3e50; }
.tab-btn.active { color: #667eea; border-bottom-color: #667eea; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Badges ───────────────────────────────────────── */
.badge { display: inline-block; padding: .15rem .5rem; border-radius: 10px; font-size: .72rem; font-weight: 700; }
.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger  { background: #f8d7da; color: #721c24; }

/* ── Hero ─────────────────────────────────────────── */
.hero { background: linear-gradient(135deg,#667eea,#764ba2); color: white; border-radius: 14px; padding: 1.75rem 2rem; margin-bottom: 1.75rem; }
.hero h1 { font-size: 1.7rem; margin-bottom: .25rem; }
.hero p { opacity: .9; margin: 0; }

/* ── Utility ──────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: #6c757d; font-size: .88rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.flex { display: flex; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* ── Admin layout ─────────────────────────────────── */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 230px; background: #1e2a38; color: #ecf0f1; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; z-index: 100; }
.admin-main { margin-left: 230px; flex: 1; padding: 2rem; background: #f0f2f5; min-height: 100vh; }
.sidebar-logo { display: flex; align-items: center; gap: .5rem; padding: 1.25rem 1rem; font-size: 1.15rem; font-weight: 700; color: white; border-bottom: 1px solid rgba(255,255,255,.1); text-decoration: none; }
.sidebar-logo:hover { color: #667eea; }
.sidebar-nav { flex: 1; padding: .75rem 0; }
.nav-group-title { padding: .4rem 1rem; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #7f8c8d; margin-top: .5rem; }
.nav-link { display: flex; align-items: center; gap: .55rem; padding: .6rem 1rem .6rem 1.5rem; color: #bdc3c7; font-size: .88rem; text-decoration: none; transition: all .2s; border-left: 3px solid transparent; }
.nav-link:hover { background: rgba(255,255,255,.05); color: white; }
.nav-link.active { background: rgba(102,126,234,.2); border-left-color: #667eea; color: white; font-weight: 600; }
.nav-badge { background: #e74c3c; color: white; border-radius: 10px; padding: .1rem .45rem; font-size: .7rem; margin-left: auto; }
.sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-user { font-size: .85rem; color: #bdc3c7; padding: .5rem; background: rgba(255,255,255,.05); border-radius: 6px; margin-bottom: .5rem; }
.btn-logout { display: block; width: 100%; padding: .55rem; background: #e74c3c; color: white; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; text-align: center; font-size: .85rem; text-decoration: none; transition: background .2s; }
.btn-logout:hover { background: #c0392b; }
.page-header { background: white; padding: 1.5rem 2rem; border-radius: 10px; box-shadow: 0 2px 4px rgba(0,0,0,.08); margin-bottom: 1.75rem; }
.page-header h1 { font-size: 1.6rem; color: #2c3e50; }
.page-header p { color: #7f8c8d; margin-top: .25rem; font-size: .9rem; }

/* ── Quiz / Drag-Drop ─────────────────────────────── */
.quiz-question { font-size: 1.3rem; font-weight: 700; text-align: center; padding: 1.5rem; color: #2c3e50; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1rem; }
.quiz-option { padding: .85rem 1rem; border: 2px solid #e2e8f0; border-radius: 10px; background: white; cursor: pointer; font-size: .95rem; font-weight: 500; text-align: center; transition: all .2s; }
.quiz-option:hover:not(:disabled) { border-color: #667eea; background: #f0f2ff; }
.quiz-option.correct   { border-color: #27ae60; background: #eafaf1; color: #1e8449; }
.quiz-option.wrong     { border-color: #e74c3c; background: #fef9f9; color: #c0392b; }
.quiz-option:disabled  { cursor: not-allowed; }
.quiz-progress { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; font-size: .88rem; color: #6c757d; }
.group-btns { display: flex; gap: .65rem; flex-wrap: wrap; }
.group-btn { padding: .65rem 1rem; border: 2px solid #667eea; background: #eef0fd; color: #5a6fd6; border-radius: 9px; cursor: pointer; font-size: .88rem; font-weight: 600; transition: all .2s; position: relative; }
.group-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(102,126,234,.3); }
.group-btn.done { border-color: #27ae60; background: #eafaf1; color: #27ae60; }
.group-btn.done::after { content: '✓'; position: absolute; top: -8px; right: -8px; width: 18px; height: 18px; background: #27ae60; color: white; border-radius: 50%; border: 2px solid white; display: flex; align-items: center; justify-content: center; font-size: .6rem; }

/* DD */
.dd-pairs { display: grid; gap: .6rem; }
.dd-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; align-items: center; }
.dd-word { padding: .65rem 1rem; background: #f8f9fa; border: 2px solid #e2e8f0; border-radius: 8px; font-weight: 600; text-align: center; }
.dd-drop { padding: .65rem 1rem; border: 2px dashed #ced4da; border-radius: 8px; min-height: 42px; text-align: center; transition: all .2s; }
.dd-drop.over { border-color: #667eea; background: #eef0fd; }
.dd-drop.correct { border-color: #27ae60; background: #eafaf1; border-style: solid; }
.dd-drop.wrong   { border-color: #e74c3c; background: #fef9f9; border-style: solid; }
.dd-options { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; padding: .75rem; background: #f8f9fa; border-radius: 8px; }
.dd-chip { padding: .45rem .9rem; background: white; border: 2px solid #dee2e6; border-radius: 20px; cursor: grab; font-size: .9rem; user-select: none; transition: all .2s; }
.dd-chip:hover { border-color: #667eea; background: #eef0fd; }
.dd-chip.dragging { opacity: .5; }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 768px) {
    .admin-sidebar { transform: translateX(-230px); transition: transform .3s; }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; padding: 1rem; }
    .quiz-options { grid-template-columns: 1fr; }
    .dd-row { grid-template-columns: 1fr; }
}
