 
/* ===== CSS VARIABLES ===== */
:root {
    --brand-dark: #2C3E50;
    --brand-primary: #C0392B;
    --brand-secondary: #8B4513;
    --brand-copper: #B87333;
    --brand-light: #F8F9FA;
    --brand-border: #E5E7EB;
    --brand-text: #1F2937;
    --brand-muted: #6B7280;
    --brand-white: #FFFFFF;
    --brand-success: #10B981;
    --brand-warning: #F59E0B;
    --brand-error: #EF4444;
    --brand-info: #3B82F6;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.05);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --transition: all 0.2s ease;
    --sidebar-w: 240px;
    --font-en: 'Inter', sans-serif;
    --font-ar: 'Tajawal', sans-serif;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
}

body {
    font-family: var(--font-en);
    background: var(--brand-light);
    color: var(--brand-text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

    body[dir="rtl"] {
        font-family: var(--font-ar);
    }

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    outline: none;
}

input, textarea, select {
    font-family: inherit;
    outline: none;
}

a {
    text-decoration: none;
    color: inherit;
}

ul, ol {
    list-style: none;
}

img {
    max-width: 100%;
}

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

.sidebar {
    width: var(--sidebar-w);
    background: #FFFFFF;
    border-right: 1px solid var(--brand-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
    box-shadow: 2px 0 8px rgba(0,0,0,0.04);
}

[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid var(--brand-border);
}

.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-w);
}

/* ===== SIDEBAR ===== */
.sidebar-logo {
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--brand-border);
    display: flex;
    align-items: center;
}

    .sidebar-logo img {
        height: 38px;
        width: auto;
        max-width: 180px;
        object-fit: contain;
        filter: none;
        background: transparent;
        display: block;
    }

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: var(--brand-muted);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

[dir="rtl"] .nav-item {
    border-left: none;
    border-right: 3px solid transparent;
}

.nav-item:hover {
    background: #F9FAFB;
    color: var(--brand-dark);
}

.nav-item.active {
    background: #FEF2F2;
    color: var(--brand-primary);
    border-left-color: var(--brand-primary);
}

[dir="rtl"] .nav-item.active {
    border-left-color: transparent;
    border-right-color: var(--brand-primary);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-label {
    font-size: 13px;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--brand-border);
    display: flex;
    align-items: center;
    gap: 10px;
    background: #FAFAFA;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-name {
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    color: var(--brand-muted);
    font-size: 11px;
}

/* ===== TOPBAR ===== */
.topbar {
    background: var(--brand-white);
    border-bottom: 1px solid var(--brand-border);
    padding: 0 28px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--brand-text);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--brand-muted);
}

    .breadcrumb span {
        color: var(--brand-muted);
    }

    .breadcrumb .current {
        color: var(--brand-text);
        font-weight: 500;
    }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lang-btn {
    padding: 6px 14px;
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-sm);
    background: var(--brand-white);
    font-size: 12px;
    font-weight: 600;
    color: var(--brand-text);
    cursor: pointer;
    transition: var(--transition);
}

    .lang-btn:hover {
        background: var(--brand-light);
    }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    border: none;
}

    .btn svg {
        width: 15px;
        height: 15px;
        flex-shrink: 0;
    }

.btn-primary {
    background: var(--brand-primary);
    color: #fff;
}

    .btn-primary:hover {
        background: #a93226;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(192,57,43,0.3);
    }

.btn-secondary {
    background: var(--brand-white);
    color: var(--brand-text);
    border: 1px solid var(--brand-border);
}

    .btn-secondary:hover {
        background: var(--brand-light);
    }

.btn-ghost {
    background: transparent;
    color: var(--brand-muted);
    padding: 6px 10px;
}

    .btn-ghost:hover {
        background: var(--brand-light);
        color: var(--brand-text);
    }

.btn-success {
    background: var(--brand-success);
    color: #fff;
}

    .btn-success:hover {
        background: #059669;
    }

.btn-danger {
    background: var(--brand-error);
    color: #fff;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-light);
    color: var(--brand-muted);
    border: 1px solid var(--brand-border);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

    .btn-icon:hover {
        background: var(--brand-border);
        color: var(--brand-text);
    }

    .btn-icon svg {
        width: 15px;
        height: 15px;
    }

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

/* ===== PAGE CONTENT ===== */
.page-content {
    flex: 1;
    padding: 28px;
}

/* ===== TABS ===== */
.tab-bar {
    display: flex;
    gap: 4px;
    background: var(--brand-border);
    border-radius: var(--radius-sm);
    padding: 3px;
    width: fit-content;
}

.tab-btn {
    padding: 6px 18px;
    border-radius: 5px;
    font-size: 12.5px;
    font-weight: 500;
    background: transparent;
    color: var(--brand-muted);
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

    .tab-btn.active {
        background: var(--brand-white);
        color: var(--brand-text);
        box-shadow: var(--shadow-sm);
        font-weight: 600;
    }

/* ===== SEARCH ===== */
.search-bar {
    position: relative;
    flex: 1;
    max-width: 340px;
}

    .search-bar svg {
        position: absolute;
        left: 11px;
        top: 50%;
        transform: translateY(-50%);
        width: 15px;
        height: 15px;
        color: var(--brand-muted);
        pointer-events: none;
    }

[dir="rtl"] .search-bar svg {
    left: auto;
    right: 11px;
}

.search-bar input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--brand-white);
    color: var(--brand-text);
    transition: var(--transition);
}

