/* =========================================================
   Climbing Coach IA — Styles (haute spécificité)
   Tous les sélecteurs sont préfixés par .cca-wrapper pour
   battre les règles du thème. Les propriétés critiques ont
   !important pour éviter les overrides.
   ========================================================= */

/* ---------- Conteneur général ---------- */
.cca-wrapper { max-width: 1100px; margin: 0 auto; }

/* ---------- Sélecteur ---------- */
.cca-wrapper .cca-selector {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    align-items: center !important;
    margin-bottom: 20px !important;
    padding: 15px !important;
    background: #f7f7f7 !important;
    border-radius: 6px !important;
}
.cca-wrapper .cca-selector label { font-weight: 600 !important; color: #333 !important; }

/* ---------- Cartes KPI ---------- */
.cca-wrapper .cca-cards {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    gap: 12px !important;
    margin: 20px 0 !important;
}
.cca-wrapper .cca-card {
    padding: 15px 10px !important;
    background: #fff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px !important;
    text-align: center !important;
}
.cca-wrapper .cca-card-highlight {
    background: #fff8e5 !important;
    border-color: #fabf41 !important;
}
.cca-wrapper .cca-card-value {
    display: block !important;
    font-size: 1.6em !important;
    font-weight: 700 !important;
    color: #2e4a34 !important;
    line-height: 1.2 !important;
}
.cca-wrapper .cca-card-label {
    display: block !important;
    font-size: 0.75em !important;
    color: #666 !important;
    margin-top: 6px !important;
    text-transform: uppercase !important;
    font-weight: 600 !important;
}

/* ---------- Sections ---------- */
.cca-wrapper .cca-section {
    margin: 25px 0 !important;
    padding: 20px !important;
    background: #fff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px !important;
}
.cca-wrapper .cca-section h3 {
    margin: 0 0 15px !important;
    padding: 8px 12px !important;
    background: #4a7c59 !important;
    color: #fff !important;
    border-radius: 3px !important;
    font-size: 1.05em !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
}

/* ---------- Tableaux ---------- */
.cca-wrapper .cca-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-top: 10px !important;
}
.cca-wrapper .cca-table th,
.cca-wrapper .cca-table td {
    padding: 8px !important;
    border: 1px solid #ddd !important;
    text-align: center !important;
    vertical-align: middle !important;
}
.cca-wrapper .cca-table th {
    background: #f7f7f7 !important;
    color: #333 !important;
    font-weight: 600 !important;
}
.cca-wrapper .cca-success { color: #2e7d32 !important; font-weight: 600 !important; }
.cca-wrapper .cca-fail { color: #c62828 !important; font-weight: 600 !important; }
.cca-wrapper .cca-interpretation { margin-top: 10px !important; color: #555 !important; font-style: italic !important; }

/* ---------- Carnet de voyage ---------- */
.cca-wrapper .travel-log {
    background: #e8f4fd !important;
    border: 1px dashed #4a7c59 !important;
    padding: 15px !important;
    margin: 15px 0 !important;
    border-radius: 8px !important;
    text-align: center !important;
}
.cca-wrapper .travel-log h3 {
    background: none !important;
    color: #4a7c59 !important;
    margin: 0 0 8px !important;
    padding: 0 !important;
    font-size: 1.1em !important;
    border-radius: 0 !important;
}
.cca-wrapper .travel-log p { margin: 0 !important; font-size: 1em !important; }

/* ---------- Boutons ---------- */
.cca-wrapper .cca-btn {
    display: inline-block !important;
    padding: 10px 20px !important;
    background: #fabf41 !important;
    border: none !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
    color: #333 !important;
    cursor: pointer !important;
    font-size: 1em !important;
    text-decoration: none !important;
    line-height: 1.4 !important;
}
.cca-wrapper .cca-btn:hover { background: #e8a800 !important; }
.cca-wrapper .cca-btn:disabled { opacity: 0.6 !important; cursor: not-allowed !important; }
.cca-wrapper .cca-btn-ai { background: #4a7c59 !important; color: #fff !important; }
.cca-wrapper .cca-btn-ai:hover { background: #3d6549 !important; }
.cca-wrapper .cca-btn-secondary { background: #e0e0e0 !important; color: #333 !important; }
.cca-wrapper .cca-btn-secondary:hover { background: #d0d0d0 !important; }

/* ---------- Bloc IA ---------- */
.cca-wrapper .cca-ai-block {
    background: #f4f9f4 !important;
    border: 1px solid #b8d8bd !important;
}
.cca-wrapper .cca-analysis-choice {
    margin: 15px 0 20px !important;
    padding: 12px 15px !important;
    background: #fff !important;
    border: 1px solid #d0e0d4 !important;
    border-radius: 4px !important;
}
.cca-wrapper .cca-analysis-choice p { margin: 0 0 10px !important; }
.cca-wrapper .cca-radio-option {
    display: block !important;
    padding: 8px 10px !important;
    margin: 6px 0 !important;
    border-radius: 3px !important;
    cursor: pointer !important;
    background: transparent !important;
}
.cca-wrapper .cca-radio-option:hover { background: #f4f9f4 !important; }
.cca-wrapper .cca-radio-option input { margin-right: 8px !important; }
.cca-wrapper .cca-force-option {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin: 12px 0 6px !important;
    padding: 6px 10px !important;
    background: #fff8e5 !important;
    border-radius: 3px !important;
    font-size: 0.92em !important;
    cursor: pointer !important;
}
.cca-wrapper .cca-analyze-status { margin-left: 10px !important; font-weight: 600 !important; }
.cca-wrapper .cca-analyze-status.is-loading { color: #666 !important; }
.cca-wrapper .cca-analyze-status.is-error { color: #c62828 !important; }
.cca-wrapper .cca-analyze-status.is-success { color: #2e7d32 !important; }
.cca-wrapper .cca-analyze-meta {
    display: inline-block !important;
    margin-left: 10px !important;
    padding: 3px 8px !important;
    border-radius: 3px !important;
    font-size: 0.82em !important;
    font-weight: 600 !important;
}
.cca-wrapper .cca-analyze-meta.is-cache { background: #e8f5e9 !important; color: #2e7d32 !important; }
.cca-wrapper .cca-analyze-meta.is-fresh { background: #e3f2fd !important; color: #1565c0 !important; }

.cca-wrapper .cca-spinner {
    display: inline-block !important;
    width: 14px !important; height: 14px !important;
    border: 2px solid #ddd !important;
    border-top-color: #4a7c59 !important;
    border-radius: 50% !important;
    animation: cca-spin 0.8s linear infinite !important;
    vertical-align: middle !important;
    margin-right: 6px !important;
}
@keyframes cca-spin { to { transform: rotate(360deg); } }

.cca-wrapper .cca-hint { color: #666 !important; font-style: italic !important; }
.cca-wrapper .cca-ai-note { font-size: 0.9em !important; }

/* ---------- Profil ---------- */
.cca-wrapper .cca-profile {
    margin: 20px 0 15px !important;
    padding: 15px 18px !important;
    background: #fafafa !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 4px !important;
    transition: opacity 0.25s ease, background 0.25s ease !important;
}
.cca-wrapper .cca-profile h4 {
    margin: 0 0 12px !important;
    color: #2e4a34 !important;
    font-size: 1.05em !important;
    background: none !important;
    padding: 0 !important;
}
.cca-wrapper .cca-profile.cca-profile-inactive {
    opacity: 0.5 !important;
    background: #f0f0f0 !important;
    border-style: dashed !important;
}
.cca-wrapper .cca-profile-notice {
    padding: 10px 14px !important;
    margin: 0 0 15px !important;
    background: #fff8e5 !important;
    border-left: 4px solid #d89b1c !important;
    border-radius: 3px !important;
    color: #4a3a00 !important;
    font-size: 0.92em !important;
}
.cca-wrapper .cca-cycle-week {
    margin: 8px 0 !important;
    padding: 6px 10px !important;
    background: #f9f9f9 !important;
    border-left: 3px solid #fabf41 !important;
    border-radius: 3px !important;
}
.cca-wrapper .cca-cycle-week label { display: flex !important; align-items: center !important; gap: 8px !important; }
.cca-wrapper .cca-save-status { margin-left: 10px !important; color: #2e7d32 !important; }

/* ---------- Analyse IA ---------- */
.cca-wrapper .cca-analysis { margin-top: 20px !important; }
.cca-wrapper .cca-analysis-meta {
    font-size: 0.85em !important;
    color: #555 !important;
    margin-bottom: 15px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 15px !important;
}
.cca-wrapper .cca-analysis-block {
    margin: 20px 0 !important;
    padding: 15px !important;
    background: #fff !important;
    border-left: 3px solid #4a7c59 !important;
    border-radius: 3px !important;
}
.cca-wrapper .cca-analysis-block h4 {
    margin-top: 0 !important;
    color: #2e4a34 !important;
    background: none !important;
    padding: 0 !important;
}
.cca-wrapper .cca-analysis-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
    gap: 12px !important;
}
.cca-wrapper .cca-analysis-grid .cca-analysis-block { margin: 0 !important; }
.cca-wrapper .cca-warning { border-left-color: #d89b1c !important; background: #fff8e5 !important; }
.cca-wrapper .cca-print-actions { margin-top: 25px !important; text-align: right !important; }

/* ---------- Programme ---------- */
.cca-wrapper .cca-program-week { margin: 20px 0 !important; }
.cca-wrapper .cca-program-week h5 {
    margin: 0 0 10px !important;
    padding: 8px 12px !important;
    background: #4a7c59 !important;
    color: #fff !important;
    border-radius: 3px !important;
}
.cca-wrapper .cca-program-session {
    padding: 12px 15px !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 4px !important;
    margin-bottom: 10px !important;
    background: #fafafa !important;
}
.cca-wrapper .cca-session-head {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    align-items: baseline !important;
    margin-bottom: 10px !important;
    padding-bottom: 8px !important;
    border-bottom: 1px dashed #ccc !important;
}
.cca-wrapper .cca-session-num { font-weight: 700 !important; color: #4a7c59 !important; }
.cca-wrapper .cca-session-focus { font-weight: 600 !important; }
.cca-wrapper .cca-session-duration {
    margin-left: auto !important;
    background: #e8e8e8 !important;
    padding: 2px 8px !important;
    border-radius: 3px !important;
    font-size: 0.9em !important;
}

/* ---------- Graphiques ---------- */
.cca-wrapper .cca-chart-wrapper {
    position: relative !important;
    height: 320px !important;
    margin: 15px 0 !important;
}
.cca-wrapper .cca-report { margin-top: 10px !important; }
.cca-wrapper .cca-report .section-title { margin: 20px 0 10px !important; }
.cca-wrapper .cca-report .section-title h3 {
    background: #4a7c59 !important;
    color: #fff !important;
    padding: 8px 12px !important;
    border-radius: 3px !important;
    margin: 0 !important;
    font-size: 1em !important;
}
.cca-wrapper .cca-report .kpi-container {
    display: flex !important;
    gap: 10px !important;
    margin-bottom: 10px !important;
    flex-wrap: wrap !important;
}
.cca-wrapper .cca-report .kpi-card {
    flex: 1 1 18% !important;
    padding: 12px !important;
    background: #f8f9fa !important;
    border: 1px solid #eee !important;
    border-radius: 6px !important;
    text-align: center !important;
}
.cca-wrapper .cca-report .kpi-card h2 {
    margin: 0 !important;
    color: #4a7c59 !important;
    font-size: 1.4em !important;
    background: none !important;
}
.cca-wrapper .cca-report .kpi-card span {
    display: block !important;
    font-size: 0.75em !important;
    text-transform: uppercase !important;
    color: #7f8c8d !important;
    margin-top: 4px !important;
}
.cca-wrapper .cca-report .badge-success { color: #27ae60 !important; font-weight: 700 !important; }
.cca-wrapper .cca-report .badge-failure { color: #e74c3c !important; font-weight: 700 !important; }
.cca-wrapper .cca-tenacity-box {
    background: #fff4e5 !important;
    border-left: 4px solid #e67e22 !important;
    padding: 12px 15px !important;
    border-radius: 3px !important;
}
.cca-wrapper .cca-tenacity-box p { margin: 5px 0 !important; }
.cca-wrapper .cca-challenge-gone {
    margin-top: 15px !important;
    padding: 10px 14px !important;
    background: #f5f5f5 !important;
    border-left: 3px solid #bbb !important;
    border-radius: 3px !important;
    font-size: 0.9em !important;
    color: #555 !important;
}

/* ---------- Formulaire d'accès ---------- */
.cca-wrapper .cca-access-box {
    max-width: 500px !important;
    margin: 40px auto !important;
    padding: 30px !important;
    background: #fff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05) !important;
}
.cca-wrapper .cca-access-box h2 { margin-top: 0 !important; color: #2e4a34 !important; }
.cca-wrapper .cca-access-box p { color: #555 !important; }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
    .cca-wrapper .cca-cards { grid-template-columns: repeat(2, 1fr) !important; }
    .cca-wrapper .cca-card-value { font-size: 1.3em !important; }
    .cca-wrapper .cca-table { font-size: 0.85em !important; }
    .cca-wrapper .cca-chart-wrapper { height: 250px !important; }
}

/* ---------- Impression ---------- */
@media print {
    body * { visibility: hidden; }
    .cca-wrapper, .cca-wrapper * { visibility: visible; }
    .cca-wrapper {
        position: absolute;
        left: 0; top: 0; width: 100%;
        margin: 0 !important; padding: 0 !important;
    }
    .cca-wrapper .cca-selector,
    .cca-wrapper .cca-analysis-choice,
    .cca-wrapper .cca-force-option,
    .cca-wrapper #cca-analyze-btn,
    .cca-wrapper .cca-analyze-status,
    .cca-wrapper .cca-analyze-meta,
    .cca-wrapper .cca-ai-note,
    .cca-wrapper .cca-print-actions,
    .cca-wrapper .cca-pdf-btn,
    .cca-wrapper .cca-pdf-status,
    .cca-wrapper .cca-profile-notice,
    .cca-wrapper .cca-save-status,
    .cca-wrapper .cca-profile form button,
    .cca-wrapper #cca-access-form { display: none !important; }
    html, body { background: #fff !important; }
    .cca-wrapper .cca-section,
    .cca-wrapper .cca-report .kpi-card,
    .cca-wrapper .cca-analysis-block,
    .cca-wrapper .cca-program-session { page-break-inside: avoid; }
}
/* ==========================================================
   Plan de séance avec voies réelles
   ========================================================== */
.cca-session-plan-block {
    border-left-color: #d89b1c !important;
    background: #fffdf5 !important;
}
.cca-plan-intro {
    font-size: 0.9em;
    color: #666;
    margin: 0 0 15px;
    font-style: italic;
}
.cca-plan-phase {
    margin: 15px 0;
    padding: 12px 15px;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}
.cca-plan-phase h5 {
    margin: 0 0 10px;
    padding: 6px 10px;
    background: #4a7c59;
    color: #fff;
    border-radius: 3px;
    font-size: 1em;
}
.cca-plan-routes {
    list-style: none;
    padding: 0;
    margin: 0;
}
.cca-plan-routes li {
    padding: 8px 0;
    border-bottom: 1px dashed #e8e8e8;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
}
.cca-plan-routes li:last-child {
    border-bottom: none;
}
.cca-route-name {
    font-weight: 600;
    color: #2e4a34;
    min-width: 180px;
}
.cca-route-grade {
    display: inline-block;
    background: #2e4a34;
    color: #fff;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 700;
    font-size: 0.85em;
}
.cca-route-profile {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.8em;
    background: #f0f0f0;
    color: #555;
    font-weight: 600;
    text-transform: capitalize;
}
/* Couleurs par profil */
.cca-profile-vertical    { background: #e3f2fd; color: #1565c0; }
.cca-profile-dalle       { background: #f3e5f5; color: #6a1b9a; }
.cca-profile-devers_leger { background: #fff3e0; color: #e65100; }
.cca-profile-devers      { background: #ffe0b2; color: #bf360c; }
.cca-profile-surplomb    { background: #ffebee; color: #b71c1c; }
.cca-profile-diamant     { background: #e8f5e9; color: #2e7d32; }
.cca-profile-varie       { background: #eceff1; color: #455a64; }

.cca-route-consigne {
    font-size: 0.9em;
    color: #555;
    font-style: italic;
    flex: 1 1 100%;
    padding-left: 0;
    margin-top: 4px;
}

@media (max-width: 600px) {
    .cca-route-name { min-width: 100%; }
    .cca-route-consigne { padding-left: 0; }
}
/* ==========================================================
   Compteur de quota IA
   ========================================================== */
.cca-quota-message {
    padding: 10px 15px;
    margin: 0 0 15px;
    background: #e8f5e9;
    border-left: 4px solid #2e7d32;
    border-radius: 3px;
    color: #1b5e20;
    font-size: 0.9em;
}
.cca-quota-message.cca-quota-low {
    background: #fff8e5;
    border-left-color: #d89b1c;
    color: #6a4a00;
}
.cca-quota-message.cca-quota-empty {
    background: #ffebee;
    border-left-color: #c62828;
    color: #8b1e1e;
}

.cca-quota-info {
    padding: 8px 12px;
    margin: 12px 0;
    background: #f0f6fc;
    border-left: 3px solid #2271b1;
    border-radius: 3px;
    font-size: 0.85em;
    color: #333;
}
.cca-quota-info.cca-quota-low {
    background: #fff8e5;
    border-left-color: #d89b1c;
}
.cca-quota-info.cca-quota-empty {
    background: #ffebee;
    border-left-color: #c62828;
}
/* Type de programme : grisé si bilan seul */
.cca-program-type-inactive {
    opacity: 0.5 !important;
    background: #f0f0f0 !important;
    border-style: dashed !important;
}
.cca-program-type-inactive input[type="radio"] {
    cursor: not-allowed !important;
}
.cca-program-type-notice {
    padding: 8px 12px;
    background: #fff8e5;
    border-left: 3px solid #d89b1c;
    border-radius: 3px;
    color: #4a3a00;
}
/* ==========================================================
   Voies du mur dans les seances
   ========================================================== */
.cca-session-voies { margin: 10px 0; padding: 10px 12px; background: #f4f9f4; border-left: 3px solid #4a7c59; border-radius: 3px; }
.cca-session-voies strong { display: block; margin-bottom: 8px; color: #2e4a34; }
.cca-voies-list { list-style: none; padding: 0; margin: 0; }
.cca-voie-item { padding: 8px 0; border-bottom: 1px dashed #d4e4d8; }
.cca-voie-item:last-child { border-bottom: none; }
.cca-voie-name { font-weight: 600; color: #2e4a34; margin-right: 6px; }
.cca-voie-grade { display: inline-block; background: #2e4a34; color: #fff; padding: 1px 8px; border-radius: 3px; font-weight: 700; font-size: 0.85em; margin-right: 6px; }
.cca-voie-profil { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 0.78em; background: #f0f0f0; color: #555; font-weight: 600; text-transform: capitalize; margin-right: 6px; }
.cca-voie-profil-vertical     { background: #e3f2fd; color: #1565c0; }
.cca-voie-profil-dalle        { background: #f3e5f5; color: #6a1b9a; }
.cca-voie-profil-devers-leger { background: #fff3e0; color: #e65100; }
.cca-voie-profil-devers       { background: #ffe0b2; color: #bf360c; }
.cca-voie-profil-surplomb     { background: #ffebee; color: #b71c1c; }
.cca-voie-profil-diamant      { background: #e8f5e9; color: #2e7d32; }
.cca-voie-profil-varie        { background: #eceff1; color: #455a64; }
.cca-voie-essais { display: inline-block; background: #fff8e5; color: #6a4a00; padding: 1px 6px; border-radius: 3px; font-size: 0.78em; font-weight: 600; margin-right: 6px; }
.cca-voie-repos { display: inline-block; background: #f0f0f0; color: #555; padding: 1px 6px; border-radius: 3px; font-size: 0.78em; }
.cca-voie-consigne { margin-top: 4px; font-size: 0.88em; color: #555; font-style: italic; }
