/* ========================================
   Variables et Thème
======================================== */
:root {
    /* Couleurs principales */
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #48bb78;
    --warning-color: #f6ad55;
    --danger-color: #fc8181;
    --info-color: #4299e1;
    
    /* Couleurs de base */
    --bg-primary: #ffffff;
    --bg-secondary: #f7fafc;
    --bg-card: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --text-muted: #a0aec0;
    
    /* Bordures et ombres */
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.1), 0 10px 10px rgba(0,0,0,0.04);
    
    /* Animations */
    --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Border radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
}

/* Mode sombre */
[data-theme="dark"] {
    --bg-primary: #1a202c;
    --bg-secondary: #2d3748;
    --bg-card: #2d3748;
    --text-primary: #f7fafc;
    --text-secondary: #cbd5e0;
    --text-muted: #718096;
    --border-color: #4a5568;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.3);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.3);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: var(--transition-base);
    min-height: 100vh;
    position: relative;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Quicksand', sans-serif;
    font-weight: 600;
}

/* ========================================
   Header
======================================== */
.navbar {
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
    transition: var(--transition-base);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    color: var(--primary-color);
    animation: pulse 2s infinite;
}

.logo-container i:first-child {
    color: var(--primary-color);
}

.logo-container i:last-child {
    color: var(--danger-color);
}

.brand-text {
    font-size: 1.5rem;
    font-weight: 700;
    margin-left: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    position: relative;
}

.btn-icon:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* ========================================
   Welcome Section
======================================== */
.welcome-section {
    margin-top: 2rem;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.avatar-container {
    position: relative;
}

.avatar-mascot {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
    animation: float 3s ease-in-out infinite;
}

.avatar-mascot i {
    font-size: 3rem;
    color: white;
}

.mascot-message {
    background: var(--bg-card);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-top: 1rem;
    position: relative;
    animation: slideInUp 0.5s ease;
}

.mascot-message::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid var(--bg-card);
}

/* ========================================
   Countdown Section
======================================== */
.countdown-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition-base);
    height: 100%;
}

.countdown-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.countdown-card.regional {
    border-top: 4px solid var(--info-color);
}

.countdown-card.national {
    border-top: 4px solid var(--success-color);
}

.countdown-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.countdown-header i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.countdown-header h4 {
    margin: 0;
    color: var(--text-primary);
}

.countdown-timer {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1rem;
}

.time-unit {
    text-align: center;
}

.time-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
    animation: pulse 2s infinite;
}

.time-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.countdown-date {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* ========================================
   Progress Section
======================================== */
.daily-progress-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition-base);
}

.progress-wrapper .progress {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    transition: width 0.6s ease;
}

.progress-text {
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.progress-stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.stat-item i {
    font-size: 1.25rem;
}

/* ========================================
   Tasks Section
======================================== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title {
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-title i {
    color: var(--primary-color);
}

.tasks-container {
    display: grid;
    gap: 1rem;
}

.task-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
    border-left: 4px solid transparent;
    position: relative;
    overflow: hidden;
}

.task-card:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.task-card.svt { border-left-color: #22c55e; }
.task-card.math { border-left-color: #3b82f6; }
.task-card.physique { border-left-color: #f59e0b; }
.task-card.arabe { border-left-color: #dc2626; }
.task-card.anglais { border-left-color: #a855f7; }
.task-card.francais { border-left-color: #ec4899; }
.task-card.histoire { border-left-color: #8b5cf6; }
.task-card.philosophie { border-left-color: #10b981; }
.task-card.islamique { border-left-color: #14b8a6; }
.task-card.medecine { border-left-color: #ef4444; }

.task-card.completed {
    opacity: 0.7;
    background: linear-gradient(135deg, rgba(72, 187, 120, 0.1), rgba(72, 187, 120, 0.05));
}

.task-card.completed::after {
    content: '✓';
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    color: var(--success-color);
    animation: bounceIn 0.5s;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.task-info h4 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.task-info .task-duration {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.task-icon {
    font-size: 1.5rem;
    margin-right: 0.5rem;
}

.task-progress {
    margin: 1rem 0;
}

.task-progress .progress {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.task-progress .progress-bar {
    transition: width 0.3s ease;
}

.task-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-task {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: var(--transition-fast);
    cursor: pointer;
}

.btn-start {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-start:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-complete {
    background: var(--success-color);
    color: white;
}

.btn-complete:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-task:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   Sunday Rest
======================================== */
.rest-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 3rem;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.5s ease;
}