[dir="rtl"] .search-bar input {
    padding: 8px 36px 8px 12px;
}

.search-bar input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(192,57,43,0.08);
}

.search-bar input::placeholder {
    color: var(--brand-muted);
}

/* ===== BADGES & STATUS ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
}

.badge-active {
    background: #D1FAE5;
    color: #065F46;
}

.badge-ended {
    background: #FEE2E2;
    color: #991B1B;
}

.badge-draft {
    background: #FEF3C7;
    color: #92400E;
}

/* ===== SURVEY TABLE ===== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.toolbar-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.data-table {
    background: var(--brand-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--brand-border);
}

    .data-table table {
        width: 100%;
        border-collapse: collapse;
    }

    .data-table thead {
        background: #F9FAFB;
        border-bottom: 1px solid var(--brand-border);
    }

    .data-table th {
        padding: 12px 16px;
        text-align: left;
        font-size: 12px;
        font-weight: 700;
        color: var(--brand-muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        white-space: nowrap;
    }

[dir="rtl"] .data-table th {
    text-align: right;
}

.data-table td {
    padding: 13px 16px;
    font-size: 13.5px;
    color: var(--brand-text);
    border-bottom: 1px solid #F3F4F6;
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr {
    transition: var(--transition);
}

    .data-table tbody tr:hover {
        background: #FAFAFA;
    }

.survey-title-cell {
    font-weight: 600;
    color: var(--brand-dark);
}

.survey-desc {
    font-size: 12px;
    color: var(--brand-muted);
    margin-top: 2px;
}

.actions-cell {
    display: flex;
    gap: 6px;
    align-items: center;
}

.responses-count {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

    .responses-count strong {
        font-size: 16px;
        font-weight: 700;
        color: var(--brand-dark);
        line-height: 1;
    }

    .responses-count small {
        font-size: 10.5px;
        color: var(--brand-muted);
    }

/* ===== STATS CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--brand-white);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--brand-border);
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .stat-icon svg {
        width: 20px;
        height: 20px;
    }

    .stat-icon.blue {
        background: #EFF6FF;
        color: var(--brand-info);
    }

    .stat-icon.green {
        background: #ECFDF5;
        color: var(--brand-success);
    }

    .stat-icon.orange {
        background: #FFF7ED;
        color: #F97316;
    }

    .stat-icon.red {
        background: #FEF2F2;
        color: var(--brand-error);
    }

.stat-body {
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--brand-dark);
    line-height: 1.1;
}

.stat-label {
    font-size: 12.5px;
    color: var(--brand-muted);
    margin-top: 3px;
}

/* ===== SURVEY BUILDER ===== */
.builder-layout {
    display: flex;
    gap: 0;
    align-items: stretch;
    position: relative;
    height: calc(100vh - 58px - 56px - 28px);
    overflow: hidden;
}

