/**
 * Scripts Base CSS
 * Fondation commune pour tous les scripts interactifs
 *
 * @package WP_Dix_Scripts
 */

/* ==========================================================================
   VARIABLES CSS
   Héritent des variables du thème Dix quand disponibles
   ========================================================================== */

:root {
    /* Couleurs principales */
    --script-color-primary: var(--color-primary, #1e3a8a);
    --script-color-primary-hover: var(--color-primary-hover, #1e40af);
    --script-color-secondary: var(--color-secondary, #64748b);
    --script-color-accent: var(--color-accent, #f59e0b);

    /* Couleurs de résultat */
    --script-result-optimal: #10b981;
    --script-result-good: #3b82f6;
    --script-result-warning: #f59e0b;
    --script-result-danger: #ef4444;

    /* Couleurs de fond */
    --script-bg: var(--color-bg-secondary, #1a1a1a);
    --script-bg-tertiary: var(--color-bg-tertiary, #262626);
    --script-border: var(--color-border, #333);

    /* Texte */
    --script-text: var(--color-text, #f5f5f5);
    --script-text-secondary: var(--color-text-secondary, #a3a3a3);
    --script-text-muted: var(--color-text-muted, #737373);

    /* Espacements */
    --script-padding: 1.5rem;
    --script-gap: 1rem;
    --script-radius: 0.75rem;
    --script-radius-sm: 0.5rem;

    /* Transitions */
    --script-transition: 200ms ease;
}

/* Mode clair */
[data-theme="light"] {
    --script-bg: #ffffff;
    --script-bg-tertiary: #f3f4f6;
    --script-border: #e5e7eb;
    --script-text: #1f2937;
    --script-text-secondary: #4b5563;
    --script-text-muted: #9ca3af;
}

/* ==========================================================================
   CONTAINER DE BASE
   ========================================================================== */

.dix-script {
    font-family: var(--font-family-base, system-ui, -apple-system, sans-serif);
    color: var(--script-text);
    line-height: 1.6;
    width: 100%;
    max-width: 100%;
}

.dix-script__container {
    padding: var(--script-padding);
}

/* Modificateur pour container avec fond, bordure et coins arrondis */
.dix-script__container--boxed {
    background-color: var(--script-bg);
    border: 1px solid var(--script-border);
    border-radius: var(--script-radius);
}

/* ==========================================================================
   TITRES
   ========================================================================== */

.dix-script__title {
    font-family: var(--font-family-heading, system-ui, sans-serif);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: var(--script-text);
}

.dix-script__subtitle {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--script-text-secondary);
    margin: 0 0 1rem 0;
}

.dix-script__description {
    font-size: 0.9375rem;
    color: var(--script-text-secondary);
    margin: 0 0 1.5rem 0;
}

/* ==========================================================================
   INPUTS
   ========================================================================== */

.dix-script__input-group {
    margin-bottom: 1.25rem;
}

.dix-script__label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--script-text-secondary);
}

.dix-script__input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--script-border);
    border-radius: var(--script-radius-sm);
    background: var(--script-bg-tertiary);
    color: var(--script-text);
    transition: border-color var(--script-transition), box-shadow var(--script-transition);
}

.dix-script__input:focus {
    outline: none;
    border-color: var(--script-color-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.15);
}

.dix-script__input::placeholder {
    color: var(--script-text-muted);
}

/* Input avec unité */
.dix-script__input-with-unit {
    display: flex;
    align-items: center;
}

.dix-script__input-with-unit .dix-script__input {
    border-radius: var(--script-radius-sm) 0 0 var(--script-radius-sm);
    border-right: none;
}

.dix-script__input-unit {
    padding: 0.75rem 1rem;
    background: var(--script-border);
    border: 1px solid var(--script-border);
    border-radius: 0 var(--script-radius-sm) var(--script-radius-sm) 0;
    color: var(--script-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

/* ==========================================================================
   RANGE / SLIDER
   ========================================================================== */

.dix-script__range-group {
    margin-bottom: 1.25rem;
}

.dix-script__range-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.dix-script__range-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--script-color-primary);
}

.dix-script__range {
    width: 100%;
    height: 8px;
    background: var(--script-bg-tertiary);
    border-radius: 9999px;
    appearance: none;
    cursor: pointer;
}

.dix-script__range::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--script-color-primary);
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform var(--script-transition);
}

.dix-script__range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.dix-script__range::-webkit-slider-thumb:active {
    cursor: grabbing;
}

.dix-script__range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--script-color-primary);
    border: none;
    border-radius: 50%;
    cursor: grab;
}

/* ==========================================================================
   BOUTONS
   ========================================================================== */

.dix-script__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: 2px solid var(--script-border);
    border-radius: var(--script-radius-sm);
    background: var(--script-bg-tertiary);
    color: var(--script-text);
    cursor: pointer;
    transition: all var(--script-transition);
    text-decoration: none;
    gap: 0.5rem;
}

