/*
=========================================================
Projet : Outil Pédagogique Eurocode 2 (Calcul Béton Armé)
Auteur : Raphaël ELIARD
Description : Feuille de styles globale (variables de thèmes, 
              composants graphiques, cotations et mise en page PDF).
=========================================================
*/
/* ==========================================
   1. VARIABLES & THÈMES
   ========================================== */
:root {
    --bg-gradient: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
    --surface-color: rgba(255, 255, 255, 0.65);
    --inner-bg: rgba(255, 255, 255, 0.5);
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --primary: #3498db;
    --primary-hover: #2980b9;
    --border-color: rgba(255, 255, 255, 0.4);
    --shadow: 0 8px 32px rgba(31, 38, 135, 0.1);
    --danger: #e74c3c;
    --warning: #f39c12;
    --success: #2ecc71;
    --transition: all 0.3s ease;
    --glass-blur: blur(16px);
}

[data-theme="dark"] {
    --bg-gradient: radial-gradient(circle at top left, #12151c 0%, #000000 100%);
    --surface-color: rgba(18, 18, 18, 0.5);
    --inner-bg: rgba(0, 0, 0, 0.4);
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --primary: #4dabf7;
    --primary-hover: #3b8cd9;
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

/* ==========================================
   2. HEADER & NAVIGATION
   ========================================== */
header {
    background-color: var(--surface-color);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.logo { font-size: 1.5rem; font-weight: bold; color: var(--primary); display: flex; align-items: center; gap: 10px; }
.back-link { color: var(--primary); text-decoration: none; font-weight: bold; }

.theme-toggle {
    background: none; border: 2px solid var(--border-color); border-radius: 20px;
    padding: 5px 15px; cursor: pointer; color: var(--text-main); font-weight: 600;
    transition: var(--transition);
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* ==========================================
   3. LAYOUTS (INDEX, CONTACT & DASHBOARD)
   ========================================== */
.container-index { flex: 1; padding: 2rem; max-width: 1200px; margin: 0 auto; width: 100%; }
.container-contact { flex: 1; padding: 2rem; max-width: 800px; margin: 0 auto; width: 100%; }

.dashboard {
    display: grid; grid-template-columns: 1fr; gap: 1.5rem; padding: 1.5rem; max-width: 1400px; margin: 0 auto; flex: 1;
}
@media (min-width: 1024px) {
    .dashboard { grid-template-columns: 300px 1fr 450px; }
}

.panel {
    background-color: var(--surface-color); border-radius: 12px; padding: 1.5rem;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow); border: 1px solid var(--border-color);
    transition: var(--transition);
}
.panel-contact { padding: 2.5rem; }

h1 { font-size: 2rem; margin-bottom: 1.5rem; color: var(--primary); border-bottom: 2px solid var(--border-color); padding-bottom: 0.5rem; }
.panel h2 { font-size: 1.2rem; margin-bottom: 1rem; color: var(--primary); border-bottom: 2px solid var(--border-color); padding-bottom: 0.5rem; }
.panel h2.contact-title { font-size: 1.3rem; margin-top: 2rem; margin-bottom: 0.8rem; color: var(--text-main); border: none; padding-bottom: 0; }
p { margin-bottom: 1rem; color: var(--text-muted); font-size: 1.05rem; }

/* ==========================================
   4. COMPOSANTS (ACCUEIL)
   ========================================== */
.hero { text-align: center; margin-bottom: 3rem; }
.hero h1 { font-size: 2.5rem; margin-bottom: 0.5rem; border: none; padding-bottom: 0; }
.hero p { color: var(--text-muted); font-size: 1.1rem; margin-bottom: 0; }

.modules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.module-card {
    background-color: var(--surface-color); border: 1px solid var(--border-color);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 12px; padding: 1.5rem; text-decoration: none; color: var(--text-main);
    box-shadow: var(--shadow); transition: var(--transition); display: flex; flex-direction: column; gap: 10px;
}
.module-card:hover { transform: translateY(-5px); border-color: var(--primary); box-shadow: 0 8px 15px rgba(52, 152, 219, 0.2); }
.module-icon { font-size: 2rem; margin-bottom: 10px; }
.module-title { font-size: 1.2rem; font-weight: bold; }
.module-desc { font-size: 0.9rem; color: var(--text-muted); line-height: 1.4; }

.module-status { margin-top: auto; font-size: 0.8rem; font-weight: bold; padding: 4px 8px; border-radius: 4px; display: inline-block; width: max-content; }
.status-ready { background-color: rgba(46, 204, 113, 0.2); color: var(--success); }
.status-dev { background-color: rgba(241, 196, 15, 0.2); color: var(--warning); }

/* ==========================================
   5. FORMULAIRES & INPUTS
   ========================================== */
.input-group { margin-bottom: 1rem; }
label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 0.3rem; }
input, select {
    width: 100%; padding: 0.5rem; border: 1px solid var(--border-color);
    border-radius: 6px; background: var(--inner-bg); color: var(--text-main);
    transition: var(--transition);
}

/* ==========================================
   6. RÉSULTATS MATHÉMATIQUES & BADGES
   ========================================== */
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.result-card {
    background: var(--inner-bg); border: 1px solid var(--border-color); border-radius: 8px;
    padding: 1rem; text-align: center; cursor: pointer; transition: var(--transition);
}
.result-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.result-value { font-size: 1.5rem; font-weight: bold; color: var(--primary); margin: 0.5rem 0; }
.clickable-hint { font-size: 0.8rem; color: var(--text-muted); }

.status-badge {
    display: inline-block; padding: 0.5rem 1rem; border-radius: 20px;
    font-weight: bold; width: 100%; text-align: center; margin-bottom: 1rem;
}
.status-green { background-color: rgba(46, 204, 113, 0.2); color: var(--success); }
.status-red { background-color: rgba(231, 76, 60, 0.2); color: var(--danger); }
.status-orange { background-color: rgba(241, 196, 15, 0.2); color: var(--warning); }

/* ==========================================
   7. FERRAILLAGE & INTERFACE SVG
   ========================================== */
.svg-container {
    width: 100%; aspect-ratio: 1; background-color: var(--inner-bg);
    border: 1px dashed var(--border-color); border-radius: 8px;
    display: flex; justify-content: center; align-items: center;
}
svg { max-width: 100%; max-height: 100%; }

.steel-selector {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
    gap: 0.5rem; margin-bottom: 1rem;
}
.steel-btn {
    padding: 0.4rem; border: 2px solid var(--border-color); background: var(--inner-bg);
    color: var(--text-main); border-radius: 6px; cursor: pointer; font-weight: 600; transition: var(--transition);
}
.steel-btn:hover { border-color: var(--primary); }
.steel-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.ferraillage-info { font-size: 0.85rem; background: var(--inner-bg); padding: 0.75rem; border-radius: 6px; margin-bottom: 1rem; }
.ferraillage-info div { margin: 0.3rem 0; }
.info-label { font-weight: 600; color: var(--primary); }

.view-toggles { display: flex; gap: 10px; margin-bottom: 1rem; }
.view-btn {
    flex: 1; padding: 0.5rem; border: 2px solid var(--border-color); background: var(--inner-bg);
    color: var(--text-main); border-radius: 6px; cursor: pointer; font-weight: 600; transition: var(--transition);
}
.view-btn:hover { border-color: var(--primary); }
.view-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.export-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 1rem; }
.export-btn { padding: 0.6rem; background: var(--primary); color: white; border: none; border-radius: 6px; cursor: pointer; font-weight: 600; transition: var(--transition); }
.export-btn:hover { background: var(--primary-hover); }
.export-btn:disabled { background: var(--text-muted); cursor: not-allowed; }

/* ==========================================
   8. COMPOSANTS (CONTACT) & FOOTER
   ========================================== */
.contact-list { list-style: none; margin-bottom: 1.5rem; padding-left: 0.5rem; }
.contact-list li { margin-bottom: 0.8rem; font-size: 1.05rem; }
.contact-list a { color: var(--primary); text-decoration: none; font-weight: 600; }
.contact-list a:hover { text-decoration: underline; color: var(--primary-hover); }
.portfolio-link { display: inline-block; margin-top: 1rem; padding: 0.8rem 1.5rem; background-color: var(--primary); color: white; text-decoration: none; border-radius: 8px; font-weight: bold; transition: var(--transition); }
.portfolio-link:hover { background-color: var(--primary-hover); transform: translateY(-2px); }

footer { text-align: center; padding: 1rem; color: var(--text-muted); font-size: 0.9rem; background-color: var(--surface-color);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--border-color); width: 100%; margin-top: auto; }