.builder-main {
    flex: 1;
    min-width: 0;
    overflow-y: scroll;
    padding-right: 20px;
    padding-bottom: 40px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

    .builder-main::-webkit-scrollbar {
        display: none;
    }

.builder-sidebar {
    width: 260px;
    flex-shrink: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-left: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

    .builder-sidebar::-webkit-scrollbar {
        display: none;
    }

.survey-header-card {
    background: var(--brand-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--brand-border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 16px;
}

.survey-header-accent {
    height: 5px;
    background: linear-gradient(90deg, var(--brand-primary) 0%, var(--brand-copper) 60%, #c9a84c 100%);
}

.survey-header-body {
    padding: 24px;
}

.survey-title-input {
    width: 100%;
    font-size: 20px;
    font-weight: 700;
    color: var(--brand-dark);
    border: none;
    border-bottom: 2px solid transparent;
    padding: 4px 0;
    background: transparent;
    transition: var(--transition);
}

    .survey-title-input:focus {
        border-bottom-color: var(--brand-primary);
        outline: none;
    }

    .survey-title-input::placeholder {
        color: #CBD5E1;
    }

.survey-desc-input {
    width: 100%;
    font-size: 13.5px;
    color: var(--brand-muted);
    border: none;
    border-bottom: 1px solid transparent;
    padding: 4px 0;
    background: transparent;
    resize: none;
    min-height: 40px;
    transition: var(--transition);
    margin-top: 8px;
}

    .survey-desc-input:focus {
        border-bottom-color: var(--brand-border);
        outline: none;
    }

    .survey-desc-input::placeholder {
        color: #CBD5E1;
    }

/* ===== QUESTION CARD ===== */
.question-card {
    background: var(--brand-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--brand-border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
    transition: var(--transition);
    overflow: hidden;
}

    .question-card:hover {
        border-color: #D1D5DB;
        box-shadow: var(--shadow-md);
    }

    .question-card.focused {
        border-color: var(--brand-primary);
        box-shadow: 0 0 0 3px rgba(192,57,43,0.08);
    }

.question-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px 0;
}

.question-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--brand-light);
    color: var(--brand-muted);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 8px;
}

.question-main {
    flex: 1;
    min-width: 0;
}

.question-controls-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.q-title-input {
    width: 100%;
    font-size: 14px;
    font-weight: 600;
    color: var(--brand-dark);
    border: none;
    border-bottom: 1px solid transparent;
    padding: 6px 0;
    background: transparent;
    transition: var(--transition);
}

    .q-title-input:focus {
        border-bottom-color: var(--brand-primary);
        outline: none;
    }

    .q-title-input::placeholder {
        color: #CBD5E1;
        font-weight: 400;
    }

.type-select {
    padding: 6px 28px 6px 10px;
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--brand-text);
    background: var(--brand-white);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    cursor: pointer;
    min-width: 150px;
}

    .type-select:focus {
        border-color: var(--brand-primary);
    }

.question-card-body {
    padding: 12px 18px 14px 52px;
}

[dir="rtl"] .question-card-body {
    padding: 12px 52px 14px 18px;
}

.question-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    border-top: 1px solid #F3F4F6;
    background: #FAFAFA;
    gap: 12px;
}

.required-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--brand-muted);
    cursor: pointer;
    user-select: none;
}

.toggle-switch {
    width: 36px;
    height: 20px;
    background: var(--brand-border);
    border-radius: 10px;
    position: relative;
    transition: var(--transition);
    cursor: pointer;
}

    .toggle-switch::after {
        content: '';
        position: absolute;
        width: 14px;
        height: 14px;
        border-radius: 50%;
        background: var(--brand-white);
        top: 3px;
        left: 3px;
        transition: var(--transition);
        box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    }

    .toggle-switch.on {
        background: var(--brand-success);
    }

        .toggle-switch.on::after {
            left: 19px;
        }

.q-footer-actions {
    display: flex;
    gap: 6px;
}

/* ===== QUESTION INPUTS ===== */
.option-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.option-handle {
    width: 14px;
    height: 14px;
    color: var(--brand-muted);
    cursor: grab;
    flex-shrink: 0;
}

.option-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--brand-border);
    flex-shrink: 0;
}

.option-check {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 2px solid var(--brand-border);
    flex-shrink: 0;
}

.option-input {
    flex: 1;
    border: none;
    border-bottom: 1px solid transparent;
    padding: 5px 0;
    font-size: 13.5px;
    color: var(--brand-text);
    background: transparent;
    transition: var(--transition);
}

    .option-input:focus {
        border-bottom-color: var(--brand-primary);
        outline: none;
    }

    .option-input::placeholder {
        color: #CBD5E1;
    }

.add-option-btn {
    background: transparent;
    border: 1px dashed var(--brand-border);
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    font-size: 12.5px;
    color: var(--brand-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    margin-top: 4px;
}

    .add-option-btn:hover {
        border-color: var(--brand-primary);
        color: var(--brand-primary);
    }

.rating-preview {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.rating-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--brand-border);
    background: var(--brand-white);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .rating-btn:hover {
        border-color: var(--brand-primary);
        color: var(--brand-primary);
    }

.text-preview {
    background: var(--brand-light);
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    color: var(--brand-muted);
    min-height: 40px;
}

    .text-preview.multiline {
        min-height: 80px;
    }

.yes-no-preview {
    display: flex;
    gap: 10px;
}

.yes-no-btn {
    padding: 8px 24px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--brand-border);
    background: var(--brand-white);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

    .yes-no-btn:hover {
        border-color: var(--brand-primary);
    }

.scale-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.scale-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11.5px;
    color: var(--brand-muted);
}

.scale-track {
    display: flex;
    gap: 6px;
}

.scale-point {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

    .scale-point:hover {
        border-color: var(--brand-primary);
        background: #FEF2F2;
    }

.section-divider-preview {
    border-top: 2px solid var(--brand-border);
    padding-top: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--brand-muted);
    font-size: 13px;
}

