/* =====================================================
   Anket Sistemi – Ana CSS
   ===================================================== */
:root {
    --primary:   #4f46e5;
    --primary-h: #4338ca;
    --success:   #22c55e;
    --danger:    #ef4444;
    --warning:   #f59e0b;
    --info:      #3b82f6;
    --dark:      #1e293b;
    --gray:      #64748b;
    --light:     #f1f5f9;
    --white:     #ffffff;
    --border:    #e2e8f0;
    --radius:    10px;
    --shadow:    0 4px 20px rgba(0,0,0,.08);
    --sidebar-w: 240px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── LOGIN ── */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}
.login-container { width: 100%; max-width: 400px; padding: 1rem; }
.login-card {
    background: var(--white);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-logo {
    text-align: center; margin-bottom: 2rem;
    color: var(--primary);
}
.login-logo svg { margin-bottom: .5rem; }
.login-logo h1 { font-size: 1.5rem; font-weight: 700; color: var(--dark); }

/* ── LAYOUT ── */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--dark);
    color: #cbd5e1;
    overflow-y: auto;
    z-index: 100;
    display: flex; flex-direction: column;
}
.sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #334155;
    display: flex; align-items: center; gap: .6rem;
}
.sidebar-brand span {
    font-size: 1rem; font-weight: 700; color: var(--white);
}
.sidebar-brand svg { color: var(--primary); flex-shrink: 0; }

.sidebar-nav { padding: 1rem 0; flex: 1; }
.nav-section-label {
    font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
    color: #475569; padding: .8rem 1.5rem .3rem;
}
.nav-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .6rem 1.5rem;
    color: #94a3b8;
    cursor: pointer; transition: all .15s;
    border-left: 3px solid transparent;
    font-size: .9rem;
}
.nav-item:hover, .nav-item.active {
    background: rgba(255,255,255,.07);
    color: var(--white);
    border-left-color: var(--primary);
    text-decoration: none;
}
.nav-item svg { flex-shrink: 0; }

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #334155;
    font-size: .8rem; color: #475569;
}
.sidebar-footer strong { display: block; color: #94a3b8; }

.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
}
.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: .85rem 1.75rem;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 50;
}
.topbar h2 { font-size: 1.1rem; font-weight: 600; color: var(--dark); }
.topbar-actions { display: flex; align-items: center; gap: .75rem; }

.page-content { padding: 1.75rem; }