.dix-script__btn:hover {
    border-color: var(--script-color-primary);
    color: var(--script-color-primary);
}

.dix-script__btn:active {
    transform: scale(0.98);
}

/* Bouton actif */
.dix-script__btn.is-active,
.dix-script__btn--active {
    background: var(--script-color-primary);
    border-color: var(--script-color-primary);
    color: #fff;
}

/* Bouton primaire */
.dix-script__btn--primary {
    background: var(--script-color-primary);
    border-color: var(--script-color-primary);
    color: #fff;
}

.dix-script__btn--primary:hover {
    background: var(--script-color-primary-hover);
    border-color: var(--script-color-primary-hover);
    color: #fff;
}

/* Bouton secondaire */
.dix-script__btn--secondary {
    background: transparent;
    border-color: var(--script-color-secondary);
    color: var(--script-color-secondary);
}

/* Bouton large */
.dix-script__btn--large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* Bouton block */
.dix-script__btn--block {
    width: 100%;
}

/* ==========================================================================
   GROUPES DE BOUTONS
   ========================================================================== */

.dix-script__button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.dix-script__button-group--grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.5rem;
}

.dix-script__button-group--2cols {
    grid-template-columns: repeat(2, 1fr);
}

/* ==========================================================================
   TOGGLE / SWITCH
   ========================================================================== */

.dix-script__toggle {
    display: inline-flex;
    background: var(--script-bg-tertiary);
    border-radius: var(--script-radius-sm);
    padding: 4px;
    gap: 4px;
}

.dix-script__toggle-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: calc(var(--script-radius-sm) - 2px);
    background: transparent;
    color: var(--script-text-secondary);
    cursor: pointer;
    transition: all var(--script-transition);
}

.dix-script__toggle-btn:hover {
    color: var(--script-text);
}

.dix-script__toggle-btn.is-active {
    background: var(--script-color-primary);
    color: #fff;
}

/* ==========================================================================
   BARRE DE PROGRESSION
   ========================================================================== */

.dix-script__progress {
    width: 100%;
    height: 8px;
    background: var(--script-bg-tertiary);
    border-radius: 9999px;
    overflow: hidden;
}

.dix-script__progress-bar {
    height: 100%;
    background: var(--script-color-primary);
    border-radius: 9999px;
    transition: width 0.5s ease;
}

/* Variantes de couleur */
.dix-script__progress--optimal .dix-script__progress-bar {
    background: var(--script-result-optimal);
}

.dix-script__progress--good .dix-script__progress-bar {
    background: var(--script-result-good);
}

.dix-script__progress--warning .dix-script__progress-bar {
    background: var(--script-result-warning);
}

.dix-script__progress--danger .dix-script__progress-bar {
    background: var(--script-result-danger);
}

/* ==========================================================================
   BADGES
   ========================================================================== */

.dix-script__badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dix-script__badge--optimal {
    background: var(--script-result-optimal);
    color: #fff;
}

.dix-script__badge--good {
    background: var(--script-result-good);
    color: #fff;
}

.dix-script__badge--warning {
    background: var(--script-result-warning);
    color: #1a1a1a;
}