.desc-block-preview {
    background: #FFF8EE;
    border-left: 3px solid var(--brand-copper);
    padding: 12px 16px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 13px;
    color: var(--brand-muted);
}

[dir="rtl"] .desc-block-preview {
    border-left: none;
    border-right: 3px solid var(--brand-copper);
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.file-upload-preview {
    border: 2px dashed var(--brand-border);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    color: var(--brand-muted);
    font-size: 13px;
}

    .file-upload-preview svg {
        width: 32px;
        height: 32px;
        margin: 0 auto 8px;
        display: block;
        color: var(--brand-border);
    }

.range-config {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--brand-muted);
}

.range-select {
    padding: 5px 10px;
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    background: var(--brand-white);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    background: var(--brand-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--brand-border);
}

    .empty-state svg {
        width: 64px;
        height: 64px;
        color: #D1D5DB;
        margin-bottom: 16px;
    }

    .empty-state h3 {
        font-size: 16px;
        font-weight: 700;
        color: var(--brand-dark);
        margin-bottom: 8px;
    }

    .empty-state p {
        font-size: 13.5px;
        color: var(--brand-muted);
        max-width: 320px;
        line-height: 1.7;
        margin-bottom: 20px;
    }

/* ===== PREVIEW MODE ===== */
.preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 40px 20px;
    backdrop-filter: blur(4px);
}

.preview-modal {
    background: var(--brand-white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 680px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.preview-header {
    height: 8px;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-copper), var(--brand-secondary));
}

.preview-body {
    padding: 32px;
}

.preview-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--brand-dark);
    margin-bottom: 8px;
}

.preview-desc {
    font-size: 14px;
    color: var(--brand-muted);
    margin-bottom: 28px;
}

.preview-q {
    margin-bottom: 22px;
}

.preview-q-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--brand-dark);
    margin-bottom: 8px;
}

    .preview-q-title .req {
        color: var(--brand-primary);
        margin-left: 3px;
    }

.preview-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: inherit;
    transition: var(--transition);
}

    .preview-input:focus {
        border-color: var(--brand-primary);
        box-shadow: 0 0 0 3px rgba(192,57,43,0.08);
    }

.preview-textarea {
    min-height: 100px;
    resize: vertical;
}

.preview-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preview-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 13.5px;
}

    .preview-option:hover {
        border-color: var(--brand-primary);
        background: #FEF2F2;
    }

.preview-footer {
    padding: 20px 32px;
    border-top: 1px solid var(--brand-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #FAFAFA;
}

.close-preview {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,0.3);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .close-preview svg {
        width: 16px;
        height: 16px;
    }

/* ===== ANALYTICS ===== */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.analytics-card {
    background: var(--brand-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--brand-border);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

    .analytics-card.full {
        grid-column: 1 / -1;
    }

.analytics-q-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--brand-dark);
    margin-bottom: 4px;
}

.analytics-meta {
    font-size: 12px;
    color: var(--brand-muted);
    margin-bottom: 16px;
}

.analytics-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.analytics-label {
    font-size: 13px;
    color: var(--brand-text);
    width: 130px;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.analytics-bar-track {
    flex: 1;
    height: 10px;
    background: var(--brand-light);
    border-radius: 10px;
    overflow: hidden;
}

.analytics-bar-fill {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-copper));
    transition: width 0.6s ease;
}

    .analytics-bar-fill.green {
        background: linear-gradient(90deg, #10B981, #34D399);
    }

    .analytics-bar-fill.blue {
        background: linear-gradient(90deg, #3B82F6, #60A5FA);
    }

.analytics-pct {
    font-size: 12px;
    font-weight: 700;
    color: var(--brand-muted);
    width: 38px;
    text-align: right;
}

.analytics-cnt {
    font-size: 12px;
    color: var(--brand-muted);
    width: 28px;
    text-align: right;
}

.pie-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
}

.pie-chart {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

    .pie-chart svg {
        width: 80px;
        height: 80px;
        transform: rotate(-90deg);
    }

.pie-legend {
    flex: 1;
}

.pie-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--brand-text);
    margin-bottom: 6px;
}

.pie-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.insight-box {
    background: #F0FDF4;
    border: 1px solid #A7F3D0;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 12.5px;
    color: #065F46;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 14px;
}

    .insight-box svg {
        width: 14px;
        height: 14px;
        flex-shrink: 0;
        margin-top: 1px;
    }

.text-response-card {
    background: var(--brand-light);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 13px;
    color: var(--brand-text);
    margin-bottom: 8px;
    border-left: 3px solid var(--brand-copper);
}

[dir="rtl"] .text-response-card {
    border-left: none;
    border-right: 3px solid var(--brand-copper);
}

