:root {
    --primary-color: #b91c1c;
    --primary-dark: #991b1b;
    --accent-color: #166534;
    --holiday-green: #16a34a;
    --holiday-red: #ef4444;
    --holiday-gold: #f59e0b;
    --holiday-snow: #ffffff;
    --api-status-bg-start: rgba(6, 78, 59, 0.78);
    --api-status-bg-end: rgba(21, 128, 61, 0.62);
    --api-status-text: #f0fdf4;
    --api-status-border: rgba(209, 250, 229, 0.55);
    --api-status-shadow: rgba(6, 78, 59, 0.45);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--holiday-red) 0%, var(--holiday-green) 100%);
    min-height: 100vh;
    color: #333;
    position: relative;
    overflow-x: hidden;
}

body.season-hiver {
    --primary-color: #1e3a8a;
    --primary-dark: #1e40af;
    --accent-color: #0f766e;
    --holiday-green: #0f766e;
    --holiday-red: #60a5fa;
    --holiday-gold: #93c5fd;
    --holiday-snow: #dbeafe;
    --api-status-bg-start: rgba(15, 23, 42, 0.78);
    --api-status-bg-end: rgba(30, 64, 175, 0.62);
    --api-status-text: #eff6ff;
    --api-status-border: rgba(191, 219, 254, 0.52);
    --api-status-shadow: rgba(15, 23, 42, 0.42);
}

body.season-printemps {
    --primary-color: #9d174d;
    --primary-dark: #831843;
    --accent-color: #15803d;
    --holiday-green: #22c55e;
    --holiday-red: #f9a8d4;
    --holiday-gold: #86efac;
    --holiday-snow: #fdf2f8;
    --api-status-bg-start: rgba(21, 128, 61, 0.82);
    --api-status-bg-end: rgba(22, 163, 74, 0.66);
    --api-status-text: #f0fdf4;
    --api-status-border: rgba(220, 252, 231, 0.58);
    --api-status-shadow: rgba(21, 128, 61, 0.36);
}

body.season-paques {
    --primary-color: #6d28d9;
    --primary-dark: #5b21b6;
    --accent-color: #0f766e;
    --holiday-green: #a78bfa;
    --holiday-red: #f9a8d4;
    --holiday-gold: #fcd34d;
    --holiday-snow: #f5f3ff;
    --api-status-bg-start: rgba(91, 33, 182, 0.8);
    --api-status-bg-end: rgba(124, 58, 237, 0.64);
    --api-status-text: #f5f3ff;
    --api-status-border: rgba(233, 213, 255, 0.58);
    --api-status-shadow: rgba(76, 29, 149, 0.38);
}

body.season-ete {
    --primary-color: #9a3412;
    --primary-dark: #7c2d12;
    --accent-color: #ca8a04;
    --holiday-green: #f59e0b;
    --holiday-red: #f97316;
    --holiday-gold: #facc15;
    --holiday-snow: #fffbeb;
    --api-status-bg-start: rgba(146, 64, 14, 0.82);
    --api-status-bg-end: rgba(217, 119, 6, 0.66);
    --api-status-text: #fffbeb;
    --api-status-border: rgba(254, 243, 199, 0.58);
    --api-status-shadow: rgba(120, 53, 15, 0.4);
}

body.season-automne {
    --primary-color: #7c2d12;
    --primary-dark: #9a3412;
    --accent-color: #14532d;
    --holiday-green: #65a30d;
    --holiday-red: #c2410c;
    --holiday-gold: #d97706;
    --holiday-snow: #fff7ed;
    --api-status-bg-start: rgba(120, 53, 15, 0.82);
    --api-status-bg-end: rgba(101, 163, 13, 0.62);
    --api-status-text: #fffbeb;
    --api-status-border: rgba(254, 215, 170, 0.52);
    --api-status-shadow: rgba(120, 53, 15, 0.42);
}
body::before {
    content: '';
    position: fixed;
    top: -200px;
    left: 0;
    width: 100%;
    height: 200%;
    pointer-events: none;
    background-image: radial-gradient(var(--holiday-snow) 1.5px, transparent 1.5px), radial-gradient(var(--holiday-snow) 1px, transparent 1px);
    background-size: 20px 20px, 30px 30px;
    background-position: 0 0, 10px 15px;
    opacity: 0.25;
    animation: snowfall 20s linear infinite;
}
@keyframes snowfall {
    0% { transform: translateY(0); }
    100% { transform: translateY(100px); }
}

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

header {
    text-align: center;
    margin-bottom: 40px;
    background: rgba(255, 255, 255, 0.96);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.25);
    border: 2px solid var(--holiday-gold);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

header p {
    font-size: 1.1rem;
    color: #718096;
}

.api-status {
    margin-top: 15px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--api-status-bg-start) 0%, var(--api-status-bg-end) 100%);
    color: var(--api-status-text);
    border-radius: 25px;
    border: 1px solid var(--api-status-border);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 24px var(--api-status-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.status-indicator {
    font-size: 1.1rem;
}

section {
    background: rgba(255, 255, 255, 0.95);
    margin-bottom: 30px;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.6rem;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-weight: 600;
    color: var(--primary-color);
}

.input-group input {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.input-group input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.upload-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    border: 2px dashed #cbd5e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-label:hover {
    border-color: var(--primary-color);
    background: #fff5f5;
}

.upload-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.file-input {
    display: none;
}

.file-status {
    margin-top: 10px;
    font-size: 0.9rem;
    text-align: center;
}

.file-status.success {
    color: #059669;
}

.file-status.error {
    color: #dc2626;
}

.analysis-section {
    text-align: center;
    margin-top: 30px;
}

.action-btn, .analyze-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.action-btn:hover, .analyze-btn:hover {
    background: var(--primary-dark);
}

.action-btn:disabled, .analyze-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
}