.dix-script__badge--danger {
    background: var(--script-result-danger);
    color: #fff;
}

.dix-script__badge--neutral {
    background: var(--script-border);
    color: var(--script-text-secondary);
}

/* ==========================================================================
   ZONE DE RÉSULTAT
   ========================================================================== */

.dix-script__result {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--script-bg-tertiary);
    border-radius: var(--script-radius-sm);
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.dix-script__result.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.dix-script__result-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--script-color-primary);
    line-height: 1.2;
}

.dix-script__result-unit {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--script-text-secondary);
    margin-left: 0.25rem;
}

.dix-script__result-label {
    font-size: 0.875rem;
    color: var(--script-text-secondary);
    margin-top: 0.5rem;
}

/* ==========================================================================
   GRILLES
   ========================================================================== */

.dix-script__row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--script-gap);
}

.dix-script__row--3cols {
    grid-template-columns: repeat(3, 1fr);
}

/* ==========================================================================
   CARTES
   ========================================================================== */

.dix-script__card {
    background: var(--script-bg-tertiary);
    border: 1px solid var(--script-border);
    border-radius: var(--script-radius-sm);
    padding: 1rem;
}

.dix-script__card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--script-text);
    margin-bottom: 0.25rem;
}

.dix-script__card-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--script-color-primary);
}

/* ==========================================================================
   SHARE BUTTONS
   ========================================================================== */

.dix-script__share {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.dix-script__share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--script-border);
    background: var(--script-bg-tertiary);
    color: var(--script-text-secondary);
    cursor: pointer;
    transition: all var(--script-transition);
}

.dix-script__share-btn:hover {
    border-color: var(--script-color-primary);
    color: var(--script-color-primary);
}

.dix-script__share-btn svg {
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   MESSAGES
   ========================================================================== */

.dix-script__message {
    padding: 1rem;
    border-radius: var(--script-radius-sm);
    margin-bottom: 1rem;
}

.dix-script__message--info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

.dix-script__message--success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.dix-script__message--warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

.dix-script__message--error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

/* ==========================================================================
   SÉPARATEUR
   ========================================================================== */

.dix-script__separator {
    height: 1px;
    background: var(--script-border);
    margin: 1.5rem 0;
}

/* ==========================================================================
   TABLEAUX
   ========================================================================== */

.dix-script__table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

/* Modificateur pour tableau avec fond et coins arrondis */
.dix-script__table--boxed {
    background: var(--script-bg-tertiary, rgba(255, 255, 255, 0.05));
    border-radius: var(--script-radius, 0.75rem);
    overflow: hidden;
}

.dix-script__table th,
.dix-script__table td {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--script-border, rgba(255, 255, 255, 0.1));
}

