:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: rgba(30, 30, 50, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --border-glass: rgba(255, 255, 255, 0.1);
    --accent-1: #7c3aed;
    --accent-2: #06b6d4;
    --accent-gradient: linear-gradient(135deg, #7c3aed, #06b6d4);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --sidebar-width: 260px;
    --font-family: 'Inter', -apple-system, sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--accent-1); border-radius: 3px; }

/* ---- SIDEBAR ---- */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-glass);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}
.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-glass);
}
.sidebar-brand .brand-icon {
    width: 40px; height: 40px;
    background: var(--accent-gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}
.sidebar-brand h4 {
    font-size: 16px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}
.nav-section { margin-bottom: 24px; }
.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
}
.nav-link:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}
.nav-link.active {
    background: rgba(124, 58, 237, 0.15);
    color: var(--accent-1);
}
.nav-link i { font-size: 18px; width: 22px; text-align: center; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-glass);
}
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
}
.user-avatar {
    width: 36px; height: 36px;
    background: var(--accent-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
}
.user-details { flex: 1; }
.user-details .name { font-size: 13px; font-weight: 600; }
.user-details .role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }

/* ---- MAIN CONTENT ---- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 24px 32px;
}
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}
.page-header h1 {
    font-size: 28px;
    font-weight: 700;
}
.page-header .breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ---- GLASS CARD ---- */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.glass-card:hover {
    border-color: rgba(124, 58, 237, 0.3);
}

/* ---- STAT CARDS ---- */
.stat-card {
    position: relative;
    overflow: hidden;
}
.stat-card .stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 16px;
}
.stat-card .stat-value {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}
.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}
.stat-card::after {
    content: '';
    position: absolute;
    top: -50%; right: -50%;
    width: 100%; height: 100%;
    background: radial-gradient(circle, rgba(124,58,237,0.1) 0%, transparent 70%);
    pointer-events: none;
}

/* ---- BUTTONS ---- */
.btn-gradient {
    background: var(--accent-gradient);
    border: none;
    color: white;
    font-weight: 600;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 14px;
}
.btn-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(124,58,237,0.4);
    color: white;
}
.btn-glass {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    font-size: 13px;
}
.btn-glass:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}
.btn-danger-glass {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: #ef4444;
}
.btn-danger-glass:hover {
    background: rgba(239,68,68,0.2);
    color: #ef4444;
}

/* ---- TABLE ---- */
.table-glass {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.table-glass thead th {
    background: rgba(255,255,255,0.03);
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-glass);
    text-align: left;
}
.table-glass tbody td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    vertical-align: middle;
}
.table-glass tbody tr {
    transition: var(--transition);
}
.table-glass tbody tr:hover {
    background: rgba(124,58,237,0.05);
}

/* ---- BADGES ---- */
.badge-active {
    background: rgba(16,185,129,0.15);
    color: var(--success);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-inactive {
    background: rgba(239,68,68,0.15);
    color: var(--danger);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-role {
    background: rgba(124,58,237,0.15);
    color: var(--accent-1);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

/* ---- FORMS ---- */
.form-control, .form-select {
    background: var(--bg-glass) !important;
    border: 1px solid var(--border-glass) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm) !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    transition: var(--transition) !important;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent-1) !important;
    box-shadow: 0 0 0 3px rgba(124,58,237,0.2) !important;
}
.form-control::placeholder { color: var(--text-muted) !important; }
.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-check-input {
    background-color: var(--bg-glass) !important;
    border-color: var(--border-glass) !important;
}
.form-check-input:checked {
    background-color: var(--accent-1) !important;
    border-color: var(--accent-1) !important;
}

/* ---- LOGIN ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(124,58,237,0.2), transparent 70%);
    top: -200px; right: -100px;
    animation: float 8s ease-in-out infinite;
}
.login-page::after {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(6,182,212,0.15), transparent 70%);
    bottom: -200px; left: -100px;
    animation: float 8s ease-in-out infinite reverse;
}
@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, -30px); }
}
.login-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    z-index: 1;
}
.login-card h2 {
    text-align: center;
    margin-bottom: 8px;
    font-weight: 700;
}
.login-card p {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 14px;
}

/* ---- QUESTION BUILDER ---- */
.question-item {
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
    transition: var(--transition);
    background: var(--bg-card);
}
.question-item:hover { border-color: rgba(124,58,237,0.3); }
.question-item.dragging { opacity: 0.5; }
.question-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}
.question-header .drag-handle {
    color: var(--text-muted);
    cursor: grab;
    font-size: 18px;
}
.question-header .q-type-badge {
    background: rgba(124,58,237,0.15);
    color: var(--accent-1);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.question-header .q-required {
    color: var(--danger);
    font-size: 14px;
    font-weight: 700;
}
.question-header .q-text {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}
.question-header .q-actions {
    display: flex;
    gap: 6px;
}
.question-body {
    padding: 0 20px 20px;
    border-top: 1px solid var(--border-glass);
    display: none;
}
.question-body.show { display: block; padding-top: 16px; }

/* ---- OPTIONS WITH ICONS ---- */
.option-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: var(--transition);
}
.option-item:hover { background: rgba(255,255,255,0.06); }
.option-icon {
    width: 40px; height: 40px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--border-glass);
}
.option-icon img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.option-icon .no-icon {
    font-size: 16px;
    color: var(--text-muted);
}
.option-text { flex: 1; font-size: 14px; }
.option-actions { display: flex; gap: 4px; }

