:root {
    --bg-dark: #0f172a;
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #ec4899;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    line-height: 1.5;
    overflow-x: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    height: 70px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

h1 {
    font-weight: 700;
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Buttons */
button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    color: var(--text-light);
    transition: all 0.2s ease;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
}

.icon-btn:active {
    transform: scale(0.95);
    background: rgba(255,255,255,0.1);
}

.primary-btn, .secondary-btn {
    padding: 14px 24px;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.secondary-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
}

.mt-4 {
    margin-top: 1rem;
}

/* Main Container */
main {
    flex: 1;
    overflow-y: auto;
    position: relative;
    padding-bottom: 40px;
}

/* Views Container */
.view {
    padding: 20px;
    animation: fadeIn 0.3s ease forwards;
}

.hidden {
    display: none !important;
}

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

/* Home / Courses */
.header-text {
    margin-bottom: 24px;
}

.header-text h2 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    line-height: 1.2;
}

.header-text p {
    color: var(--text-muted);
}

.grid-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.course-card {
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--glass-shadow);
}

.course-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0));
    pointer-events: none;
}

.course-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
}

.course-card h3 {
    font-size: 1.4rem;
    font-weight: 600;
}

.course-card p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Course Details List */
.course-banner {
    margin-bottom: 24px;
    padding: 24px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    border: 1px solid var(--glass-border);
}

.course-banner h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.course-banner p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.item-card {
    display: flex;
    height: 120px;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.item-card img {
    width: 100px;
    height: 100%;
    object-fit: cover;
}

.item-info {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.item-info .badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    margin-bottom: 4px;
}

.item-info h4 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.item-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card Details (Fiche Explicative) */
#view-card-details {
    padding: 0;
}

.card-hero {
    position: relative;
    height: 35vh;
    width: 100%;
}

.card-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 20px 20px;
    background: linear-gradient(to top, var(--bg-dark) 0%, transparent 100%);
}

.badge {
    background: rgba(236, 72, 153, 0.2);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 8px;
}

.card-hero h2 {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
}

.card-content {
    padding: 20px;
}

.action-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.audio-player {
    display: flex;
    align-items: center;
    padding: 16px;
    gap: 16px;
    margin-bottom: 24px;
}

.icon-btn-large {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
}

.audio-info {
    display: flex;
    flex-direction: column;
}

.audio-info span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.text-content h3 {
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.text-content p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Modals */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    width: 100%;
    max-width: 400px;
    padding: 30px 20px;
    position: relative;
    border-radius: var(--radius-lg);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
}

.top-right {
    top: 40px;
    right: 20px;
    z-index: 1001;
    background: rgba(0,0,0,0.5);
}

.full-modal {
    padding: 0;
    background: black;
}

/* Quiz Styles */
.text-center { text-align: center; }

.quiz-progress {
    font-size: 0.85rem;
    color: var(--accent);
    margin-bottom: 12px;
    font-weight: 600;
}

#quiz-question-text {
    font-size: 1.2rem;
    margin-bottom: 24px;
    line-height: 1.4;
}

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

.option-btn {
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    text-align: left;
    font-size: 1rem;
}

.option-btn.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.2);
}

.option-btn.correct {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.2);
}

.option-btn.wrong {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.2);
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) 100%, var(--glass-bg) 0);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px auto;
    font-size: 2rem;
    font-weight: 700;
    position: relative;
}

.score-circle::before {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    background: #172138;
    border-radius: 50%;
}

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

/* AR Viewer */
model-viewer {
    width: 100%;
    height: 100%;
    background-color: #000;
    --poster-color: transparent;
}

#ar-prompt {
    position: absolute;
    left: 50%;
    bottom: 100px;
    transform: translateX(-50%);
    text-align: center;
    color: white;
    background: rgba(0,0,0,0.6);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    pointer-events: none;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

.floating-ar-btn {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    color: black;
    padding: 15px 30px;
    border-radius: 30px;
    font-weight: bold;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

@media (min-width: 768px) {
    body {
        /* Restrict app width on desktop to simulate mobile */
        max-width: 480px;
        margin: 0 auto;
        border-left: 1px solid var(--glass-border);
        border-right: 1px solid var(--glass-border);
        box-shadow: 0 0 50px rgba(0,0,0,0.5);
    }
}