/* ==========================================
   9. MODALES (POP-UPS)
   ========================================== */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(3px);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000; opacity: 0; visibility: hidden; transition: var(--transition);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-content {
    background: var(--surface-color); padding: 2rem; border-radius: 12px;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    max-width: 500px; width: 90%; box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    border: 1px solid var(--border-color); transform: translateY(-20px);
    transition: var(--transition);
}
.modal-overlay.active .modal-content { transform: translateY(0); }
.modal-title { color: var(--primary); font-size: 1.25rem; margin-bottom: 1rem; border-bottom: 2px solid var(--border-color); padding-bottom: 0.5rem; font-weight: bold; }
.modal-body { color: var(--text-main); font-size: 1.05rem; line-height: 1.6; white-space: pre-line; margin-bottom: 1.5rem; }
.modal-close {
    background: var(--primary); color: white; border: none; padding: 0.6rem 1.5rem;
    border-radius: 6px; cursor: pointer; font-weight: bold; float: right; transition: var(--transition);
}
.modal-close:hover { background: var(--primary-hover); }

/* ==========================================
   10. SYSTEME DE RENDU PDF HIGH-FIDELITY (A4)
   ========================================== */
#pdf-report-template {
    position: absolute;
    left: 0;
    top: 0;
    width: 210mm;
    z-index: -9999;
}

