/* =====================================================
   C.O.S.M.I.C Enhanced Design System
   Design unifié avec glassmorphism avancé
   ===================================================== */

/* Variables CSS pour cohérence */
:root {
    --cosmic-primary: #00bfff;
    --cosmic-secondary: #0099cc;
    --cosmic-dark: rgba(0, 20, 40, 0.95);
    --cosmic-glass: rgba(255, 255, 255, 0.02);
    --cosmic-border: rgba(255, 255, 255, 0.1);
    --cosmic-text: rgba(255, 255, 255, 0.9);
    --cosmic-muted: rgba(255, 255, 255, 0.7);
    --cosmic-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    --cosmic-blur: 20px;
}

/* Amélioration des cartes d'indicateurs */
.metric-card {
    background: linear-gradient(135deg, var(--cosmic-glass) 0%, rgba(255, 255, 255, 0.01) 100%);
    backdrop-filter: blur(var(--cosmic-blur));
    -webkit-backdrop-filter: blur(var(--cosmic-blur));
    border: 1px solid var(--cosmic-border);
    border-radius: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--cosmic-primary) 0%, var(--cosmic-secondary) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--cosmic-shadow);
    border-color: var(--cosmic-primary);
}

.metric-card:hover::before {
    opacity: 1;
}

/* Amélioration des sections principales */
.cosmic-section {
    background: var(--cosmic-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--cosmic-border);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.cosmic-section::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--cosmic-primary) 0%, transparent 70%);
    opacity: 0.03;
    pointer-events: none;
    animation: cosmic-rotate 30s linear infinite;
}

@keyframes cosmic-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Titres de section améliorés */
.cosmic-section h3 {
    position: relative;
    padding-bottom: 15px;
    margin-bottom: 30px;
}

.cosmic-section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, var(--cosmic-primary) 0%, transparent 100%);
}

/* Amélioration des tabs */
.nav-tabs {
    border-bottom: 1px solid var(--cosmic-border);
    margin-bottom: 20px;
}

