:root {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --success: #10b981;
    --error: #ef4444;
    --font-main: 'Inter', sans-serif;

    /* Dynamic Theme Variables */
    --theme-primary: var(--accent);
    --theme-bg: var(--bg-color);
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--theme-bg);
    background-image: url('bg-pattern.png');
    background-repeat: repeat;
    background-size: 400px 400px;
    color: var(--text-primary);
    font-family: var(--font-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    transition: background-color 0.5s;
}

/* Background Image Layer */
.app-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.15;
    pointer-events: none;
    transition: background-image 0.5s;
}

.app-container {
    width: 100%;
    max-width: 600px;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
}

header {
    text-align: center;
    padding: 20px 0;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.icon-btn {
    position: absolute;
    right: 0;
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.icon-btn:hover {
    opacity: 1;
}

h1 {
    font-weight: 800;
    background: linear-gradient(to right, #c084fc, var(--theme-primary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin: 0;
}

/* Views */
.view {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.view.hidden {
    display: none;
    opacity: 0;
}

.view.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

.hidden {
    display: none;
    opacity: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* Quiz List */
.quiz-grid {
    display: grid;
    gap: 15px;
    margin-top: 20px;
}

.quiz-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.quiz-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: var(--theme-primary);
}

.quiz-card h3 {
    margin: 0 0 5px 0;
}

.quiz-time {
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* Lobby */
.lobby-card,
.question-card,
.result-card,
.admin-panel {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.countdown {
    font-size: 2em;
    font-weight: 700;
    margin: 20px 0;
    font-variant-numeric: tabular-nums;
    color: var(--theme-primary);
}

.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.05);
    font-size: 0.85em;
    color: var(--text-secondary);
    font-weight: 600;
}

.status-badge.live {
    background: var(--success);
    color: white;
}

.status-badge.upcoming {
    background: #3b82f6;
    color: white;
}

.status-badge.archived {
    background: #64748b;
    color: white;
}

.participant-count-box {
    margin: 20px 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px var(--success);
}

/* Forms & Buttons */
input[type="text"],
input[type="password"],
textarea,
input[type="number"],
input[type="datetime-local"] {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: var(--text-primary);
    font-size: 1.1em;
    margin-bottom: 15px;
    outline: none;
    font-family: inherit;
}

input:focus,
textarea:focus {
    border-color: var(--theme-primary);
}

/* Color Inputs */
input[type="color"] {
    position: relative;
    border: none;
    height: 40px;
    width: 60px;
    cursor: pointer;
    background: none;
}

.cta-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    background: var(--theme-primary);
    color: white;
    font-weight: 600;
    font-size: 1.1em;
    cursor: pointer;
    transition: background 0.2s;
}

.cta-btn:hover {
    filter: brightness(110%);
}

.cta-btn.secondary {
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-primary);
    margin-top: 10px;
}

.small-btn {
    padding: 5px 10px;
    background: #e2e8f0;
    color: var(--text-primary);
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.small-btn:hover {
    background: #cbd5e1;
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: 10px;
    padding: 0;
}

.back-btn:hover {
    color: white;
}

/* Quiz Interface */
.quiz-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-weight: 600;
}

.question-img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    margin-bottom: 15px;
    object-fit: contain;
}

.options-grid {
    display: grid;
    gap: 12px;
    margin-top: 25px;
}

.option-btn {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 15px;
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.option-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--theme-primary);
}

.option-btn.selected {
    background: var(--theme-primary);
    border-color: var(--theme-primary);
}

.option-btn.correct-answer {
    background: var(--success);
    border-color: var(--success);
    color: white;
    font-weight: 600;
}

/* Hints */
.hint-toggle {
    background: none;
    border: none;
    color: #fbbf24;
    cursor: pointer;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.hint-content {
    background: rgba(251, 191, 36, 0.1);
    border-left: 3px solid #fbbf24;
    padding: 10px;
    text-align: left;
    margin: 0 auto 20px auto;
    font-size: 0.9em;
    border-radius: 0 4px 4px 0;
}

/* Leaderboard */
.leaderboard {
    list-style: none;
    padding: 0;
    margin-top: 20px;
    text-align: left;
}

.leaderboard li {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard li:first-child {
    color: #fbbf24;
    font-weight: bold;
}

.score-display {
    margin: 20px 0;
}

.score-value {
    display: block;
    font-size: 3em;
    font-weight: 800;
    color: var(--success);
}

/* Admin Specific */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.admin-list {
    text-align: left;
}

.admin-quiz-item {
    background: rgba(0, 0, 0, 0.03);
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.admin-actions {
    display: flex;
    gap: 5px;
}

.theme-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.delete-btn {
    background: var(--error);
    color: white;
    border: none;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
}

/* Phase 3 Styles */
.controls-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.share-btn {
    background: #25D366;
    /* WhatsApp Green */
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.share-btn:hover {
    background: #128C7E;
}

.lang-select {
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: var(--text-primary);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    text-align: left;
}

.checkbox-group input {
    width: auto;
    margin: 0;
}

/* Tabs */
.lang-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tab {
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: bold;
}

.lang-input-group {
    display: none;
}

.lang-input-group.active {
    display: block;
    animation: fadeIn 0.3s;
}