.dix-script__table th {
    background: var(--script-bg-tertiary, rgba(255, 255, 255, 0.08));
    font-weight: 600;
    color: var(--script-text, #f5f5f5);
}

.dix-script__table td {
    color: var(--script-text-secondary, #a3a3a3);
}

.dix-script__table td:first-child {
    color: var(--script-text, #f5f5f5);
}

.dix-script__table tbody tr:last-child td {
    border-bottom: none;
}

.dix-script__table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* En-tête de tableau avec titre (colspan) */
.dix-script__table-header {
    padding: 1rem;
    text-align: center;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--script-text, #f5f5f5);
    border-bottom: 2px solid var(--script-color-primary, rgba(30, 58, 138, 0.5));
}

.dix-script__table-header--primary {
    background: rgba(30, 58, 138, 0.15);
    border-bottom-color: var(--script-color-primary, #1e3a8a);
}

.dix-script__table-header--secondary {
    background: rgba(139, 92, 246, 0.15);
    border-bottom-color: #8b5cf6;
}

/* Cellules avec couleurs sémantiques */
.dix-script__table td.is-danger,
.dix-script__table .dix-script__td--danger {
    color: var(--script-result-danger, #ef4444);
}

.dix-script__table td.is-warning,
.dix-script__table .dix-script__td--warning {
    color: var(--script-result-warning, #f59e0b);
}

.dix-script__table td.is-optimal,
.dix-script__table .dix-script__td--optimal {
    color: var(--script-result-optimal, #10b981);
    font-weight: 600;
}

.dix-script__table td.is-primary,
.dix-script__table .dix-script__td--primary {
    color: var(--script-color-primary, #3b82f6);
}

.dix-script__table td.is-secondary,
.dix-script__table .dix-script__td--secondary {
    color: #8b5cf6;
    font-weight: 600;
}

/* Mode clair */
[data-theme="light"] .dix-script__table--boxed {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .dix-script__table th {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .dix-script__table th,
[data-theme="light"] .dix-script__table td {
    border-bottom-color: var(--script-border, rgba(0, 0, 0, 0.1));
}

[data-theme="light"] .dix-script__table tbody tr:hover td {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .dix-script__table-header--primary {
    background: rgba(30, 58, 138, 0.08);
}

[data-theme="light"] .dix-script__table-header--secondary {
    background: rgba(139, 92, 246, 0.08);
}

/* ==========================================================================
   COULEURS DE TEXTE UTILITAIRES
   ========================================================================== */

.dix-script__text--danger {
    color: var(--script-result-danger, #ef4444) !important;
}

.dix-script__text--warning {
    color: var(--script-result-warning, #f59e0b) !important;
}

.dix-script__text--optimal {
    color: var(--script-result-optimal, #10b981) !important;
}

.dix-script__text--primary {
    color: var(--script-color-primary, #3b82f6) !important;
}

.dix-script__text--secondary {
    color: #8b5cf6 !important;
}

.dix-script__text--muted {
    color: var(--script-text-muted, #737373) !important;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
    .dix-script__container {
        padding: 1rem;
    }

    .dix-script__title {
        font-size: 1.25rem;
    }

    .dix-script__result-value {
        font-size: 2rem;
    }

    .dix-script__row {
        grid-template-columns: 1fr;
    }

    .dix-script__row--3cols {
        grid-template-columns: 1fr;
    }

    .dix-script__button-group {
        flex-direction: column;
    }

    .dix-script__button-group--grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================================================
   NOTES AVEC BORDER-LEFT
   Variante de message avec style "astuce/tip"
   ========================================================================== */

.dix-script__note {
    margin-top: 1.5rem;
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--script-color-primary);
    border-radius: 0 var(--script-radius-sm) var(--script-radius-sm) 0;
    font-size: 0.85rem;
    color: var(--script-text-secondary);
    background: rgba(30, 58, 138, 0.1);
}

.dix-script__note strong {
    color: var(--script-color-primary);
}

.dix-script__note--info {
    border-left-color: var(--script-result-good, #3b82f6);
    background: rgba(59, 130, 246, 0.1);
}

.dix-script__note--info strong {
    color: var(--script-result-good, #3b82f6);
}

.dix-script__note--success,
.dix-script__note--optimal {
    border-left-color: var(--script-result-optimal, #10b981);
    background: rgba(16, 185, 129, 0.1);
}

.dix-script__note--success strong,
.dix-script__note--optimal strong {
    color: var(--script-result-optimal, #10b981);
}

.dix-script__note--warning {
    border-left-color: var(--script-result-warning, #f59e0b);
    background: rgba(245, 158, 11, 0.1);
}

.dix-script__note--warning strong {
    color: var(--script-result-warning, #f59e0b);
}

.dix-script__note--danger {
    border-left-color: var(--script-result-danger, #ef4444);
    background: rgba(239, 68, 68, 0.1);
}

.dix-script__note--danger strong {
    color: var(--script-result-danger, #ef4444);
}

.dix-script__note--purple {
    border-left-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
}

.dix-script__note--purple strong {
    color: #8b5cf6;
}

/* ==========================================================================
   TITRE CENTRÉ (modificateur)
   ========================================================================== */

.dix-script__title--center {
    text-align: center;
}

.dix-script__subtitle--center {
    text-align: center;
}

/* ==========================================================================
   BADGES SUPPLÉMENTAIRES
   ========================================================================== */

.dix-script__badge--primary {
    background: var(--script-color-primary);
    color: #fff;
}

.dix-script__badge--purple {
    background: #8b5cf6;
    color: #fff;
}

/* Badges outline (bordure seulement) */
.dix-script__badge--outline {
    background: transparent;
    border: 1px solid currentColor;
}

.dix-script__badge--outline-optimal {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: var(--script-result-optimal, #10b981);
}

.dix-script__badge--outline-primary {
    background: rgba(0, 115, 230, 0.15);
    border: 1px solid rgba(0, 115, 230, 0.4);
    color: var(--script-color-primary, #0073e6);
}

.dix-script__badge--outline-purple {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.4);
    color: #8b5cf6;
}

/* ==========================================================================
   HIDDEN (pour traductions)
   ========================================================================== */

.dix-script__hidden {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

@keyframes dix-script-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.dix-script__loading {
    animation: dix-script-pulse 1.5s ease-in-out infinite;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .dix-script *,
    .dix-script *::before,
    .dix-script *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   CARTES AVEC BORDER-TOP COLORÉ
   ========================================================================== */

.dix-script__card--bordered-top {
    border-top: 4px solid var(--script-color-primary);
}

.dix-script__card--bordered-top.is-optimal {
    border-top-color: var(--script-result-optimal);
}

.dix-script__card--bordered-top.is-good {
    border-top-color: var(--script-result-good);
}

.dix-script__card--bordered-top.is-warning {
    border-top-color: var(--script-result-warning);
}

.dix-script__card--bordered-top.is-danger {
    border-top-color: var(--script-result-danger);
}

.dix-script__card--bordered-top.is-purple {
    border-top-color: #8b5cf6;
}

/* ==========================================================================
   SCROLL HORIZONTAL AVEC SNAP
   ========================================================================== */

.dix-script__scroll-container {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 1rem;
}

.dix-script__scroll-container::-webkit-scrollbar {
    height: 6px;
}

.dix-script__scroll-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.dix-script__scroll-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.dix-script__scroll-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.dix-script__scroll-item {
    flex-shrink: 0;
    scroll-snap-align: start;
}

[data-theme="light"] .dix-script__scroll-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .dix-script__scroll-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .dix-script__scroll-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   LÉGENDE AVEC DOTS
   ========================================================================== */

.dix-script__legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.dix-script__legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--script-text-secondary);
}

.dix-script__legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.dix-script__legend-dot--primary {
    background: var(--script-color-primary);
}

.dix-script__legend-dot--optimal {
    background: var(--script-result-optimal);
}

.dix-script__legend-dot--warning {
    background: var(--script-result-warning);
}

.dix-script__legend-dot--danger {
    background: var(--script-result-danger);
}

.dix-script__legend-dot--purple {
    background: #8b5cf6;
}

/* ==========================================================================
   BARRES DE COMPOSITION EMPILÉES
   ========================================================================== */

.dix-script__stacked-bar {
    display: flex;
    height: 40px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    margin: 1rem 0;
}

.dix-script__stacked-bar-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    transition: all 0.3s ease;
}

.dix-script__stacked-bar-segment--primary {
    background: linear-gradient(135deg, var(--script-color-primary), var(--script-color-primary-hover));
}

.dix-script__stacked-bar-segment--optimal {
    background: linear-gradient(135deg, #10b981, #059669);
}

.dix-script__stacked-bar-segment--warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.dix-script__stacked-bar-segment--danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.dix-script__stacked-bar-segment--purple {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

[data-theme="light"] .dix-script__stacked-bar {
    background: rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   GRILLE DE COMPARAISON (2 colonnes)
   ========================================================================== */

.dix-script__compare-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .dix-script__compare-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   CARTES DE COMPARAISON
   ========================================================================== */

.dix-script__compare-card {
    background: var(--script-bg-tertiary);
    border-radius: var(--script-radius);
    padding: 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    border: 2px solid var(--script-border);
}

.dix-script__compare-card.is-optimal {
    border-color: var(--script-result-optimal);
}

.dix-script__compare-card.is-warning {
    border-color: var(--script-result-warning);
}

.dix-script__compare-card-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.dix-script__compare-card.is-optimal .dix-script__compare-card-badge {
    background: rgba(16, 185, 129, 0.2);
    color: var(--script-result-optimal);
}

.dix-script__compare-card.is-warning .dix-script__compare-card-badge {
    background: rgba(245, 158, 11, 0.2);
    color: var(--script-result-warning);
}

.dix-script__compare-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--script-text);
    margin-bottom: 1rem;
}

.dix-script__compare-card-info {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.dix-script__compare-card-info-label {
    font-size: 0.8rem;
    color: var(--script-text-muted);
    margin-bottom: 0.25rem;
}

.dix-script__compare-card-info-value {
    font-size: 1.1rem;
    font-weight: 700;
}

.dix-script__compare-card.is-optimal .dix-script__compare-card-info-value {
    color: var(--script-result-optimal);
}

.dix-script__compare-card.is-warning .dix-script__compare-card-info-value {
    color: var(--script-result-warning);
}

[data-theme="light"] .dix-script__compare-card {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .dix-script__compare-card-info {
    background: rgba(0, 0, 0, 0.03);
}

/* ==========================================================================
   TIMING CARDS (avec icône + border-top)
   ========================================================================== */

.dix-script__timing-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 768px) {
    .dix-script__timing-grid {
        grid-template-columns: 1fr;
    }
}

.dix-script__timing-card {
    background: var(--script-bg-tertiary);
    border-radius: var(--script-radius);
    padding: 1.25rem;
    text-align: center;
    border-top: 4px solid var(--script-color-primary);
    transition: background 0.3s ease;
}

.dix-script__timing-card:hover {
    background: rgba(255, 255, 255, 0.08);
}

.dix-script__timing-card.is-optimal {
    border-top-color: var(--script-result-optimal);
}

.dix-script__timing-card-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.dix-script__timing-card-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--script-text);
    margin-bottom: 0.25rem;
}

.dix-script__timing-card-time {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--script-color-primary);
    margin-bottom: 0.5rem;
}

.dix-script__timing-card.is-optimal .dix-script__timing-card-time {
    color: var(--script-result-optimal);
}

.dix-script__timing-card-desc {
    font-size: 0.8rem;
    color: var(--script-text-secondary);
    line-height: 1.4;
}

[data-theme="light"] .dix-script__timing-card {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .dix-script__timing-card:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* ==========================================================================
   DOSAGE BADGES (pill style horizontal)
   ========================================================================== */

.dix-script__dosage-summary {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.dix-script__dosage-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--script-bg-tertiary);
    padding: 0.6rem 1rem;
    border-radius: 25px;
    border: 1px solid var(--script-border);
}

.dix-script__dosage-badge-icon {
    font-size: 1rem;
}

.dix-script__dosage-badge-text {
    font-size: 0.85rem;
    color: var(--script-text-secondary);
}

.dix-script__dosage-badge-value {
    font-weight: 700;
    color: var(--script-result-optimal);
}

@media (max-width: 768px) {
    .dix-script__dosage-summary {
        flex-direction: column;
        align-items: center;
    }
}

/* ==========================================================================
   CYCLE VISUEL (étapes avec flèches)
   ========================================================================== */

.dix-script__cycle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--script-radius);
    margin-bottom: 2rem;
}

.dix-script__cycle-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
    min-width: 120px;
}

.dix-script__cycle-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 0.75rem;
    border: 3px solid;
}

.dix-script__cycle-icon.is-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(239, 68, 68, 0.1));
    border-color: var(--script-result-danger);
}

.dix-script__cycle-icon.is-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(245, 158, 11, 0.1));
    border-color: var(--script-result-warning);
}

.dix-script__cycle-icon.is-optimal {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(16, 185, 129, 0.1));
    border-color: var(--script-result-optimal);
}

.dix-script__cycle-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--script-text);
    margin-bottom: 0.25rem;
}

.dix-script__cycle-desc {
    font-size: 0.75rem;
    color: var(--script-text-muted);
    max-width: 100px;
}

.dix-script__cycle-arrow {
    font-size: 1.5rem;
    color: var(--script-text-muted);
    animation: dix-arrow-flow 1.5s ease-in-out infinite;
}

@keyframes dix-arrow-flow {
    0%, 100% { opacity: 0.4; transform: translateX(0); }
    50% { opacity: 1; transform: translateX(5px); }
}

@keyframes dix-pulse-danger {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 20px 5px rgba(239, 68, 68, 0.2); }
}

@keyframes dix-pulse-warning {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 0 20px 5px rgba(245, 158, 11, 0.2); }
}

@keyframes dix-pulse-optimal {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    50% { box-shadow: 0 0 20px 5px rgba(16, 185, 129, 0.2); }
}

.dix-script__cycle-icon.is-danger.is-animated {
    animation: dix-pulse-danger 2s ease-in-out infinite;
}

.dix-script__cycle-icon.is-warning.is-animated {
    animation: dix-pulse-warning 2s ease-in-out infinite 0.5s;
}

.dix-script__cycle-icon.is-optimal.is-animated {
    animation: dix-pulse-optimal 2s ease-in-out infinite 1s;
}

@media (max-width: 768px) {
    .dix-script__cycle {
        padding: 1rem;
        gap: 0.25rem;
    }

    .dix-script__cycle-step {
        padding: 0.5rem;
        min-width: 80px;
    }

    .dix-script__cycle-icon {
        width: 55px;
        height: 55px;
        font-size: 1.4rem;
    }

    .dix-script__cycle-name {
        font-size: 0.85rem;
    }

    .dix-script__cycle-desc {
        font-size: 0.7rem;
        max-width: 80px;
    }

    .dix-script__cycle-arrow {
        font-size: 1.2rem;
    }
}

[data-theme="light"] .dix-script__cycle {
    background: rgba(0, 0, 0, 0.02);
}

/* ==========================================================================
   BENEFIT CARDS (avec scroll horizontal)
   ========================================================================== */

.dix-script__benefit-card {
    background: var(--script-bg-tertiary);
    border-radius: var(--script-radius);
    padding: 1.25rem;
    min-width: 240px;
    max-width: 240px;
    border-top: 4px solid var(--script-result-optimal);
    transition: all 0.3s ease;
}

.dix-script__benefit-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-3px);
}

.dix-script__benefit-card.is-danger {
    border-top-color: var(--script-result-danger);
}

.dix-script__benefit-card.is-primary {
    border-top-color: var(--script-color-primary);
}

.dix-script__benefit-card.is-purple {
    border-top-color: #8b5cf6;
}

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

.dix-script__benefit-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    background: rgba(16, 185, 129, 0.2);
}

.dix-script__benefit-card.is-danger .dix-script__benefit-icon {
    background: rgba(239, 68, 68, 0.2);
}

.dix-script__benefit-card.is-primary .dix-script__benefit-icon {
    background: rgba(59, 130, 246, 0.2);
}

.dix-script__benefit-card.is-purple .dix-script__benefit-icon {
    background: rgba(139, 92, 246, 0.2);
}

.dix-script__benefit-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--script-text);
    margin: 0;
    line-height: 1.3;
}

.dix-script__benefit-desc {
    font-size: 0.85rem;
    color: var(--script-text-secondary);
    line-height: 1.5;
    margin: 0;
}

.dix-script__benefit-tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--script-text-secondary);
    margin-top: 0.75rem;
}

@media (max-width: 768px) {
    .dix-script__benefit-card {
        min-width: 220px;
        max-width: 220px;
    }
}

[data-theme="light"] .dix-script__benefit-card {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .dix-script__benefit-card:hover {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .dix-script__benefit-tag {
    background: rgba(0, 0, 0, 0.05);
}
