/**
 * Styles pour l'affichage dynamique des signaux
 */

/* ========== Mode Démo ========== */
.signal-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.demo-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.demo-badge.hidden {
    display: none;
}

.demo-icon {
    font-size: 1rem;
}

.demo-notice {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 2px dashed #3b82f6;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 2rem;
    text-align: center;
}

.demo-notice.hidden {
    display: none;
}

.demo-notice p {
    color: #1e40af;
    font-weight: 500;
    margin: 0 0 1rem 0;
}

.demo-controls-mini {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.demo-nav-btn {
    background: white;
    border: 2px solid #3b82f6;
    color: #3b82f6;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.demo-nav-btn:hover {
    background: #3b82f6;
    color: white;
    transform: scale(1.1);
}

.demo-nav-btn:active {
    transform: scale(0.95);
}

.demo-counter {
    font-weight: 600;
    color: #1e40af;
    font-size: 1rem;
    min-width: 60px;
}

/* ========== Signal Header ========== */
.signal-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.signal-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.75rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.25rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.signal-icon {
    font-size: 1.75rem;
    line-height: 1;
}

.signal-label {
    letter-spacing: 0.5px;
}

/* Badge variants */
.signal-buy {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.signal-sell {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.signal-hold {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

.signal-blocked {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

/* Explication inline */
.signal-explanation-inline {
    flex: 1;
    font-size: 1.1rem;
    color: #374151;
    line-height: 1.6;
    min-width: 250px;
}

/* ========== Barre de confiance ========== */
.signal-confidence-bar {
    margin-bottom: 2rem;
}

.confidence-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    color: #6b7280;
}

.confidence-value {
    font-weight: 600;
    font-size: 1rem;
}

.confidence-meter {
    height: 12px;
    background: #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.confidence-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.6s ease, background 0.3s ease;
    position: relative;
}

/* Niveaux de confiance */
.confidence-very-high .confidence-fill {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.confidence-very-high .confidence-value {
    color: #059669;
}

.confidence-high .confidence-fill {
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
}

.confidence-high .confidence-value {
    color: #2563eb;
}

.confidence-medium .confidence-fill {
    background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

.confidence-medium .confidence-value {
    color: #d97706;
}

.confidence-low .confidence-fill {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.confidence-low .confidence-value {
    color: #dc2626;
}

.confidence-neutral .confidence-fill {
    background: linear-gradient(90deg, #6b7280 0%, #4b5563 100%);
}

.confidence-neutral .confidence-value {
    color: #4b5563;
}

/* ========== Meta Grid ========== */
.signal-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.meta-item:hover {
    background: #f3f4f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.meta-icon {
    font-size: 1.75rem;
    line-height: 1;
}

.meta-content {
    flex: 1;
}

.meta-label {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.meta-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
}

/* Niveaux de risque */
.risk-normal {
    color: #059669 !important;
}

.risk-caution {
    color: #d97706 !important;
}

.risk-elevated {
    color: #ea580c !important;
}

.risk-high {
    color: #dc2626 !important;
}

.risk-critical {
    color: #991b1b !important;
    font-weight: 700;
}

/* ========== Justification du risque ========== */
.risk-justification {
    padding: 1.25rem;
    border-radius: 10px;
    border-left: 4px solid #3b82f6;
    background: #eff6ff;
    margin-bottom: 1.5rem;
}

.risk-justification-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1e40af;
    margin-bottom: 0.75rem;
}

.risk-justification p {
    color: #1e3a8a;
    line-height: 1.6;
    margin: 0;
}

/* Variantes de risque */
.risk-justification.risk-normal {
    background: #ecfdf5;
    border-left-color: #059669;
}

.risk-justification.risk-normal .risk-justification-title {
    color: #047857;
}

.risk-justification.risk-normal p {
    color: #065f46;
}

.risk-justification.risk-caution {
    background: #fffbeb;
    border-left-color: #f59e0b;
}

.risk-justification.risk-caution .risk-justification-title {
    color: #d97706;
}

.risk-justification.risk-caution p {
    color: #92400e;
}

.risk-justification.risk-elevated {
    background: #fff7ed;
    border-left-color: #f97316;
}

.risk-justification.risk-elevated .risk-justification-title {
    color: #ea580c;
}

.risk-justification.risk-elevated p {
    color: #9a3412;
}

.risk-justification.risk-high {
    background: #fef2f2;
    border-left-color: #ef4444;
}

.risk-justification.risk-high .risk-justification-title {
    color: #dc2626;
}

.risk-justification.risk-high p {
    color: #991b1b;
}

.risk-justification.risk-critical {
    background: #fef2f2;
    border-left-color: #b91c1c;
    animation: pulse-critical 2s ease-in-out infinite;
}

.risk-justification.risk-critical .risk-justification-title {
    color: #991b1b;
    font-weight: 700;
}

.risk-justification.risk-critical p {
    color: #7f1d1d;
    font-weight: 500;
}

@keyframes pulse-critical {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(185, 28, 28, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(185, 28, 28, 0);
    }
}

/* ========== Indicateurs détaillés ========== */
.signal-indicators {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #e5e7eb;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.signal-indicators.active {
    max-height: 2000px;
}

.indicators-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1.5rem;
}

#indicatorsContainer {
    display: grid;
    gap: 1rem;
}

.lock-indicator {
    display: flex;
    align-items: start;
    gap: 1rem;
    padding: 1.25rem;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.lock-indicator.unlocked {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}

.lock-indicator.unlocked:hover {
    background: #d1fae5;
    transform: translateX(4px);
}

.lock-indicator.locked {
    background: #fef2f2;
    border: 1px solid #fecaca;
    opacity: 0.8;
}

.lock-icon {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.lock-content {
    flex: 1;
}

.lock-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.lock-interpretation {
    color: #4b5563;
    line-height: 1.5;
    margin: 0;
    font-size: 0.95rem;
}

/* ========== Bouton toggle ========== */
.btn-link {
    background: none;
    border: none;
    color: #3b82f6;
    font-weight: 600;
    cursor: pointer;
    padding: 0.75rem 0;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-link:hover {
    color: #2563eb;
    transform: translateX(4px);
}

.btn-link.active::after {
    content: '↑';
    transform: rotate(0deg);
}

.btn-link::after {
    content: '→';
    transition: transform 0.3s ease;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .signal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .signal-badge {
        width: 100%;
        justify-content: center;
    }

    .signal-explanation-inline {
        text-align: center;
    }

    .signal-meta-grid {
        grid-template-columns: 1fr;
    }

    .meta-item {
        padding: 1rem;
    }
}

/* ========== Animations d'entrée ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.signal-header {
    animation: slideInFromLeft 0.5s ease forwards;
}

.signal-confidence-bar {
    animation: fadeInUp 0.5s ease forwards;
    animation-delay: 0.1s;
}

.signal-meta-grid {
    animation: scaleIn 0.5s ease forwards;
    animation-delay: 0.2s;
}

.risk-justification {
    animation: slideInFromRight 0.5s ease forwards;
    animation-delay: 0.3s;
}

/* Animation de changement de signal (carousel) */
.signal-changing .signal-header,
.signal-changing .signal-confidence-bar,
.signal-changing .signal-meta-grid,
.signal-changing .risk-justification {
    animation: fadeOut 0.2s ease forwards;
}

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