.stat-numbers {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
}

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

    .stat-num strong {
        display: block;
        font-size: 20px;
        font-weight: 800;
        color: var(--brand-dark);
    }

    .stat-num small {
        font-size: 11px;
        color: var(--brand-muted);
    }

/* ===== PANEL / SIDEBAR CARD ===== */
.panel-card {
    background: var(--brand-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--brand-border);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 14px;
}

    .panel-card h4 {
        font-size: 12.5px;
        font-weight: 700;
        color: var(--brand-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 14px;
    }

/* ===== MODAL / DIALOG ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.modal {
    background: var(--brand-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    overflow: hidden;
}

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--brand-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

    .modal-header h3 {
        font-size: 16px;
        font-weight: 700;
        color: var(--brand-dark);
    }

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    padding: 16px 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--brand-dark);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 9px 13px;
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: inherit;
    color: var(--brand-text);
    transition: var(--transition);
}

    .form-input:focus {
        border-color: var(--brand-primary);
        box-shadow: 0 0 0 3px rgba(192,57,43,0.08);
    }

.form-select {
    width: 100%;
    padding: 9px 30px 9px 13px;
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: inherit;
    color: var(--brand-text);
    background: var(--brand-white);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}

    .form-select:focus {
        border-color: var(--brand-primary);
        box-shadow: 0 0 0 3px rgba(192,57,43,0.08);
    }

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

[dir="rtl"] .toast-container {
    right: auto;
    left: 24px;
}

.toast {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    color: #fff;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.5s forwards;
    max-width: 340px;
}

    .toast.success {
        background: var(--brand-success);
    }

    .toast.error {
        background: var(--brand-error);
    }

    .toast.info {
        background: var(--brand-info);
    }

@keyframes slideIn {
    from {
        transform: translateX(30px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(30px);
    }
}

[dir="rtl"] @keyframes slideIn {
    from

{
    transform: translateX(-30px);
    opacity: 0;
}

}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header-left h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--brand-dark);
}

.page-header-left p {
    font-size: 13px;
    color: var(--brand-muted);
    margin-top: 2px;
}

/* ===== USER MANAGEMENT ===== */
.user-table {
    background: var(--brand-white);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--brand-border);
}

/* ===== REPORTS ===== */
.report-card {
    background: var(--brand-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--brand-border);
    padding: 22px;
    box-shadow: var(--shadow-sm);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .builder-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-w: 0px;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    [dir="rtl"] .sidebar {
        transform: translateX(100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .page-content {
        padding: 16px;
    }

    .topbar {
        padding: 0 16px;
    }

    .data-table {
        overflow-x: auto;
    }

    .mobile-menu-btn {
        display: flex !important;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .topbar-right .lang-btn {
        display: none;
    }
}

.mobile-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    background: var(--brand-light);
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

    .mobile-menu-btn svg {
        width: 18px;
        height: 18px;
        color: var(--brand-text);
    }

/* ===== HIDDEN ===== */
.hidden {
    display: none !important;
}

/*.view {
    display: none;
}*/

    .view.active {
        display: block;
    }

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Drag ghost */
.dragging {
    opacity: 0.4;
}

.drag-over {
    border: 2px dashed var(--brand-primary) !important;
}


/* ===== SURVEY GALLERY (GRID/LIST) ===== */
.gallery-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.view-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--brand-border);
    background: var(--brand-white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--brand-muted);
    transition: var(--transition);
}

    .view-icon-btn:hover {
        background: var(--brand-light);
        color: var(--brand-dark);
    }

    .view-icon-btn.active {
        background: var(--brand-primary);
        border-color: var(--brand-primary);
        color: #fff;
    }

    .view-icon-btn svg {
        width: 15px;
        height: 15px;
    }

/* Survey Grid */
.surveys-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 0;
}