/* ── BADGE ROLE ── */
.badge-role {
    display: inline-block; padding: .2em .6em; border-radius: 20px;
    font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.badge-supervisor { background: #ede9fe; color: #6d28d9; }
.badge-standard   { background: #dbeafe; color: #1d4ed8; }
.badge-viewer     { background: #dcfce7; color: #15803d; }

/* ── CARDS ── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}
.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    gap: .5rem;
}
.card-header h3 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.5rem; }

/* ── STAT CARDS ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 1rem;
}
.stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.orange { background: #ffedd5; color: #ea580c; }
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .8rem; color: var(--gray); margin-top: .2rem; }

/* ── FORMS ── */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
    display: block; font-size: .85rem; font-weight: 600;
    margin-bottom: .35rem; color: #374151;
}
.form-control {
    width: 100%; padding: .55rem .85rem;
    border: 1.5px solid var(--border); border-radius: 7px;
    font-size: .95rem; color: var(--dark);
    background: var(--white); outline: none;
    transition: border-color .15s;
}
.form-control:focus { border-color: var(--primary); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; padding-right: 2rem; }
textarea.form-control { resize: vertical; }
.form-check { display: flex; align-items: center; gap: .5rem; margin-top: .3rem; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }
.form-hint { font-size: .78rem; color: var(--gray); margin-top: .25rem; }

.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 150px; }

/* ── BUTTONS ── */
.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .5rem 1.1rem; border-radius: 7px;
    font-size: .88rem; font-weight: 600;
    border: none; cursor: pointer; transition: all .15s;
    text-decoration: none !important;
}
.btn-sm { padding: .3rem .75rem; font-size: .8rem; }
.btn-block { width: 100%; justify-content: center; padding: .7rem; font-size: 1rem; }
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover   { background: var(--primary-h); }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover   { background: #16a34a; }
.btn-danger    { background: var(--danger);  color: #fff; }
.btn-danger:hover    { background: #dc2626; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover   { background: #d97706; }
.btn-secondary { background: var(--border);  color: var(--dark); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-outline   { background: transparent; border: 1.5px solid var(--border); color: var(--gray); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* ── TABLE ── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead th {
    background: var(--light);
    padding: .75rem 1rem; text-align: left;
    font-size: .78rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--gray); border-bottom: 1px solid var(--border);
}
tbody td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

/* ── ALERTS ── */
.alert {
    padding: .8rem 1rem; border-radius: 7px;
    margin-bottom: 1rem; font-size: .9rem;
    display: flex; align-items: flex-start; gap: .5rem;
}
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.alert-danger  { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── SECTION BUILDER ── */
.section-block {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    overflow: hidden;
}
.section-header {
    background: #f8fafc;
    padding: .85rem 1.25rem;
    display: flex; align-items: center; gap: .75rem;
    border-bottom: 1px solid var(--border);
}
.section-header .drag-handle { color: #94a3b8; cursor: grab; }
.section-body { padding: 1.25rem; }

.question-block {
    background: #fafafa;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: .85rem;
    position: relative;
}
.question-header {
    display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem;
}

.options-list { margin-top: .75rem; }
.option-row {
    display: flex; align-items: center; gap: .5rem;
    margin-bottom: .5rem;
}
.option-row input[type="text"] { flex: 1; }
.option-row input[type="number"] { width: 90px; }
.option-row .btn-remove-opt {
    background: none; border: none; color: var(--danger);
    cursor: pointer; padding: .3rem; border-radius: 5px;
    display: flex; align-items: center;
}
.option-row .btn-remove-opt:hover { background: #fef2f2; }

/* ── ENTRY PAGE (mobile-first) ── */
.entry-page { max-width: 680px; margin: 0 auto; padding: 1rem; }
.entry-header {
    background: var(--primary);
    color: #fff; border-radius: var(--radius);
    padding: 1.25rem; margin-bottom: 1.25rem;
}
.entry-header h2 { font-size: 1.15rem; margin-bottom: .2rem; }
.entry-header p  { opacity: .85; font-size: .85rem; }

.entry-section {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    overflow: hidden;
}
.entry-section-title {
    background: #4f46e5;
    color: #fff;
    padding: .75rem 1.25rem;
    font-weight: 700; font-size: .95rem;
    display: flex; justify-content: space-between; align-items: center;
}
.entry-section-title .pts { font-size: .8rem; opacity: .8; background: rgba(255,255,255,.2); padding: .15rem .5rem; border-radius: 20px; }

.entry-question { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.entry-question:last-child { border-bottom: none; }
.entry-question-text { font-weight: 600; margin-bottom: .75rem; font-size: .95rem; }
.entry-question-pts  { font-size: .78rem; color: var(--gray); margin-bottom: .5rem; }

.entry-options { display: flex; flex-wrap: wrap; gap: .5rem; }
.entry-option {
    flex: 1; min-width: 100px;
    border: 2px solid var(--border);
    border-radius: 8px; padding: .6rem .75rem;
    text-align: center; cursor: pointer;
    font-size: .88rem; font-weight: 600;
    transition: all .15s; background: var(--white);
}
.entry-option:hover { border-color: var(--primary); color: var(--primary); }
.entry-option input[type="radio"] { display: none; }
.entry-option.selected { border-color: var(--primary); background: #ede9fe; color: var(--primary); }
.entry-option .opt-pts { font-size: .72rem; font-weight: 400; color: var(--gray); display: block; margin-top: 2px; }
.entry-option.selected .opt-pts { color: #6d28d9; }

.entry-comment { margin-top: .75rem; }

/* Progress bar */
.progress-bar { height: 6px; background: var(--border); border-radius: 3px; margin-bottom: 1rem; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); transition: width .3s; }

/* Score badge */
.score-badge {
    display: inline-flex; align-items: center;
    background: #ede9fe; color: var(--primary);
    border-radius: 20px; padding: .3rem .85rem;
    font-weight: 700; font-size: 1rem;
}

/* ── UTILITIES ── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--gray); font-size: .85rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1  { gap: .5rem; }
.gap-2  { gap: 1rem; }
.flex-1 { flex: 1; }
.fw-600 { font-weight: 600; }
.fs-sm  { font-size: .85rem; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    :root { --sidebar-w: 0px; }
    .sidebar { transform: translateX(-240px); transition: transform .25s; }
    .sidebar.open { transform: translateX(0); width: 240px; }
    .main-content { margin-left: 0; }
    .topbar { padding: .75rem 1rem; }
    .page-content { padding: 1rem; }
    .form-row { flex-direction: column; }
    .mobile-menu-btn { display: flex !important; }
}
.mobile-menu-btn {
    display: none;
    background: none; border: none; cursor: pointer;
    color: var(--dark); padding: .3rem; border-radius: 6px;
}
.mobile-menu-btn:hover { background: var(--light); }

/* ── MODAL ── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.5); z-index: 999;
    align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: var(--white); border-radius: var(--radius);
    width: 90%; max-width: 500px;
    padding: 1.75rem; box-shadow: 0 25px 60px rgba(0,0,0,.2);
}
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1.25rem; }

/* ── EMPTY STATE ── */
.empty-state {
    text-align: center; padding: 3rem 1.5rem; color: var(--gray);
}
.empty-state svg { margin-bottom: 1rem; opacity: .4; }
.empty-state p   { font-size: 1rem; }

/* ── TABS ── */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; gap: 0; }
.tab-item {
    padding: .65rem 1.25rem; cursor: pointer;
    font-weight: 600; font-size: .9rem;
    color: var(--gray); border-bottom: 2px solid transparent;
    margin-bottom: -2px; transition: all .15s;
}
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }
