/**
 * PV Currency Bar Cuba - Frontend Pro v2.0
 * Design moderne avec glassmorphism, animations et dark mode
 */

/* === VARIABLES CSS === */
:root {
    --cbc-primary: #ef4444;
    --cbc-primary-dark: #dc2626;
    --cbc-success: #10b981;
    --cbc-danger: #ef4444;
    --cbc-warning: #f59e0b;
    --cbc-neutral: #6b7280;
    
    --cbc-bg-light: #ffffff;
    --cbc-bg-dark: #0f172a;
    --cbc-text-light: #111827;
    --cbc-text-dark: #f9fafb;
    
    --cbc-border: #e5e7eb;
    --cbc-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --cbc-shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.15);
    
    --cbc-radius: 16px;
    --cbc-radius-sm: 8px;
    --cbc-radius-lg: 24px;
    
    --cbc-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === CONTENEUR PRINCIPAL === */
.cbc-public {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--cbc-text-light);
    padding: 20px 0;
    line-height: 1.6;
}

/* === STYLES HEADER === */
.cbc-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.cbc-header h2 {
    font-size: 32px;
    font-weight: 800;
    margin: 0 0 8px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cbc-header p {
    color: var(--cbc-neutral);
    margin: 0;
    font-size: 16px;
}

.cbc-last-update {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--cbc-radius-sm);
    font-size: 14px;
    color: var(--cbc-primary);
    margin-top: 16px;
}

.cbc-last-update::before {
    content: "🕐";
    font-size: 16px;
}

/* === GRILLE DE CARTES AMÉLIORÉE === */
.cbc-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin: 24px 0;
}

.cbc-card {
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--cbc-radius);
    padding: 24px;
    box-shadow: var(--cbc-shadow);
    transition: var(--cbc-transition);
    overflow: hidden;
}

.cbc-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--cbc-primary), var(--cbc-primary-dark));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.cbc-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--cbc-shadow-hover);
    border-color: rgba(239, 68, 68, 0.3);
}

.cbc-card:hover::before {
    transform: scaleX(1);
}

.cbc-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.cbc-card-title {
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    color: var(--cbc-text-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cbc-card-flag {
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.cbc-card-rate {
    font-size: 36px;
    font-weight: 900;
    margin: 16px 0;
    color: var(--cbc-text-light);
    font-feature-settings: 'tnum';
    font-variant-numeric: tabular-nums;
}

.cbc-card-change {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--cbc-radius-sm);
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
}

.cbc-card-change.up {
    background: rgba(16, 185, 129, 0.1);
    color: var(--cbc-success);
}

.cbc-card-change.down {
    background: rgba(239, 68, 68, 0.1);
    color: var(--cbc-danger);
}

.cbc-card-change.neutral {
    background: rgba(107, 114, 128, 0.1);
    color: var(--cbc-neutral);
}

.cbc-card-change::before {
    font-size: 18px;
}

.cbc-card-change.up::before {
    content: "↑";
}

.cbc-card-change.down::before {
    content: "↓";
}

.cbc-card-change.neutral::before {
    content: "→";
}

.cbc-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--cbc-neutral);
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.cbc-card-source {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cbc-card-source::before {
    content: "📊";
    font-size: 14px;
}

/* === CALCULATEUR DE CONVERSION === */
.cbc-converter {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--cbc-radius-lg);
    padding: 32px;
    margin: 40px 0;
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.3);
}

.cbc-converter-title {
    color: white;
    font-size: 24px;
    font-weight: 800;
    margin: 0 0 24px 0;
    text-align: center;
}

.cbc-converter-form {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: end;
}

.cbc-converter-field {
    position: relative;
}

.cbc-converter-label {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.cbc-converter-input {
    width: 100%;
    padding: 16px;
    font-size: 18px;
    font-weight: 700;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--cbc-radius-sm);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    transition: var(--cbc-transition);
}

.cbc-converter-input:focus {
    outline: none;
    border-color: white;
    background: rgba(255, 255, 255, 0.2);
}

.cbc-converter-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.cbc-converter-select {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--cbc-radius-sm);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    cursor: pointer;
    transition: var(--cbc-transition);
}

.cbc-converter-select:focus {
    outline: none;
    border-color: white;
    background: rgba(255, 255, 255, 0.2);
}

.cbc-converter-swap {
    padding: 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: var(--cbc-transition);
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cbc-converter-swap:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(180deg);
}

.cbc-converter-result {
    grid-column: 1 / -1;
    text-align: center;
    padding: 24px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--cbc-radius);
    margin-top: 16px;
}

.cbc-converter-result-value {
    font-size: 48px;
    font-weight: 900;
    color: white;
    margin: 0;
    font-feature-settings: 'tnum';
}

.cbc-converter-result-label {
    color: rgba(255, 255, 255, 0.8);
    margin-top: 8px;
    font-size: 14px;
}

/* === GRAPHIQUES AMÉLIORÉS === */
.cbc-charts-section {
    margin: 60px 0;
}

.cbc-section-title {
    font-size: 28px;
    font-weight: 800;
    margin: 0 0 32px 0;
    color: var(--cbc-text-light);
    position: relative;
    padding-bottom: 16px;
}

.cbc-section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--cbc-primary), transparent);
    border-radius: 2px;
}

.cbc-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.cbc-chart-card {
    background: var(--cbc-bg-light);
    border: 1px solid var(--cbc-border);
    border-radius: var(--cbc-radius);
    padding: 24px;
    box-shadow: var(--cbc-shadow);
    transition: var(--cbc-transition);
}

.cbc-chart-card:hover {
    box-shadow: var(--cbc-shadow-hover);
}

.cbc-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.cbc-chart-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: var(--cbc-text-light);
}

.cbc-chart-period {
    display: flex;
    gap: 8px;
}

.cbc-chart-period-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--cbc-border);
    border-radius: var(--cbc-radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--cbc-neutral);
    cursor: pointer;
    transition: var(--cbc-transition);
}

.cbc-chart-period-btn:hover,
.cbc-chart-period-btn.active {
    background: var(--cbc-primary);
    color: white;
    border-color: var(--cbc-primary);
}

.cbc-chart-canvas {
    position: relative;
    height: 200px;
}

/* === TICKER AMÉLIORÉ === */
.cbc-ticker {
    position: sticky;
    top: 0;
    z-index: 9999;
    overflow: hidden;
    background: linear-gradient(90deg, #0f172a 0%, #1e293b 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.cbc-ticker-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.cbc-ticker-content {
    display: inline-flex;
    white-space: nowrap;
    will-change: transform;
    animation: ticker-scroll 30s linear infinite;
    gap: 48px;
    padding: 12px 0;
}

.cbc-ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--cbc-radius-sm);
    backdrop-filter: blur(10px);
}

.cbc-ticker-currency {
    font-weight: 700;
    font-size: 14px;
    color: white;
}

.cbc-ticker-rate {
    font-weight: 900;
    font-size: 16px;
    color: white;
    font-feature-settings: 'tnum';
}

.cbc-ticker-change {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.cbc-ticker-change.up {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.cbc-ticker-change.down {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.cbc-ticker-pause {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 12px;
    border-radius: var(--cbc-radius-sm);
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: var(--cbc-transition);
    font-size: 12px;
}

.cbc-ticker-pause:hover {
    background: rgba(255, 255, 255, 0.2);
}

@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.cbc-ticker:hover .cbc-ticker-content,
.cbc-ticker-content.paused {
    animation-play-state: paused;
}

/* === COMPARATEUR === */
.cbc-comparator {
    background: var(--cbc-bg-light);
    border: 1px solid var(--cbc-border);
    border-radius: var(--cbc-radius-lg);
    padding: 32px;
    margin: 40px 0;
    box-shadow: var(--cbc-shadow);
}

.cbc-comparator-title {
    font-size: 24px;
    font-weight: 800;
    margin: 0 0 24px 0;
    text-align: center;
}

.cbc-comparator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.cbc-comparator-item {
    padding: 16px;
    background: rgba(239, 68, 68, 0.05);
    border: 2px solid transparent;
    border-radius: var(--cbc-radius-sm);
    cursor: pointer;
    transition: var(--cbc-transition);
    text-align: center;
}

.cbc-comparator-item:hover,
.cbc-comparator-item.selected {
    border-color: var(--cbc-primary);
    background: rgba(239, 68, 68, 0.1);
}

.cbc-comparator-currency {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.cbc-comparator-rate {
    font-size: 24px;
    font-weight: 900;
    color: var(--cbc-primary);
}

/* === DARK MODE === */
@media (prefers-color-scheme: dark) {
    .cbc-public {
        color: var(--cbc-text-dark);
    }
    
    .cbc-card {
        background: linear-gradient(135deg, rgba(17, 24, 39, 0.95), rgba(17, 24, 39, 0.85));
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .cbc-card-title,
    .cbc-card-rate,
    .cbc-section-title,
    .cbc-comparator-title {
        color: var(--cbc-text-dark);
    }
    
    .cbc-chart-card,
    .cbc-comparator {
        background: #111827;
        border-color: #1f2937;
    }
    
    .cbc-chart-period-btn {
        border-color: #374151;
        color: #9ca3af;
    }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .cbc-cards {
        grid-template-columns: 1fr;
    }
    
    .cbc-converter-form {
        grid-template-columns: 1fr;
    }
    
    .cbc-converter-swap {
        transform: rotate(90deg);
        margin: 0 auto;
    }
    
    .cbc-charts-grid {
        grid-template-columns: 1fr;
    }
    
    .cbc-header h2 {
        font-size: 24px;
    }
    
    .cbc-card-rate {
        font-size: 28px;
    }
}

/* === ANIMATIONS === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cbc-card {
    animation: fadeIn 0.5s ease forwards;
}

.cbc-card:nth-child(1) { animation-delay: 0.1s; }
.cbc-card:nth-child(2) { animation-delay: 0.2s; }
.cbc-card:nth-child(3) { animation-delay: 0.3s; }
.cbc-card:nth-child(4) { animation-delay: 0.4s; }
.cbc-card:nth-child(5) { animation-delay: 0.5s; }

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .cbc-ticker-content {
        animation: none !important;
    }
}

/* === PRINT === */
@media print {
    .cbc-ticker,
    .cbc-converter,
    .cbc-ticker-pause,
    .cbc-chart-period {
        display: none !important;
    }
    
    .cbc-card {
        break-inside: avoid;
    }
}