.survey-grid-card {
    background: var(--brand-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--brand-border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
}

    .survey-grid-card:hover {
        box-shadow: var(--shadow-md);
        transform: translateY(-2px);
        border-color: #D1D5DB;
    }

.survey-grid-cover {
    height: 120px;
    background-size: cover;
    background-position: center;
    position: relative;
    flex-shrink: 0;
}

.survey-grid-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.survey-grid-cover-badge {
    position: absolute;
    top: 10px;
    right: 10px;
}

[dir="rtl"] .survey-grid-cover-badge {
    right: auto;
    left: 10px;
}

.survey-grid-body {
    padding: 14px 16px 12px;
}

.survey-grid-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--brand-dark);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.survey-grid-desc {
    font-size: 12px;
    color: var(--brand-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 10px;
}

.survey-grid-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.survey-grid-responses {
    font-size: 12px;
    color: var(--brand-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

    .survey-grid-responses svg {
        width: 12px;
        height: 12px;
    }

    .survey-grid-responses strong {
        color: var(--brand-dark);
        font-weight: 700;
    }

.survey-grid-actions {
    display: flex;
    gap: 4px;
}

    .survey-grid-actions .btn-icon {
        width: 28px;
        height: 28px;
    }

        .survey-grid-actions .btn-icon svg {
            width: 13px;
            height: 13px;
        }

.survey-grid-date {
    font-size: 11px;
    color: var(--brand-muted);
    margin-top: 6px;
}

/* Schedule badge on grid card */
.schedule-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 600;
    background: rgba(0,0,0,0.45);
    color: #fff;
    backdrop-filter: blur(4px);
}

/* List view = existing data-table, just hidden when grid active */
.surveys-list-view {
    display: block;
}

    .surveys-list-view.hidden {
        display: none;
    }

.surveys-grid-view {
    display: none;
}

    .surveys-grid-view.active {
        display: block;
    }


/* ============================================================
   USER MANAGEMENT — GROUPS, ROLES, LOGS (Enhancement Layer)
============================================================ */
/* Sub-nav tabs for user sections */
.user-subnav {
    display: flex;
    gap: 2px;
    background: var(--brand-border);
    border-radius: var(--radius-sm);
    padding: 3px;
    width: fit-content;
    margin-bottom: 20px;
}

.user-subnav-btn {
    padding: 6px 18px;
    border-radius: 5px;
    font-size: 12.5px;
    font-weight: 500;
    background: transparent;
    color: var(--brand-muted);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

    .user-subnav-btn svg {
        width: 14px;
        height: 14px;
    }

    .user-subnav-btn.active {
        background: var(--brand-white);
        color: var(--brand-text);
        box-shadow: var(--shadow-sm);
        font-weight: 600;
    }

/* User section panels */
.user-panel {
    display: none;
}

    .user-panel.active {
        display: block;
    }

/* Group cards grid */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 14px;
    margin-top: 4px;
}

.group-card {
    background: var(--brand-white);
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

    .group-card:hover {
        box-shadow: var(--shadow-md);
        transform: translateY(-1px);
        border-color: #D1D5DB;
    }

.group-card-header {
    padding: 16px 18px 12px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.group-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .group-icon svg {
        width: 18px;
        height: 18px;
    }

.group-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--brand-dark);
}

.group-dept {
    font-size: 12px;
    color: var(--brand-muted);
    margin-top: 2px;
}

.group-card-footer {
    padding: 10px 18px 12px;
    border-top: 1px solid #F3F4F6;
    background: #FAFAFA;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.group-member-stack {
    display: flex;
    gap: -4px;
}

.group-member-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    margin-left: -5px;
    flex-shrink: 0;
}

    .group-member-avatar:first-child {
        margin-left: 0;
    }

.group-count {
    font-size: 12px;
    color: var(--brand-muted);
    font-weight: 500;
}

/* Role badge system */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}

    .role-badge svg {
        width: 11px;
        height: 11px;
    }

.role-super-admin {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
}

.role-survey-creator {
    background: #DBEAFE;
    color: #1D4ED8;
    border: 1px solid #BFDBFE;
}

.role-distributor {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.role-viewer-only {
    background: #F3F4F6;
    color: #374151;
    border: 1px solid #E5E7EB;
}

/* Group filter bar in user list */
.user-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.filter-chip {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--brand-border);
    background: var(--brand-white);
    color: var(--brand-muted);
    cursor: pointer;
    transition: var(--transition);
}

    .filter-chip:hover {
        border-color: var(--brand-primary);
        color: var(--brand-primary);
    }

    .filter-chip.active {
        background: var(--brand-primary);
        color: #fff;
        border-color: var(--brand-primary);
    }

    .filter-chip.all {
        background: var(--brand-dark);
        color: #fff;
        border-color: var(--brand-dark);
    }

/* Activity Log */
.log-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 18px;
    border-bottom: 1px solid #F3F4F6;
    transition: var(--transition);
}

    .log-item:last-child {
        border-bottom: none;
    }

    .log-item:hover {
        background: #FAFAFA;
    }

.log-icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .log-icon-wrap svg {
        width: 14px;
        height: 14px;
    }

    .log-icon-wrap.create {
        background: #D1FAE5;
        color: var(--brand-success);
    }

    .log-icon-wrap.edit {
        background: #DBEAFE;
        color: var(--brand-info);
    }

    .log-icon-wrap.delete {
        background: #FEE2E2;
        color: var(--brand-error);
    }

    .log-icon-wrap.login {
        background: #FEF3C7;
        color: #D97706;
    }

    .log-icon-wrap.share {
        background: #EDE9FE;
        color: #7C3AED;
    }

    .log-icon-wrap.export {
        background: #ECFDF5;
        color: #059669;
    }

    .log-icon-wrap.view {
        background: #F0F9FF;
        color: #0369A1;
    }