.rest-card i.fa-spa {
    color: var(--primary-color);
    animation: float 3s ease-in-out infinite;
}

.quote-card {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-radius: var(--radius-lg);
    padding: 2rem;
    position: relative;
}

.quote-card i {
    color: var(--primary-color);
    opacity: 0.3;
    font-size: 1.5rem;
}

.quote-text {
    font-size: 1.25rem;
    font-style: italic;
    color: var(--text-primary);
    margin: 1rem 0;
}

/* ========================================
   Weekly Section
======================================== */
.weekly-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.week-days {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.week-day {
    flex: 1;
    min-width: 60px;
    text-align: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.week-day:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.week-day.current {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.day-name {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.day-progress i {
    font-size: 1.5rem;
}

.day-progress .fa-circle {
    color: var(--text-muted);
}

.day-progress .fa-check-circle {
    color: var(--success-color);
    animation: bounceIn 0.5s;
}

.day-progress .fa-bed {
    color: var(--info-color);
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card i {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.stat-card h5 {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

/* ========================================
   Footer
======================================== */
.footer {
    background: var(--bg-card);
    padding: 2rem 0;
    margin-top: auto;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.quote-of-day {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
}

.quote-of-day i {
    color: var(--warning-color);
    font-size: 1.25rem;
}

/* ========================================
   Modals
======================================== */
.modal-content {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
}

.timer-display {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 2rem auto;
}

.timer-svg {
    transform: rotate(-90deg);
}

.timer-circle-bg {
    fill: none;
    stroke: var(--bg-secondary);
    stroke-width: 10;
}

.timer-circle-progress {
    fill: none;
    stroke: url(#gradient);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 565.48;
    transition: stroke-dashoffset 1s linear;
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.celebration-content {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
}

.celebration-icon {
    margin: 2rem 0;
}

.celebration-reward {
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    margin: 1rem 0;
}

/* ========================================
   Canvas Confetti
======================================== */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* ========================================
   Animations
======================================== */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes bounceIn {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ========================================
   Responsive Design
======================================== */
@media (max-width: 768px) {
    .brand-text {
        font-size: 1.2rem;
    }
    
    .avatar-mascot {
        width: 80px;
        height: 80px;
    }
    
    .avatar-mascot i {
        font-size: 2rem;
    }
    
    .time-value {
        font-size: 2rem;
    }
    
    .week-days {
        justify-content: center;
    }
    
    .week-day {
        min-width: 50px;
        padding: 0.75rem 0.5rem;
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .task-actions {
        flex-direction: column;
    }
    
    .progress-stats {
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .display-4 {
        font-size: 2.5rem;
    }
    
    .countdown-timer {
        gap: 0.5rem;
    }
    
    .time-value {
        font-size: 1.5rem;
    }
    
    .footer .row {
        text-align: center;
    }
    
    .footer .col-md-6:last-child {
        margin-top: 1rem;
    }
}

/* ========================================
   Utilities
======================================== */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glow {
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px var(--primary-color),
                    0 0 10px var(--primary-color),
                    0 0 15px var(--primary-color);
    }
    50% {
        box-shadow: 0 0 10px var(--primary-color),
                    0 0 20px var(--primary-color),
                    0 0 30px var(--primary-color);
    }
}

.shake {
    animation: shake 0.5s;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}