.pdf-page {
    width: 210mm;
    height: 297mm;
    padding: 18mm 15mm;
    background: #ffffff;
    color: #2c3e50;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 9.5pt;
    line-height: 1.45;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    border-bottom: 1px solid #e0e0e0;
}

.pdf-header {
    border-bottom: 2px solid #3498db;
    padding-bottom: 6px;
    margin-bottom: 12px;
}

.pdf-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pdf-header-title {
    font-size: 15pt;
    font-weight: bold;
    color: #2980b9;
}

.pdf-header-subtitle {
    font-size: 8.5pt;
    color: #7f8c8d;
    margin-top: 3px;
}

.pdf-header-badge {
    background: #eaf2f8;
    color: #2980b9;
    border: 1px solid #a9cce3;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 8pt;
    font-weight: bold;
}

.pdf-footer {
    border-top: 1px solid #e0e0e0;
    padding-top: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 8pt;
    color: #95a5a6;
}

.pdf-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pdf-section-title {
    font-size: 11.5pt;
    font-weight: bold;
    color: #2c3e50;
    margin: 12px 0 6px 0;
    border-bottom: 1px dashed #bdc3c7;
    padding-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pdf-description {
    font-size: 8.5pt;
    color: #555555;
    margin-bottom: 8px;
    line-height: 1.4;
    text-align: justify;
}

.pdf-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
}

.pdf-table th, .pdf-table td {
    border: 1px solid #bdc3c7;
    padding: 5px 7px;
    font-size: 8.5pt;
    text-align: left;
}

.pdf-table th {
    background-color: #f2f4f4;
    color: #34495e;
    font-weight: bold;
}

.pdf-table tr:nth-child(even) td {
    background-color: #fafbfc;
}