.log-body {
    flex: 1;
    min-width: 0;
}

.log-action {
    font-size: 13px;
    color: var(--brand-text);
    line-height: 1.5;
}

    .log-action strong {
        font-weight: 700;
        color: var(--brand-dark);
    }

    .log-action .log-object {
        color: var(--brand-primary);
        font-style: italic;
    }

.log-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 3px;
}

.log-time {
    font-size: 11.5px;
    color: var(--brand-muted);
}

.log-user-tag {
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 10px;
    background: var(--brand-light);
    color: var(--brand-muted);
    font-weight: 600;
}

.log-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--brand-border);
    background: #FAFAFA;
    flex-wrap: wrap;
}

.log-count-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    background: var(--brand-light);
    color: var(--brand-muted);
    border: 1px solid var(--brand-border);
}

/* User table group column */
.user-group-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 768px) {
    .groups-grid {
        grid-template-columns: 1fr;
    }

    .user-subnav {
        width: 100%;
        overflow-x: auto;
    }
}

/* ===== ENHANCEMENT LAYER ===== */

/* --- COVER IMAGE --- */
.cover-image-slot {
    margin-top: 14px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.cover-image-placeholder {
    height: 80px;
    border: 2px dashed var(--brand-border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--brand-muted);
    font-size: 13px;
    transition: var(--transition);
    cursor: pointer;
    background: var(--brand-light);
}

    .cover-image-placeholder:hover {
        border-color: var(--brand-primary);
        color: var(--brand-primary);
        background: #FEF2F2;
    }

    .cover-image-placeholder svg {
        width: 20px;
        height: 20px;
    }

.cover-image-banner {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    border-radius: var(--radius-sm);
}

.cover-image-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    opacity: 0;
}

.cover-image-slot:hover .cover-image-overlay {
    background: rgba(0,0,0,0.35);
    opacity: 1;
}

.cover-image-overlay span {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

.cover-image-overlay svg {
    width: 16px;
    height: 16px;
    color: #fff;
}

/* --- COVER IMAGE MODAL --- */
.cover-modal {
    max-width: 600px;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 10px;
}

    .theme-grid .theme-img-wrapper {
        aspect-ratio: unset;
    }

.theme-img-btn {
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition);
    aspect-ratio: 3/1;
    background-size: cover;
    background-position: center;
    width: 100%;
}

    .theme-img-btn:hover {
        border-color: var(--brand-primary);
        transform: scale(1.02);
    }

    .theme-img-btn.selected {
        border-color: var(--brand-primary);
        box-shadow: 0 0 0 2px rgba(192,57,43,0.25);
    }

.theme-img-wrapper {
    position: relative;
    aspect-ratio: 16/7;
}

    .theme-img-wrapper .theme-img-delete {
        position: absolute;
        top: 4px;
        right: 4px;
        width: 20px;
        height: 20px;
        background: rgba(0,0,0,0.55);
        border-radius: 50%;
        display: none;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 5;
        border: none;
    }

    .theme-img-wrapper:hover .theme-img-delete {
        display: flex;
    }

    .theme-img-wrapper .theme-img-delete svg {
        width: 10px;
        height: 10px;
        color: #fff;
    }

.gallery-section-label {
    grid-column: 1 / -1;
    font-size: 11px;
    font-weight: 700;
    color: var(--brand-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-top: 6px;
    margin-bottom: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--brand-border);
}

.cover-upload-area {
    border: 2px dashed var(--brand-border);
    border-radius: var(--radius-sm);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--brand-light);
}

    .cover-upload-area:hover {
        border-color: var(--brand-primary);
        background: #FEF2F2;
    }

    .cover-upload-area svg {
        width: 28px;
        height: 28px;
        color: var(--brand-muted);
        margin: 0 auto 8px;
        display: block;
    }

    .cover-upload-area p {
        font-size: 13px;
        color: var(--brand-muted);
        margin: 0;
    }

    .cover-upload-area small {
        font-size: 11.5px;
        color: #9CA3AF;
    }

.cover-preview-img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-top: 12px;
    display: none;
}

.cover-section-label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--brand-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    margin-top: 14px;
}

/* --- STICKY BUILDER SIDEBAR --- */
.builder-sidebar-sticky {
    position: static;
    overflow: visible;
}
/* Survey Settings panel — scrolls with sidebar */
.builder-sidebar .panel-card.settings-panel {
    /* scrolls normally */
}
/* Question Types panel — stays pinned at top of viewport */
.builder-sidebar .panel-card.qtypes-panel {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--brand-white);
}

/* --- SHARE MODAL --- */
.share-modal {
    max-width: 520px;
    width: 100%;
}

    .share-modal .modal-body {
        padding: 20px 24px;
    }

