:root {
    --bg-1: #eef3ff;
    --bg-2: #fdfdfd;
    --accent: #0f172a;
    --accent-soft: #3b82f6;
    --success: #16a34a;
    --danger: #dc2626;
    --glass: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.68);
    --shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: "Tajawal", sans-serif;
    color: var(--accent);
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.16), transparent 28%),
        radial-gradient(circle at left center, rgba(15, 23, 42, 0.08), transparent 25%),
        linear-gradient(180deg, var(--bg-1), var(--bg-2));
}

.admin-shell,
.survey-shell {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 48px;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.glass-card,
.hero-panel,
.survey-hero,
.question-card {
    backdrop-filter: blur(24px);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    border-radius: 28px;
}

.login-card {
    width: min(920px, 100%);
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 28px;
    padding: 32px;
}

.hero-panel,
.survey-hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    padding: 32px;
    margin-bottom: 28px;
}

.hero-panel h1,
.survey-hero h1,
.login-copy h1 {
    font-size: clamp(2rem, 4vw, 3.25rem);
    font-weight: 800;
    margin-bottom: 12px;
}

.hero-badge,
.pill-soft {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    color: #1d4ed8;
    font-weight: 700;
    font-size: 0.85rem;
}

.hero-actions,
.stack-gap,
.compact-actions {
    display: grid;
    gap: 14px;
}

.compact-actions {
    grid-auto-flow: column;
    align-items: center;
}

.survey-list,
.question-stack,
.activity-list,
.researcher-grid {
    display: grid;
    gap: 12px;
}

.survey-card,
.question-admin-card,
.choice-tile,
.ranking-item,
.activity-item,
.researcher-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 22px;
    padding: 16px 18px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.survey-card:hover,
.survey-card.active,
.choice-tile:hover,
.ranking-item:hover,
.question-admin-card:hover,
.researcher-card:hover {
    transform: translateY(-2px);
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 18px 35px rgba(59, 130, 246, 0.12);
}

.survey-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.survey-row-main {
    display: grid;
    gap: 6px;
}

.survey-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.survey-log-wrap {
    overflow-x: auto;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(226, 232, 240, 0.9);
}

.survey-log-table {
    --bs-table-bg: transparent;
    margin: 0;
}

.survey-log-table thead th {
    border-bottom: 1px solid rgba(203, 213, 225, 0.9);
    white-space: nowrap;
    font-weight: 800;
    color: #334155;
    background: rgba(255, 255, 255, 0.5);
}

.survey-log-table tbody td {
    border-color: rgba(226, 232, 240, 0.8);
    vertical-align: middle;
}

.survey-row-active {
    background: rgba(59, 130, 246, 0.08);
}

.icon-add-btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #0f172a;
    color: #fff;
    text-decoration: none;
    font-size: 1.4rem;
    line-height: 1;
    box-shadow: 0 16px 28px rgba(15, 23, 42, 0.18);
}

.icon-add-btn:hover {
    color: #fff;
    transform: translateY(-1px);
}

.section-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
}

.sub-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.glass-input,
.code-input {
    border-radius: 18px;
    border: 1px solid rgba(203, 213, 225, 0.8);
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.8);
}

.code-input {
    font-family: Consolas, monospace;
    direction: ltr;
}

.btn-apple {
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #111827, #2563eb);
    padding: 14px 22px;
    font-weight: 700;
    box-shadow: 0 18px 30px rgba(37, 99, 235, 0.24);
}

.empty-state,
.submit-panel {
    text-align: center;
    padding: 28px;
}

.small-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.88rem;
    font-weight: 700;
}

.admin-meta-grid {
    display: grid;
    gap: 10px;
}

.admin-meta-grid code {
    word-break: break-word;
}

.question-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    flex-wrap: wrap;
}

.page-filter-wrap,
.page-filter {
    min-width: 220px;
}

.question-table-wrap {
    overflow-x: auto;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(226, 232, 240, 0.9);
}

.question-table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.35);
    margin: 0;
}

.question-table thead th {
    border-bottom: 1px solid rgba(203, 213, 225, 0.9);
    white-space: nowrap;
    font-weight: 800;
    color: #334155;
    background: rgba(255, 255, 255, 0.5);
}

.question-table tbody td {
    border-color: rgba(226, 232, 240, 0.8);
    vertical-align: middle;
}

