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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Setup Instructions */
.setup-box {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.setup-box h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.setup-box ol {
    margin-left: 20px;
    line-height: 2;
}

.setup-box code {
    background: #f8f9fa;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: monospace;
    color: #667eea;
}

/* Auth Styles */
.auth-container {
    max-width: 450px;
    margin: 50px auto;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header .logo {
    font-size: 3em;
    margin-bottom: 15px;
}

.auth-header h1 {
    color: #667eea;
    font-size: 2em;
    margin-bottom: 10px;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.auth-tab {
    flex: 1;
    padding: 15px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1em;
    color: #666;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.auth-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: bold;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.error-message {
    color: #dc3545;
    font-size: 0.9em;
    margin-top: 5px;
    display: none;
}

.error-message.show {
    display: block;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

.success-message.show {
    display: block;
}

/* Buttons */
.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    margin-top: 10px;
}

.btn-success {
    background: #28a745;
    color: white;
}

/* Loading Spinner */
.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.loading.show {
    display: block;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Main App */
.app-container {
    display: none;
}

.app-container.show {
    display: block;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* User Info */
.user-info {
    background: rgba(255,255,255,0.2);
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    color: white;
}

.user-info-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    color: #667eea;
    font-weight: bold;
}

.btn-logout {
    padding: 10px 20px;
    background: rgba(255,255,255,0.3);
    border: 2px solid white;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: white;
    color: #667eea;
}

/* Dashboard */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card h3 {
    color: #667eea;
    font-size: 1.1em;
    margin-bottom: 15px;
}

.stat-value {
    font-size: 2.5em;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.streak-fire {
    font-size: 3em;
    margin-bottom: 10px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.5s ease;
}

/* Main Content */
.main-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
    flex-wrap: wrap;
}

.tab {
    padding: 15px 30px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1em;
    color: #666;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: bold;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Question Card */
.question-card {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 5px solid #667eea;
}

.question-number {
    color: #667eea;
    font-weight: bold;
    margin-bottom: 10px;
}

.question-text {
    font-size: 1.2em;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Options */
.options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option {
    padding: 15px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.option.selected {
    border-color: #667eea;
    background: #e8eeff;
}

.option.correct {
    border-color: #28a745;
    background: #d4edda;
}

.option.incorrect {
    border-color: #dc3545;
    background: #f8d7da;
}

/* Explanation */
.explanation {
    margin-top: 20px;
    padding: 20px;
    background: #fff3cd;
    border-left: 5px solid #ffc107;
    border-radius: 8px;
    display: none;
}

.explanation.show {
    display: block;
}

.explanation h4 {
    color: #856404;
    margin-bottom: 10px;
}

/* Button Group */
.button-group {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

/* Timer */
.timer {
    text-align: center;
    font-size: 1.5em;
    color: #667eea;
    margin: 20px 0;
}

/* Leaderboard */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.leaderboard-table th {
    background: #f8f9fa;
    color: #667eea;
    font-weight: bold;
}

.leaderboard-table tr:hover {
    background: #f8f9fa;
}

.rank-medal {
    font-size: 1.5em;
    margin-right: 10px;
}

.current-user {
    background: #e8eeff !important;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stats-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.stats-item h4 {
    color: #667eea;
    margin-bottom: 10px;
}

.stats-item .value {
    font-size: 2em;
    font-weight: bold;
    color: #333;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }

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

    .tabs {
        flex-direction: column;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .auth-container {
        padding: 30px 20px;
    }

    .user-info {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .leaderboard-table {
        font-size: 0.9em;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 10px 5px;
    }
}
