﻿:root {
    --bg: #eef4f8;
    --panel: #ffffff;
    --text: #192734;
    --muted: #5f7488;
    --line: #d7e1ea;
    --brand: #0f766e;
    --brand-2: #0ea5a0;
    --danger: #b42318;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: linear-gradient(160deg, #e8f1f6, #f8fbfd);
    color: var(--text);
    font-family: "Cairo", "Tahoma", "Segoe UI", sans-serif;
}

.rtl { direction: rtl; }

h1, h2, h3, h4, h5, p { margin: 0; }

a { color: inherit; }

input, textarea, select, button {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 12px;
    background: #fff;
    font-size: 15px;
    font-family: inherit;
}

button, .button {
    display: inline-block;
    width: auto;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    color: #fff;
    border: none;
    text-decoration: none;
    cursor: pointer;
}

button.secondary {
    background: #f4f7fa;
    color: var(--text);
    border: 1px solid var(--line);
}

.button-link {
    text-decoration: none;
    display: inline-block;
    width: auto;
    padding: 10px 12px;
    border-radius: 10px;
}

.stack { display: grid; gap: 10px; }

.row-inline {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.row-inline input,
.row-inline select,
.row-inline button { width: auto; }

.action-btn {
    min-width: 72px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0;
}

.nav-btn .nav-icon {
    font-weight: 800;
}

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

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
}

.hidden { display: none; }

.muted { color: var(--muted); font-size: 14px; }

.error-text { color: var(--danger); }

.alert-success, .alert-error {
    padding: 10px 12px;
    border-radius: 10px;
}

.alert-success { background: #ddf8ec; border: 1px solid #a9e6c9; }
.alert-error { background: #fde9e7; border: 1px solid #f5c4bf; }

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.login-card {
    width: min(460px, 92vw);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 22px;
    display: grid;
    gap: 10px;
}

.admin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.admin-sidebar {
    background: #113447;
    color: #fff;
    padding: 18px;
    display: grid;
    align-content: start;
    gap: 10px;
}

.admin-sidebar a,
.admin-sidebar .link-button {
    color: #fff;
    text-decoration: none;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 9px;
    padding: 8px 10px;
    text-align: right;
}

.admin-main {
    padding: 20px;
    display: grid;
    gap: 16px;
}

.sub-block {
    border: 1px dashed var(--line);
    border-radius: 12px;
    padding: 12px;
}

.stat-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}

th, td {
    padding: 10px;
    text-align: right;
    border-bottom: 1px solid var(--line);
}

.pre-text {
    white-space: pre-wrap;
    background: #f6f8fa;
    border-radius: 8px;
    padding: 10px;
    margin: 0;
}

.wizard-shell {
    width: min(860px, 94vw);
    margin: 18px auto 0;
    display: grid;
    gap: 14px;
    padding-bottom: 96px;
}

.public-shell {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
}

.public-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-bottom: 1px solid var(--line);
    background: #f6fbff;
    position: sticky;
    top: 0;
    z-index: 20;
}

.public-brand {
    font-size: 22px;
    font-weight: 700;
    color: #113447;
}

.brand-with-logo,
.brand-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    padding: 4px;
}

.public-top-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.wizard-hero-card,
.wizard-question-card,
.wizard-result-card {
    box-shadow: 0 10px 30px rgba(14, 43, 72, 0.06);
}

.wizard-progress-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #dce8f1;
    overflow: hidden;
}

.wizard-progress-fill {
    width: 0;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    transition: width 0.28s ease;
}

.option-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr;
}

.option-card {
    display: block;
    width: 100%;
    text-align: right;
    background: #ffffff;
    color: var(--text);
    border: 2px solid #d3dde6;
    border-radius: 14px;
    font-size: 18px;
    padding: 14px;
}

.option-card.selected {
    border-color: var(--brand);
    background: #e9f9f7;
}

.summary-list {
    display: grid;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px;
}

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

.summary-key {
    font-size: 13px;
    color: var(--muted);
    background: #e8eef4;
    border-radius: 999px;
    padding: 4px 9px;
}

.summary-value {
    font-size: 14px;
    color: var(--text);
}

.toast {
    background: #113447;
    color: #fff;
    display: inline-block;
    width: auto;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
}

.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    align-items: center;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: #ffffff;
    border-top: 1px solid var(--line);
    z-index: 30;
}

#mobile-progress-text {
    text-align: center;
    font-weight: 600;
    color: #2f4b63;
}

@media (max-width: 960px) {
    .admin-shell { grid-template-columns: 1fr; }
    .admin-sidebar {
        grid-auto-flow: column;
        align-items: center;
        overflow-x: auto;
    }
}

@media (min-width: 901px) {
    .public-topbar {
        display: flex;
    }

    .mobile-bottom-nav {
        display: none;
    }

    .wizard-shell {
        margin-top: 26px;
        padding-bottom: 34px;
    }

    .option-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
