/* ═══════════════════════════════════════════
   İK Anket Portalı — main.css
   ═══════════════════════════════════════════ */

:root {
    --primary: #c0392b;
    --primary-dark: #a93226;
    --primary-light: #f9ebea;
    --danger: #b91c1c;
    --danger-soft: #fee2e2;
    --bg: #ececee;
    --surface: #ffffff;
    --text: #1e1e20;
    --muted: #6b7280;
    --border: #e2e2e5;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,.10);
    --radius: 12px;
    --sidebar-bg: #2a2a2e;
    --sidebar-text: #b0b0b4;
    --sidebar-hover: #3a3a3e;
    --sidebar-active: #c0392b;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.55; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
input, select, textarea, button { font-family: inherit; }

/* ─── Layout ─── */
.layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.brand {
    padding: 20px 18px 14px;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    border-bottom: 3px solid var(--primary);
    letter-spacing: -.3px;
}
.menu-title {
    padding: 18px 18px 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: #707074;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 500;
    border-radius: 0;
    transition: background .15s, color .15s;
    text-decoration: none;
}
.nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
    text-decoration: none;
}
.nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 600;
}

/* ─── Content ─── */
.content {
    padding: 18px 22px;
    min-width: 0;
    overflow-x: auto;
}

/* ─── Topbar ─── */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: var(--surface);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.topbar h1 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}
.meta {
    font-size: 13px;
    color: var(--muted);
}

/* ─── Grid ─── */
.grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
}
.span-1  { grid-column: span 1; }
.span-2  { grid-column: span 2; }
.span-3  { grid-column: span 3; }
.span-4  { grid-column: span 4; }
.span-5  { grid-column: span 5; }
.span-6  { grid-column: span 6; }
.span-7  { grid-column: span 7; }
.span-8  { grid-column: span 8; }
.span-9  { grid-column: span 9; }
.span-10 { grid-column: span 10; }
.span-11 { grid-column: span 11; }
.span-12 { grid-column: span 12; }

/* ─── Card ─── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
}
.card-elevated {
    box-shadow: var(--shadow-md);
}
.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.card-head h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}
.card-head-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
}

/* ─── Stats ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.stat-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px 18px;
    border-top: 3px solid var(--primary);
    box-shadow: var(--shadow-sm);
}
.stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--muted);
    margin-bottom: 4px;
}
.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary-dark);
}

/* ─── List & Items ─── */
.item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.item:last-child { border-bottom: 0; }
.item-title { font-weight: 600; font-size: 14px; }
.item-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.list { list-style: none; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.list li:last-child { border-bottom: 0; }

/* ─── Badge ─── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary);
}
.badge-active  { background: #dcfce7; color: #166534; }
.badge-draft   { background: #f3f4f6; color: #374151; }
.badge-closed  { background: #fee2e2; color: #991b1b; }
.badge-role    { background: #ede9fe; color: #5b21b6; }

/* ─── Buttons ─── */
.btn {
    border: 0;
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background .15s, box-shadow .15s;
    text-decoration: none;
    line-height: 1.3;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-outline { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #991b1b; text-decoration: none; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; text-decoration: none; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ─── Forms ─── */
.form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.form input,
.form select,
.form textarea {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}
.form input:focus,
.form select:focus,
.form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(192,57,43,.12);
}
.form textarea { min-height: 80px; resize: vertical; }
.form button { align-self: flex-start; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* ─── Table ─── */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.table th {
    background: var(--bg);
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
}
.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tr:hover td { background: #fafafa; }
.table .actions { display: flex; gap: 6px; }

/* ─── Tab System ─── */
.admin-tab-bar {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 18px;
}
.admin-tab {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .15s, border-color .15s;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.is-active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.admin-pane[hidden] { display: none; }

/* ─── Flash / Notifications ─── */
.admin-flash {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid #f5c6cb;
}
.admin-flash.toast-success { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.admin-flash.toast-error { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }

/* ─── Toast ─── */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    animation: slideIn .2s ease;
    pointer-events: auto;
}
.toast-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.toast-error   { background: var(--danger-soft); color: var(--danger); border: 1px solid #fecaca; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes btnSpin { to { transform: rotate(360deg); } }

/* ─── Modal ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
    background: var(--surface);
    border-radius: 14px;
    padding: 24px;
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-md);
    animation: fadeUp .2s ease;
}
.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-close {
    border: 0;
    background: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--muted);
    padding: 4px;
}
.modal-close:hover { color: var(--text); }
@keyframes fadeUp { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ─── Pagination ─── */
.pagination {
    display: flex;
    gap: 4px;
    margin-top: 16px;
    justify-content: center;
}
.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: background .15s;
}
.pagination-link:hover { background: var(--bg); text-decoration: none; }
.pagination-link.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ─── Public Survey ─── */
.survey-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 24px 16px;
}
.survey-header {
    text-align: center;
    margin-bottom: 24px;
}
.survey-header h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
}
.survey-header p {
    color: var(--muted);
    font-size: 14px;
}
.progress-bar-wrap {
    background: var(--border);
    border-radius: 20px;
    height: 8px;
    margin-bottom: 24px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 20px;
    transition: width .3s ease;
}
.question-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
}
.question-card .q-number {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
}
.question-card .q-text {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
}
.question-card .q-required {
    color: var(--danger);
    font-size: 12px;
    margin-left: 4px;
}

/* Custom Radio & Checkbox */
.option-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    font-size: 14px;
}
.option-item:hover { border-color: var(--primary); background: var(--primary-light); }
.option-item input[type="radio"],
.option-item input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.option-item.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

/* Rating Stars */
.rating-group {
    display: flex;
    gap: 6px;
}
.rating-star {
    font-size: 28px;
    cursor: pointer;
    color: #d1d5db;
    transition: color .15s, transform .1s;
    user-select: none;
}
.rating-star:hover,
.rating-star.active { color: #f59e0b; transform: scale(1.1); }

/* Yes/No Toggle */
.yesno-group {
    display: flex;
    gap: 10px;
}
.yesno-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all .15s;
    background: var(--surface);
}
.yesno-btn:hover { border-color: var(--primary); }
.yesno-btn.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

/* Textarea Answer */
.answer-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}
.answer-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(192,57,43,.12);
}