/* ---- PUBLIC SURVEY ---- */
.public-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
    padding: 40px 20px;
}
.survey-container {
    max-width: 720px;
    margin: 0 auto;
}
.survey-header-card {
    text-align: center;
    margin-bottom: 32px;
    padding: 40px;
}
.survey-header-card h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.survey-header-card p {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
}
.question-card {
    margin-bottom: 24px;
    padding: 28px;
}
.question-card .q-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    background: var(--accent-gradient);
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    color: white;
    margin-right: 10px;
}
.question-card .q-label {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}
.question-card .q-label .required-star {
    color: var(--danger);
    margin-left: 4px;
}

/* ---- ICON OPTION CARDS (public) ---- */
.icon-option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.icon-option-card {
    position: relative;
    border: 2px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-glass);
}
.icon-option-card:hover {
    border-color: var(--accent-1);
    background: rgba(124,58,237,0.1);
    transform: translateY(-2px);
}
.icon-option-card.selected {
    border-color: var(--accent-1);
    background: rgba(124,58,237,0.15);
    box-shadow: 0 0 20px rgba(124,58,237,0.2);
}
.icon-option-card input { position: absolute; opacity: 0; pointer-events: none; }
.icon-option-card .opt-icon {
    width: 48px; height: 48px;
    margin: 0 auto 10px;
    border-radius: 10px;
    overflow: hidden;
}
.icon-option-card .opt-icon img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.icon-option-card .opt-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}
.icon-option-card.selected .opt-label { color: var(--text-primary); }
.icon-option-card .check-mark {
    position: absolute;
    top: 8px; right: 8px;
    width: 22px; height: 22px;
    background: var(--accent-1);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
}
.icon-option-card.selected .check-mark { display: flex; }

/* Simple option list (no icon) */
.simple-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition);
}
.simple-option:hover {
    border-color: var(--accent-1);
    background: rgba(124,58,237,0.05);
}
.simple-option.selected {
    border-color: var(--accent-1);
    background: rgba(124,58,237,0.1);
}

/* ---- RATING ---- */
.rating-stars {
    display: flex;
    gap: 8px;
}
.rating-star {
    font-size: 32px;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}
.rating-star:hover, .rating-star.active {
    color: var(--warning);
    transform: scale(1.2);
}

/* ---- PROGRESS BAR ---- */
.survey-progress {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 16px 0;
    margin-bottom: 16px;
}
.progress-bar-custom {
    height: 6px;
    background: var(--bg-glass);
    border-radius: 3px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 3px;
    transition: width 0.5s ease;
}
.progress-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: right;
}

/* ---- THANK YOU ---- */
.thankyou-card {
    text-align: center;
    padding: 60px 40px;
    max-width: 520px;
    margin: 100px auto;
}
.thankyou-check {
    width: 80px; height: 80px;
    background: var(--accent-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 36px;
    color: white;
    animation: scaleIn 0.5s ease;
}
@keyframes scaleIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}
.thankyou-card h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
}
.thankyou-card p {
    color: var(--text-secondary);
    font-size: 15px;
}

/* ---- MODAL OVERRIDE ---- */
.modal-content {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-glass) !important;
    border-radius: var(--radius) !important;
    color: var(--text-primary) !important;
}
.modal-header { border-bottom-color: var(--border-glass) !important; }
.modal-footer { border-top-color: var(--border-glass) !important; }
.btn-close { filter: invert(1); }

/* ---- ALERT OVERRIDE ---- */
.alert {
    border-radius: var(--radius-sm);
    border: none;
    font-size: 14px;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 16px; }
    .page-header h1 { font-size: 22px; }
    .icon-option-grid { grid-template-columns: repeat(2, 1fr); }
}
.mobile-toggle {
    display: none;
    position: fixed;
    top: 16px; left: 16px;
    z-index: 1100;
    background: var(--accent-gradient);
    border: none;
    color: white;
    width: 40px; height: 40px;
    border-radius: 10px;
    font-size: 20px;
    cursor: pointer;
}
@media (max-width: 768px) {
    .mobile-toggle { display: flex; align-items: center; justify-content: center; }
}
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}
.sidebar-overlay.show { display: block; }

/* ---- ANIMATIONS ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp 0.4s ease forwards; }
.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }

/* ---- ICON UPLOAD PREVIEW ---- */
.icon-upload-area {
    width: 64px; height: 64px;
    border: 2px dashed var(--border-glass);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
    position: relative;
}
.icon-upload-area:hover { border-color: var(--accent-1); }
.icon-upload-area img { width: 100%; height: 100%; object-fit: cover; }
.icon-upload-area .upload-placeholder {
    font-size: 24px;
    color: var(--text-muted);
}

/* ---- CHART CONTAINERS ---- */
.chart-container {
    position: relative;
    max-width: 500px;
    margin: 16px 0;
}