/* Page Navigation */
.page-navigation {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.nav-btn {
    padding: 12px 24px;
    border: none;
    background: white;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.nav-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 5px 15px rgba(220, 38, 38, 0.3);
}

.page-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

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

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

/* Investment Section */
.investment-section {
    display: none; /* Controlled by JS */
}

.student-investment-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.student-investment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.investment-criteria {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.criteria-group {
    padding: 15px;
    border-radius: 8px;
}

.criteria-group.positive {
    background-color: rgba(22, 163, 74, 0.05);
    border: 1px solid rgba(22, 163, 74, 0.2);
}

.criteria-group.positive h4 {
    color: #15803d;
    border-bottom: 2px solid #15803d;
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.criteria-group.negative {
    background-color: rgba(220, 38, 38, 0.05);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.criteria-group.negative h4 {
    color: #b91c1c;
    border-bottom: 2px solid #b91c1c;
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.criterion-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    cursor: pointer;
}

.criterion-text {
    font-size: 0.9rem;
    color: #4a5568;
}

/* Import Methods */
.import-method-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.method-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.method-btn:hover {
    background: #f8f9fa;
}

.method-btn.active {
    background: #ebf8ff;
    border-color: #4299e1;
    color: #2b6cb0;
}

.import-content > div {
    display: none;
}

.import-content > div.active {
    display: block;
}

.csv-paste-area {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    font-family: monospace;
    font-size: 0.85rem;
    resize: vertical;
    margin-bottom: 10px;
}

.csv-paste-area:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.validate-paste-btn {
    width: 100%;
    padding: 10px;
    background: #48bb78;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    transition: background 0.2s;
}

.validate-paste-btn:hover {
    background: #38a169;
}

.validate-paste-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
}

/* CSV Preview */
.csv-preview-section {
    margin-top: 20px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.csv-preview-container {
    overflow-x: auto;
}

.preview-controls {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.validate-btn {
    background: var(--holiday-green);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-btn {
    background: #718096;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Progress Section */
.progress-section {
    text-align: center;
    padding: 40px;
}

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

.progress-bar {
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 15px auto;
}

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

/* Results */
.results-section {
    margin-top: 30px;
}

.results-controls {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 15px;
}

.export-btn, .copy-btn {
    background: white;
    border: 1px solid #cbd5e0;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.export-btn:hover, .copy-btn:hover {
    background: #edf2f7;
    border-color: #a0aec0;
}

.results-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.student-result {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.student-result .student-name {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 10px;
    display: block;
}

.appreciation-text {
    font-style: italic;
    color: #2d3748;
    line-height: 1.5;
}

/* Bulletin Prof Principal */
.bulletin-section {
    /* Standard section style */
}

.bulletin-textarea {
    width: 100%;
    min-height: 400px;
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-family: monospace;
    font-size: 0.9rem;
    resize: vertical;
    margin-bottom: 15px;
}

.bulletin-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.bulletin-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.generate-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.generate-btn:hover {
    background: var(--primary-dark);
}

.generate-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
}

.clear-btn {
    background: #e53e3e;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.clear-btn:hover {
    background: #c53030;
}

.new-btn {
    background: var(--holiday-gold);
    color: white;
    border: none;
    padding: 8px 20px;
    font-size: 0.95rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.new-btn:hover {
    background: #d97706;
}

.bulletin-general-appreciation {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.general-appreciation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.general-appreciation-text {
    line-height: 1.6;
    color: #2d3748;
}

.copy-appreciation-btn {
    background: none;
    border: 1px solid #cbd5e0;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.copy-appreciation-btn:hover {
    background: #f7fafc;
}

/* Trimester Selection */
.trimester-selection {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.trimester-label {
    font-weight: 600;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 8px;
}

.trimester-select {
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    color: #2d3748;
    background-color: white;
    cursor: pointer;
}

.trimester-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Paste Area Header */
.paste-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.paste-label {
    font-weight: 600;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 8px;
}

.paste-btn {
    background: #4299e1;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.paste-btn:hover {
    background: #3182ce;
}

.paste-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
}

/* Help Sidebar */
.help-toggle-btn {
    position: absolute;
    top: 30px;
    right: 30px;
    background: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--primary-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.help-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.help-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 25px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.help-sidebar.active, .help-sidebar.open {
    right: 0;
}

.help-sidebar-header {
    padding: 20px;
    background: var(--primary-color);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-sidebar-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

.help-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.help-content-section {
    display: none;
}

.help-content-section.active {
    display: block;
}

.help-step {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.step-number {
    width: 30px;
    height: 30px;
    background: var(--holiday-gold);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.step-content h4 {
    margin-bottom: 5px;
    color: #2d3748;
}

.step-content p {
    font-size: 0.9rem;
    color: #718096;
    line-height: 1.5;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 768px) {
    .bulletin-grid {
        grid-template-columns: 1fr;
    }
    
    .help-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .investment-criteria {
        grid-template-columns: 1fr;
    }
    
    .investment-controls {
        flex-direction: column;
    }
}