/* ─── Survey Builder ─── */
.question-builder {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    background: var(--surface);
    position: relative;
    transition: all .35s ease;
}
.question-builder.q-highlight {
    animation: qHighlight .8s ease;
}
@keyframes qHighlight {
    0%   { background: #dcfce7; border-color: #86efac; transform: scale(1.01); }
    100% { background: var(--surface); border-color: var(--border); transform: scale(1); }
}
.question-builder.q-removing {
    opacity: 0;
    transform: translateX(40px) scale(.96);
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
    overflow: hidden;
    border-width: 0;
    transition: all .4s ease;
}
.question-builder.q-updated {
    animation: qUpdated .7s ease;
}
@keyframes qUpdated {
    0%   { background: #eff6ff; border-color: #93c5fd; }
    100% { background: var(--surface); border-color: var(--border); }
}
.btn.is-loading {
    pointer-events: none;
    opacity: .65;
    position: relative;
}
.btn.is-loading::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: btnSpin .5s linear infinite;
    margin-left: 4px;
}
.question-builder .drag-handle {
    cursor: grab;
    color: var(--muted);
    font-size: 18px;
    padding: 4px 8px;
}
.question-builder .drag-handle:active { cursor: grabbing; }
.question-builder-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.option-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.option-row input { flex: 1; }

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #d1d5db;
    border-radius: 22px;
    transition: background .2s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ─── Login Page ─── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}
.login-card {
    width: 100%;
    max-width: 400px;
    padding: 32px;
}
.login-card .brand {
    text-align: center;
    border-bottom: none;
    font-size: 20px;
    padding: 0;
    margin-bottom: 6px;
    color: var(--text);
}
.login-card .login-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 24px;
}

/* ─── DataTables Override ─── */
.dataTables_wrapper { font-size: 14px; }
.dataTables_wrapper .dataTables_filter input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    margin-left: 6px;
}
.dataTables_wrapper .dataTables_length select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 6px 10px;
    border-radius: 6px;
    margin: 0 2px;
    border: 1px solid var(--border) !important;
    background: var(--surface) !important;
    color: var(--text) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary) !important;
}
.dataTables_wrapper .dataTables_info { font-size: 13px; color: var(--muted); margin-top: 10px; }
.dataTables_wrapper .dataTables_paginate { margin-top: 10px; }

/* ─── Charts ─── */
.chart-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

/* ─── Thank You Page ─── */
.thankyou-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    text-align: center;
}
.thankyou-card {
    padding: 40px;
    max-width: 460px;
}
.thankyou-card .icon { font-size: 48px; margin-bottom: 16px; }
.thankyou-card h2 { font-size: 22px; margin-bottom: 8px; }
.thankyou-card p { color: var(--muted); font-size: 14px; }

/* ─── Error Page ─── */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    text-align: center;
}

/* ─── Utility ─── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--muted); }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; gap: 8px; }
.hidden { display: none !important; }

/* ─── Comparison Table ─── */
.comparison-up   { color: #16a34a; font-weight: 600; }
.comparison-down { color: #dc2626; font-weight: 600; }

/* ─── Responsive ─── */
@media (max-width: 1080px) {
    .layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: relative;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 10px;
        gap: 4px;
    }
    .brand { padding: 10px 14px; width: 100%; border-bottom: 2px solid var(--primary); }
    .menu-title { display: none; }
    .nav-link { padding: 8px 12px; font-size: 13px; border-radius: 8px; }
    .content { padding: 14px; }
    .grid { grid-template-columns: 1fr; }
    .span-1, .span-2, .span-3, .span-4, .span-5, .span-6,
    .span-7, .span-8, .span-9, .span-10, .span-11, .span-12 {
        grid-column: span 1;
    }
    .stats-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .table { font-size: 13px; }
    .table th, .table td { padding: 8px; }
}
