:root {
    --bg-color: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --input-bg: rgba(15, 23, 42, 0.6);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--bg-color), #000000);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Glassmorphism utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Auth Overlay */
.auth-overlay {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.85); z-index: 1000;
}
.auth-card {
    padding: 3rem; border-radius: 1.5rem; width: 100%; max-width: 400px;
    text-align: center;
    transform: translateY(20px);
    animation: fadeUp 0.4s ease forwards;
}
.auth-card h2 { margin-bottom: 2rem; font-weight: 600; font-size: 1.75rem; }
.auth-card input {
    width: 100%; padding: 1rem; margin-bottom: 1.5rem;
    border-radius: 0.75rem; border: 1px solid var(--glass-border);
    background: var(--input-bg); color: white; outline: none;
    font-size: 1rem; transition: border-color 0.2s;
}
.auth-card input:focus { border-color: var(--accent); }
.auth-card button { width: 100%; padding: 1rem; border-radius: 0.75rem; font-weight: 600; font-size: 1rem; }

/* Dashboard Layout */
.dashboard {
    display: flex; height: 100vh; padding: 1.5rem; gap: 1.5rem;
    animation: fadeIn 0.5s ease;
}

/* Sidebar */
.sidebar {
    width: 320px; border-radius: 1.5rem; display: flex; flex-direction: column;
    overflow: hidden;
}
.sidebar-header { padding: 1.5rem; border-bottom: 1px solid var(--glass-border); }
.sidebar-header h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 1rem; }
.sidebar-header select {
    width: 100%; padding: 0.75rem; border-radius: 0.5rem;
    background: var(--input-bg); color: white; border: 1px solid var(--glass-border);
    font-family: inherit; font-size: 0.95rem; cursor: pointer;
}
#newQuestionBtn { margin: 1rem 1.5rem; border-radius: 0.5rem; }
.question-list { list-style: none; overflow-y: auto; flex: 1; padding: 0 1rem 1rem; }
.question-item {
    padding: 1rem; border-radius: 0.75rem; cursor: pointer;
    margin-bottom: 0.5rem; transition: all 0.2s;
    border: 1px solid transparent;
}
.question-item:hover { background: rgba(255,255,255,0.05); }
.question-item.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
}

/* Editor */
.editor {
    flex: 1; border-radius: 1.5rem; display: flex; flex-direction: column;
    overflow-y: auto;
}
.editor-header {
    padding: 1.5rem 2rem; border-bottom: 1px solid var(--glass-border);
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; background: var(--glass-bg); z-index: 10;
    backdrop-filter: blur(12px);
}
.editor-header h2 { font-size: 1.5rem; font-weight: 600; }
.actions { display: flex; gap: 1rem; }

form { padding: 2rem; display: flex; flex-direction: column; gap: 1.5rem; max-width: 800px;}