.pdf-formula-card {
    background: #f8f9f9;
    border-left: 4px solid #3498db;
    border-radius: 0 6px 6px 0;
    padding: 8px 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.pdf-formula-title {
    font-weight: bold;
    font-size: 9pt;
    color: #2c3e50;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
}

.pdf-formula-ref {
    font-size: 8pt;
    color: #7f8c8d;
    font-style: italic;
}

.pdf-formula-math {
    font-family: 'Georgia', serif;
    font-size: 10.5pt;
    color: #1a252f;
    margin: 3px 0;
    display: block;
    letter-spacing: 0.2px;
}

.pdf-formula-values {
    font-family: 'Georgia', serif;
    font-size: 9.5pt;
    color: #5d6d7e;
    margin-bottom: 3px;
    display: block;
    letter-spacing: 0.2px;
}

.pdf-formula-result {
    font-weight: bold;
    font-size: 10pt;
    color: #27ae60;
}

.pdf-math-frac {
    display: inline-flex;
    flex-direction: column;
    vertical-align: middle;
    text-align: center;
    padding: 0 4px;
}

.pdf-math-num {
    border-bottom: 1px solid #2c3e50;
    padding-bottom: 1px;
}

.pdf-math-den {
    padding-top: 1px;
}

.pdf-variables-list {
    margin-bottom: 8px;
    font-size: 8pt;
    color: #566573;
    padding-left: 15px;
    line-height: 1.35;
}

.pdf-variables-list li {
    margin-bottom: 2px;
}

.pdf-variables-list strong {
    color: #2c3e50;
}

.pdf-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.pdf-grid-2 .pdf-formula-card {
    margin-bottom: 0;
}

.pdf-variables-list:last-child {
    margin-bottom: 0;
}


.pdf-compliance-box {
    border: 1px solid #d5dbdb;
    border-radius: 6px;
    padding: 8px 12px;
    background: #fafbfc;
}

.pdf-compliance-box.success {
    border-color: #2ecc71;
    background: #f4fbf7;
}

.pdf-compliance-box.danger {
    border-color: #e74c3c;
    background: #fdf5f5;
}

.pdf-compliance-title {
    font-weight: bold;
    font-size: 9pt;
    color: #2c3e50;
    margin-bottom: 3px;
}

.pdf-compliance-status {
    font-size: 10.5pt;
    font-weight: bold;
    color: #27ae60;
}

.pdf-compliance-status.danger {
    color: #c0392b;
}

.pdf-diagram-container {
    border: 1px dashed #bdc3c7;
    border-radius: 6px;
    background: #fbfcfc;
    padding: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 8px;
    flex: 1;
    max-height: 120mm;
}

.pdf-diagram-container svg {
    max-width: 100%;
    max-height: 100%;
}

/* ==========================================
   11. STYLE DE LA VISITE GUIDÉE (MODE DÉMO)
   ========================================== */
.demo-toggle {
    background: none;
    border: 2px solid var(--warning);
    border-radius: 20px;
    padding: 5px 15px;
    cursor: pointer;
    color: var(--warning);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}
.demo-toggle:hover {
    background: var(--warning);
    color: white;
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.4);
    transform: translateY(-1px);
}

#demo-spotlight-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 999;
    pointer-events: none;
    transition: clip-path 0.4s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s ease;
    opacity: 1;
}

#demo-spotlight-highlight {
    position: fixed;
    border-radius: 8px;
    border: 2px solid var(--warning);
    box-shadow: 0 0 15px var(--warning);
    z-index: 998;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#demo-click-blocker {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 1000;
    pointer-events: auto;
}

#demo-walkthrough-card {
    position: fixed;
    z-index: 1001;
    width: 92vw;
    max-width: 450px;
    background: var(--surface-color);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transition: opacity 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Animations et utilitaires */
.demo-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

#demo-step-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

#demo-step-desc {
    font-size: 0.9rem;
    color: var(--text-main);
    margin-bottom: 1rem;
    line-height: 1.45;
}

#demo-progress-bar-container {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1rem;
}

#demo-progress-bar {
    height: 100%;
    background: var(--warning);
    width: 0%;
    transition: width 0.1s linear;
}

.demo-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

#demo-dots {
    display: flex;
    gap: 6px;
}

.demo-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.4;
    transition: var(--transition);
    cursor: pointer;
}

.demo-dot.active {
    background: var(--primary);
    opacity: 1;
    transform: scale(1.2);
}

.demo-buttons {
    display: flex;
    gap: 6px;
}

.demo-btn {
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.demo-btn-prev {
    background: var(--inner-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}
.demo-btn-prev:hover {
    border-color: var(--primary);
}

.demo-btn-play {
    background: var(--warning);
    color: white;
    min-width: 70px;
}
.demo-btn-play:hover {
    background: #e67e22;
}

.demo-btn-next {
    background: var(--primary);
    color: white;
}
.demo-btn-next:hover {
    background: var(--primary-hover);
}

.demo-close-x {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
}
.demo-close-x:hover {
    color: var(--danger);
}

/* ==========================================
   10. DESIGN SPELLS & WOW EFFECTS
   ========================================== */
@keyframes blueprint-draw {
    from { stroke-dashoffset: 1500; }
    to { stroke-dashoffset: 0; }
}

.svg-animate path, .svg-animate rect, .svg-animate circle, .svg-animate line {
    stroke-dasharray: 1500;
    stroke-dashoffset: 1500;
    animation: blueprint-draw 1.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.tilt-card {
    transition: transform 0.1s ease-out, box-shadow 0.1s ease-out;
    transform-style: preserve-3d;
    will-change: transform;
}

.number-animate {
    display: inline-block;
    transition: color 0.3s;
}