.nav-tabs .nav-link {
    color: var(--cosmic-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 12px 20px;
    transition: all 0.3s ease;
    position: relative;
}

.nav-tabs .nav-link:hover {
    color: var(--cosmic-text);
    background: var(--cosmic-glass);
    border-bottom-color: var(--cosmic-primary);
}

.nav-tabs .nav-link.active {
    color: var(--cosmic-primary);
    background: var(--cosmic-glass);
    border-bottom-color: var(--cosmic-primary);
}

/* Graphiques améliorés */
.plot-container {
    background: var(--cosmic-glass);
    border-radius: 10px;
    padding: 10px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* Tables NOAA améliorées */
.table-noaa-scales {
    background: var(--cosmic-glass);
    border-radius: 10px;
    overflow: hidden;
}

.table-noaa-scales th,
.table-noaa-scales td {
    border-color: var(--cosmic-border) !important;
    transition: background 0.2s ease;
}

.table-noaa-scales tbody tr:hover td {
    background: rgba(0, 191, 255, 0.05);
}

/* Boutons améliorés */
.btn-cosmic {
    background: linear-gradient(135deg, var(--cosmic-primary) 0%, var(--cosmic-secondary) 100%);
    border: none;
    color: white;
    padding: 12px 30px;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-cosmic::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.btn-cosmic:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 191, 255, 0.3);
}

.btn-cosmic:hover::before {
    width: 300px;
    height: 300px;
}

/* Progress bars améliorées */
.progress {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
    height: 8px;
}

.progress-bar {
    background: linear-gradient(90deg, var(--cosmic-primary) 0%, var(--cosmic-secondary) 100%);
    animation: progress-shimmer 2s linear infinite;
    background-size: 200% 100%;
}

@keyframes progress-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Refresh controls */
.cosmic-refresh-wrapper {
    max-width: 820px;
    margin: 18px auto 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.cosmic-refresh-status {
    width: 100%;
    max-width: 560px;
}

.cosmic-clock-line {
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.cosmic-last-update {
    display: block;
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.75);
}

.cosmic-progress-bar {
    width: 100%;
}

.cosmic-progress-bar .progress-bar {
    background: linear-gradient(90deg, #00bfff 0%, #00ffcc 100%);
    box-shadow: 0 4px 12px rgba(0, 191, 255, 0.25);
}

.cosmic-refresh-controls {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px;
}

.cosmic-refresh-control {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 220px;
    max-width: 260px;
    width: 100%;
    text-align: center;
}

.cosmic-refresh-btn {
    width: 100%;
    max-width: 260px;
    border-radius: 999px;
    box-shadow: 0 6px 18px rgba(0, 191, 255, 0.2);
}

.cosmic-refresh-dropdown-wrapper {
    gap: 8px;
}

.cosmic-refresh-dropdown-wrapper label {
    text-align: center;
    width: 100%;
}

.cosmic-refresh-hint {
    display: block;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 6px;
}

@media (min-width: 992px) {
    .cosmic-refresh-control {
        align-items: flex-start;
        text-align: left;
    }

    .cosmic-refresh-dropdown-wrapper {
        align-items: flex-start;
    }

    .cosmic-refresh-dropdown-wrapper label {
        text-align: left;
    }
}

/* Dropdown overrides */
.cosmic-refresh-dropdown .Select-control,
.cosmic-refresh-dropdown .Select-menu-outer {
    background-color: rgba(5, 20, 40, 0.92);
    border: 1px solid rgba(0, 191, 255, 0.4);
    color: rgba(224, 247, 255, 0.95);
    border-radius: 12px;
}

.cosmic-refresh-dropdown .Select-menu-outer {
    margin-top: 6px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.cosmic-refresh-dropdown .Select-placeholder,
.cosmic-refresh-dropdown .Select-value-label,
.cosmic-refresh-dropdown .Select-option {
    color: rgba(224, 247, 255, 0.95);
    font-weight: 500;
}

.cosmic-refresh-dropdown .Select-option.is-focused {
    background-color: rgba(0, 191, 255, 0.15);
}

.cosmic-refresh-dropdown .Select-option.is-selected {
    background-color: rgba(0, 191, 255, 0.25);
}

.cosmic-refresh-dropdown .Select-arrow {
    border-top-color: rgba(224, 247, 255, 0.95);
}

/* Légende des couleurs améliorée */
.legend-item {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: transform 0.2s ease;
    display: inline-block;
    margin: 5px;
}

.legend-item:hover {
    transform: scale(1.1);
}

/* Header hero amélioré */
.cosmic-hero {
    background: linear-gradient(135deg, var(--cosmic-dark) 0%, rgba(0, 51, 102, 0.95) 100%);
    position: relative;
    overflow: hidden;
}

.cosmic-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(0, 191, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(0, 153, 204, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(0, 191, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

/* Animations subtiles */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.floating-element {
    animation: float 6s ease-in-out infinite;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .cosmic-section {
        padding: 20px;
        border-radius: 15px;
    }
    
    .cosmic-hero h1 {
        font-size: 2.5rem !important;
    }
    
    .metric-card {
        margin-bottom: 15px;
    }
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--cosmic-primary) 0%, var(--cosmic-secondary) 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--cosmic-primary);
}

/* Loading animations */
.cosmic-loading {
    position: relative;
}

.cosmic-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--cosmic-primary) 50%, transparent 100%);
    animation: loading-slide 2s linear infinite;
}

@keyframes loading-slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Focus states améliorés */
*:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 191, 255, 0.3);
    border-radius: 4px;
}

/* Tooltips améliorés */
.tooltip-inner {
    background: var(--cosmic-dark);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--cosmic-border);
    color: var(--cosmic-text);
    padding: 10px 15px;
    border-radius: 8px;
}

.tooltip.show {
    opacity: 1;
}

/* Amélioration de l'intégration visuelle */
.integrated-layout {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.integrated-card {
    background: var(--cosmic-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--cosmic-border);
    border-radius: 15px;
    padding: 20px;
    transition: all 0.3s ease;
}

.integrated-card:hover {
    transform: scale(1.02);
    border-color: var(--cosmic-primary);
}