/* Forms */
.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-row { display: flex; gap: 1.5rem; }
.form-row .form-group { flex: 1; }
label { font-size: 0.85rem; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
input[type="text"], input[type="number"], textarea, select {
    padding: 0.875rem; border-radius: 0.5rem;
    background: var(--input-bg); border: 1px solid var(--glass-border);
    color: white; font-family: inherit; font-size: 1rem; transition: all 0.2s;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
hr { border: none; border-top: 1px solid var(--glass-border); margin: 1rem 0; }
h3 { font-size: 1.25rem; color: var(--text-primary); margin-bottom: -0.5rem; font-weight: 600;}

.media-input-group { display: flex; gap: 0.5rem; }
.media-input-group input[type="text"] { flex: 1; }

/* Option Item */
.option-item {
    display: flex; align-items: center; gap: 1rem; margin-bottom: 0.75rem;
    background: rgba(0,0,0,0.3); padding: 0.5rem; border-radius: 0.5rem;
    border: 1px solid var(--glass-border);
}
.option-item input[type="text"] { flex: 1; margin: 0; border: none; background: transparent; padding: 0.5rem; box-shadow: none !important;}
.option-item input[type="radio"] { width: 1.25rem; height: 1.25rem; cursor: pointer; accent-color: var(--accent); margin-left: 0.5rem;}

/* Buttons */
button {
    cursor: pointer; border: none; font-family: inherit; font-size: 0.875rem;
    transition: all 0.2s; padding: 0.6rem 1.2rem; font-weight: 500;
}
button:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: var(--success); color: white; border-radius: 0.5rem; }
.btn-success:hover { background: var(--success-hover); }
.btn-danger { background: var(--danger); color: white; border-radius: 0.5rem; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-secondary { background: rgba(255,255,255,0.1); color: white; border-radius: 0.5rem; border: 1px solid var(--glass-border); }
.btn-secondary:hover { background: rgba(255,255,255,0.2); }
.btn-icon { background: transparent; color: var(--text-secondary); padding: 0.5rem; border-radius: 0.25rem; font-size: 1.2rem; display: flex; align-items: center; justify-content: center;}
.btn-icon:hover { color: var(--danger); background: rgba(239, 68, 68, 0.1); }

/* Toast */
.toast {
    position: fixed; bottom: -100px; right: 20px;
    padding: 1rem 1.5rem; border-radius: 0.5rem; font-weight: 500;
    transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2000; box-shadow: 0 4px 12px rgba(0,0,0,0.3); font-size: 0.95rem;
}
.toast.show { bottom: 20px; }
.toast.success { background: var(--success); color: white; }
.toast.error { background: var(--danger); color: white; }

/* Animations */
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

/* Tooltips (Ques Boxes) */
.tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-secondary);
    color: var(--bg-color);
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    margin-left: 0.5rem;
    vertical-align: middle;
    outline: none;
}
.tooltip:hover, .tooltip:focus, .tooltip:active {
    background: var(--text-primary);
}
.tooltip .tooltip-text {
    visibility: hidden;
    width: 250px;
    background-color: var(--glass-bg);
    color: var(--text-primary);
    text-align: center;
    border-radius: 0.5rem;
    padding: 0.75rem;
    position: absolute;
    z-index: 100;
    bottom: 125%;
    left: 50%;
    margin-left: -125px;
    opacity: 0;
    transition: opacity 0.3s;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    font-weight: normal;
    font-size: 0.85rem;
    pointer-events: none;
    line-height: 1.4;
}
.tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: var(--glass-border) transparent transparent transparent;
}
.tooltip:hover .tooltip-text, .tooltip:focus .tooltip-text, .tooltip:active .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.mobile-nav { display: none; }

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .mobile-nav { display: block !important; margin-bottom: 0.5rem; }
    .desktop-nav { display: none !important; }
    /* Dashboard & Editor Layout */
    .dashboard {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        padding: 1rem;
        gap: 1rem;
    }

    .sidebar {
        width: 100%;
        max-height: 35vh; /* Keep it constrained so editor is visible below */
        border-radius: 1rem;
    }

    .editor {
        flex: 1;
        overflow-y: visible; /* Prevent double scrollbars, let page scroll */
        border-radius: 1rem;
    }
    
    .editor-header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        position: relative; /* remove sticky on mobile if desired, or keep it */
    }

    .actions {
        width: 100%;
        justify-content: space-between;
        gap: 0.5rem;
    }
    .actions button {
        flex: 1;
        padding: 0.5rem;
    }

    form {
        padding: 1rem;
        max-width: 100%;
    }

    .form-row {
        flex-direction: column;
        gap: 1rem;
    }

    /* Index cards container */
    .cards-container {
        flex-direction: column;
        align-items: center;
        padding: 0 1rem;
    }
    .action-card {
        width: 100%;
        max-width: 100%;
        padding: 1.5rem;
    }

    /* Modals & Overlays */
    .modal-content, .auth-card {
        width: 90%;
        padding: 1.5rem;
    }

    /* Preview Modal Fixes */
    #previewModal > div {
        max-height: 90vh;
        overflow-y: auto;
        padding: 1.5rem !important;
    }
    
    #previewOptions {
        grid-template-columns: 1fr !important;
    }

    /* Dashboard Events Grid */
    .events-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Typographic Adjustments */
    h1 { font-size: 2.2rem; }
    .hero { padding: 0 1rem; }
}