.question-row {
    background: rgba(255, 255, 255, 0.62);
}

.question-row.dragging {
    opacity: 0.55;
}

.drag-cell,
.question-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.drag-handle {
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 1.15rem;
    cursor: grab;
    line-height: 1;
}

.drag-handle:active {
    cursor: grabbing;
}

.sort-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    font-weight: 800;
}

.question-main-cell,
.question-meta-cell {
    display: grid;
    gap: 4px;
}

.question-main-cell span,
.question-main-cell small,
.question-meta-cell span {
    color: #64748b;
}

.question-type-pill {
    color: #0f172a;
}

.page-no-input {
    min-width: 84px;
    max-width: 96px;
    text-align: center;
}

.survey-card-wrap {
    max-width: 920px;
    margin: 0 auto;
}

.survey-page {
    display: none;
}

.page-header {
    margin-bottom: 12px;
}

.question-card {
    padding: 24px;
    margin-bottom: 18px;
}

.logic-hidden {
    display: none !important;
}

.question-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.question-head h2 {
    font-size: 1.3rem;
    font-weight: 800;
    margin: 12px 0 10px;
}

.choice-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    margin-bottom: 10px;
}

.choice-tile input {
    width: 18px;
    height: 18px;
}

.stars {
    display: flex;
    gap: 8px;
}

.star-btn {
    border: 0;
    background: transparent;
    font-size: 2rem;
    color: #cbd5e1;
}

.star-btn.active {
    color: #f59e0b;
}

.scale-row,
.page-nav,
.survey-check-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.survey-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.scale-pill {
    position: relative;
}

.scale-pill input {
    position: absolute;
    opacity: 0;
}

.scale-pill span {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 16px;
    border: 1px solid #dbe3ef;
    font-weight: 700;
}

.scale-pill input:checked + span {
    background: #0f172a;
    color: white;
}

.likert-table,
.report-table {
    background: rgba(255, 255, 255, 0.72);
    border-radius: 18px;
    overflow: hidden;
}

.ranking-list {
    display: grid;
    gap: 10px;
}

.ranking-item {
    cursor: move;
    font-weight: 700;
}

.signature-canvas {
    width: 100%;
    max-width: 100%;
    border-radius: 18px;
    background: white;
    border: 1px dashed #cbd5e1;
}

.slider-wrap {
    display: grid;
    gap: 8px;
}

.slider-value {
    font-weight: 700;
    color: #2563eb;
}

.stat-card {
    text-align: center;
}

.stat-card span {
    display: block;
    color: #64748b;
}

.stat-card strong {
    display: block;
    font-size: 2rem;
    margin-top: 10px;
}

.user-badge,
.permission-note,
.demo-credentials,
.progress-card,
.logic-builder {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(226, 232, 240, 0.9);
}

.user-badge span,
.demo-credentials span,
.activity-item small,
.activity-item span {
    color: #64748b;
    font-size: 0.92rem;
}

.progress-card {
    min-width: 240px;
}

.modern-progress {
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(203, 213, 225, 0.45);
}

.modern-progress .progress-bar {
    background: linear-gradient(90deg, #2563eb, #06b6d4);
}

.logic-rule-row {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr 1.1fr 0.8fr 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 12px;
}

.logic-preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.logic-preview-card {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(226, 232, 240, 0.9);
}

.logic-preview-text {
    min-height: 80px;
    line-height: 1.8;
    color: #334155;
}

.logic-preview-text.is-error {
    color: #b91c1c;
}

.logic-preview-json {
    margin: 0;
    direction: ltr;
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.9rem;
    color: #0f172a;
}

.activity-item {
    display: grid;
    gap: 4px;
}

@media (max-width: 992px) {
    .compact-actions,
    .logic-rule-row {
        grid-auto-flow: row;
        grid-template-columns: 1fr;
    }

    .question-toolbar {
        align-items: stretch;
    }

    .logic-preview-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hero-panel,
    .survey-hero,
    .question-head,
    .login-card {
        flex-direction: column;
        align-items: stretch;
    }

    .login-card {
        display: grid;
        grid-template-columns: 1fr;
    }

    .admin-shell,
    .survey-shell {
        width: min(100% - 20px, 1200px);
        padding-top: 20px;
    }
}
