:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #10b981;
    --accent: #f59e0b;
    --bg-gradient-1: #1e1e2f;
    --bg-gradient-2: #2a2a40;
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --danger: #ef4444;
    --success: #22c55e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background: linear-gradient(135deg, var(--bg-gradient-1), var(--bg-gradient-2));
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
    padding: 20px;
}

/* Background animated shapes */
.background-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.shape {
    position: absolute;
    filter: blur(80px);
    border-radius: 50%;
    opacity: 0.5;
    animation: float 20s infinite alternate;
}

.shape1 {
    top: -10%;
    right: -10%;
    width: 40vw;
    height: 40vw;
    background: rgba(59, 130, 246, 0.4);
    animation-delay: 0s;
}

.shape2 {
    bottom: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: rgba(16, 185, 129, 0.3);
    animation-delay: -5s;
}

.shape3 {
    top: 40%;
    left: 20%;
    width: 30vw;
    height: 30vw;
    background: rgba(245, 158, 11, 0.2);
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

/* Glass panel */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

/* Views */
.view {
    display: none;
    animation: fadeInScale 0.4s ease-out forwards;
}

.view.active {
    display: block;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Typography elements */
h1 { font-size: 2rem; font-weight: 800; margin-bottom: 20px; text-align: center; }
h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 15px; }
h3 { font-size: 1.25rem; font-weight: 600; margin-bottom: 25px; line-height: 1.6; }
p { color: var(--text-muted); margin-bottom: 20px; line-height: 1.6; }
.highlight { color: var(--accent); }
.subtitle { font-size: 1.1rem; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-primary:disabled {
    background: #475569;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.7;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
    width: auto;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    margin-left: 15px;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Auth View */
.logo-container {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
    animation: float-small 6s ease-in-out infinite alternate;
}

@keyframes float-small {
    0% { transform: translateY(0); }
    100% { transform: translateY(-10px); }
}

.input-group {
    margin-bottom: 25px;
}

input {
    width: 100%;
    padding: 15px 20px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    color: white;
    font-size: 1rem;
    transition: border-color 0.3s;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.3);
}

/* Dashboard View */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 15px;
}

.quizzes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.quiz-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 140px;
    position: relative;
    overflow: hidden;
}

.quiz-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.quiz-card.completed {
    border-color: var(--success);
}

.quiz-card h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.quiz-status {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.score-badge {
    background: var(--success);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    position: absolute;
    top: 15px;
    left: 15px;
}

/* Quiz View */
.progress-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.4s ease;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
}

.option {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
}

.option:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.option.selected {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.2);
}

.option.correct {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.2);
}

.option.wrong {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.2);
}

.option.disabled {
    cursor: default;
    opacity: 0.8;
}

/* Result View */
.result-header {
    text-align: center;
    margin-bottom: 40px;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: conic-gradient(var(--success) 0%, transparent 0%);
    border: 8px solid rgba(255, 255, 255, 0.1);
    margin: 0 auto 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    transition: background 1s ease-out;
}

.score-circle::before {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: #1e1e2f;
    z-index: 1;
}

.score-circle span {
    position: relative;
    z-index: 2;
}

#final-score {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
}

.total-text {
    font-size: 1.2rem;
    color: var(--text-muted);
}

.result-details {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--success);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 600;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: all 0.4s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Utilities */
.mt-4 { margin-top: 1.5rem; }

/* Responsive adjustments */
@media (max-width: 600px) {
    .glass-panel {
        padding: 25px;
    }
    
    .quizzes-grid {
        grid-template-columns: 1fr;
    }
}