.share-top-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.share-qr-col {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.share-right-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.qr-canvas-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: var(--brand-light);
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-md);
}

    .qr-canvas-wrapper canvas {
        border-radius: 4px;
    }

.qr-download-hint {
    font-size: 11px;
    color: var(--brand-muted);
    text-align: center;
    white-space: nowrap;
}

.url-copy-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 0;
}

    .url-copy-row input {
        flex: 1;
        min-width: 0;
        padding: 9px 13px;
        border: 1px solid var(--brand-border);
        border-radius: var(--radius-sm);
        font-size: 12.5px;
        color: var(--brand-muted);
        background: var(--brand-light);
        pointer-events: none;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

@media (max-width: 520px) {
    .share-top-row {
        flex-direction: column;
        align-items: stretch;
    }

    .share-qr-col {
        flex-direction: row;
        align-items: center;
        gap: 14px;
    }

    .qr-canvas-wrapper {
        padding: 8px;
    }

    .share-modal {
        max-width: 100%;
    }
}

.permission-group {
    margin-bottom: 4px;
}

.permission-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--brand-border);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 8px;
}

    .permission-option:hover {
        border-color: var(--brand-primary);
        background: #FEF2F2;
    }

    .permission-option.selected {
        border-color: var(--brand-primary);
        background: #FEF2F2;
    }

    .permission-option input[type="radio"] {
        margin-top: 2px;
        accent-color: var(--brand-primary);
        flex-shrink: 0;
    }

.permission-option-text strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-dark);
}

.permission-option-text small {
    font-size: 12px;
    color: var(--brand-muted);
}

.share-divider {
    height: 1px;
    background: var(--brand-border);
    margin: 14px 0;
}

/* --- ANALYTICS ENHANCEMENTS --- */
.analytics-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.analytics-export-btns {
    display: flex;
    gap: 8px;
}

.view-toggle-bar {
    display: flex;
    gap: 4px;
    background: var(--brand-border);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.view-toggle-btn {
    padding: 6px 16px;
    border-radius: 5px;
    font-size: 12.5px;
    font-weight: 500;
    background: transparent;
    color: var(--brand-muted);
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

    .view-toggle-btn.active {
        background: var(--brand-white);
        color: var(--brand-text);
        box-shadow: var(--shadow-sm);
        font-weight: 600;
    }

/* --- INDIVIDUAL RESPONSE VIEW --- */
.individual-view {
    display: none;
}

    .individual-view.active {
        display: block;
    }

.summary-view {
    display: block;
}

    .summary-view.hidden-view {
        display: none;
    }

.response-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--brand-white);
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.response-nav-info {
    font-size: 13.5px;
    color: var(--brand-muted);
}

    .response-nav-info strong {
        color: var(--brand-dark);
        font-weight: 700;
    }

.response-nav-btns {
    display: flex;
    gap: 8px;
}

.individual-response-card {
    background: var(--brand-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--brand-border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 12px;
}

.individual-response-card-header {
    padding: 14px 18px;
    border-bottom: 1px solid #F3F4F6;
    background: #FAFAFA;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.individual-q-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-dark);
}

.individual-q-type-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background: #EFF6FF;
    color: var(--brand-info);
    font-weight: 600;
}

.individual-response-card-body {
    padding: 14px 18px;
    font-size: 13.5px;
    color: var(--brand-text);
    line-height: 1.7;
}

.individual-rating-display {
    display: flex;
    gap: 6px;
}

.star-filled {
    color: #F59E0B;
    font-size: 18px;
}

.star-empty {
    color: #D1D5DB;
    font-size: 18px;
}

.response-timestamp {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--brand-muted);
    padding: 10px 18px 12px;
    border-top: 1px solid #F3F4F6;
}

    .response-timestamp svg {
        width: 13px;
        height: 13px;
    }

/* --- BUILDER SHARE BUTTON PLACEMENT --- */
.builder-share-btn {
}

/* --- QR fallback text box --- */
.qr-fallback {
    width: 160px;
    height: 160px;
    background: var(--brand-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    flex-direction: column;
    gap: 8px;
}

    .qr-fallback svg {
        width: 40px;
        height: 40px;
        color: rgba(255,255,255,0.4);
    }

    .qr-fallback span {
        color: rgba(255,255,255,0.6);
        font-size: 11px;
        text-align: center;
        padding: 0 12px;
    }

.qr-grid {
    display: grid;
    grid-template-columns: repeat(9,1fr);
    gap: 3px;
    padding: 12px;
    background: #fff;
    border-radius: 6px;
}

.qr-cell {
    aspect-ratio: 1;
    border-radius: 1px;
}

@media (max-width: 768px) {
    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .analytics-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

 
