/**
 * style.css - Modern CSS for space weather module
 *
 * Comprehensive styling for the space weather module with
 * responsive design and rt_salient template compatibility.
 *
 * @version      2.0.0
 * @since        1.0.0
 * @package      mod_spaceweather
 * @author       Sleestaq, LLC <info@sleestaq.com>
 * @copyright    © 2021-2025 Sleestaq, LLC
 * @license      Private software - no external license
 */

/* Base Module Styles */
.mod-spaceweather {
    font-family: inherit;
    line-height: 1.4;
    color: inherit;
    background: transparent;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 0;
    box-sizing: border-box;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Header Styles */
.spaceweather-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.spaceweather-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: inherit;
}

.status-indicator {
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.status-indicator.status-ok {
    color: #4ade80;
    text-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
}

.status-indicator.status-unavailable {
    color: #f87171;
    text-shadow: 0 0 8px rgba(248, 113, 113, 0.6);
}

.data-timestamp {
    font-size: 0.8rem;
    opacity: 0.7;
    font-style: italic;
}

/* Grid Layout */
.spaceweather-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Card Base Styles */
.kp-card,
.metric-card,
.scales-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.kp-card:hover,
.metric-card:hover,
.scales-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

.card-header {
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.8;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Kp Index Card - Special Styling */
.kp-card {
    grid-column: span 2;
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.2), rgba(255, 140, 0, 0.1));
    border-color: rgba(255, 140, 0, 0.3);
}

.kp-display {
    text-align: center;
}

.kp-value {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.kp-status {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.9;
}

/* Kp Level Colors */
.kp-level-quiet {
    color: #4ade80;
    text-shadow: 0 0 12px rgba(74, 222, 128, 0.6);
}

.kp-level-unsettled {
    color: #fbbf24;
    text-shadow: 0 0 12px rgba(251, 191, 36, 0.6);
}

.kp-level-active {
    color: #f97316;
    text-shadow: 0 0 12px rgba(249, 115, 22, 0.6);
}

.kp-level-storm {
    color: #ef4444;
    text-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% { text-shadow: 0 0 12px rgba(239, 68, 68, 0.6); }
    50% { text-shadow: 0 0 20px rgba(239, 68, 68, 0.9); }
}

/* Metric Card Styles */
.metric-display {
    text-align: center;
}

.metric-value {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1;
    margin-bottom: 0.25rem;
    color: #60a5fa;
    text-shadow: 0 0 8px rgba(96, 165, 250, 0.4);
}

.metric-unit {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 0.5rem;
}

.metric-status {
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
}

/* Scales Card */
.scales-card {
    grid-column: span 3;
}

.scales-display {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
}

.scale-item {
    text-align: center;
    flex: 1;
}

.scale-label {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 0.5rem;
}

.scale-value {
    font-size: 1.5rem;
    font-weight: 600;
    padding: 0.5rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

/* Scale Level Colors */
.r-scale-0, .s-scale-0, .g-scale-0 {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

.r-scale-1, .s-scale-1, .g-scale-1 {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
}

.r-scale-2, .s-scale-2, .g-scale-2 {
    color: #f97316;
    background: rgba(249, 115, 22, 0.1);
}

.r-scale-3, .s-scale-3, .g-scale-3,
.r-scale-4, .s-scale-4, .g-scale-4,
.r-scale-5, .s-scale-5, .g-scale-5 {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
    0%, 100% { background: rgba(239, 68, 68, 0.1); }
    50% { background: rgba(239, 68, 68, 0.2); }
}

/* No Data Message */
.no-data-message {
    text-align: center;
    padding: 2rem;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: 8px;
    margin-top: 1rem;
}

.no-data-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.no-data-text {
    opacity: 0.9;
}

/* Color Schemes */
.color-scheme-dark {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.8));
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.color-scheme-light {
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.9), rgba(241, 245, 249, 0.8));
    color: #334155;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.color-scheme-light .kp-card,
.color-scheme-light .metric-card,
.color-scheme-light .scales-card {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

.color-scheme-neutral {
    background: rgba(64, 64, 64, 0.1);
    color: inherit;
    border: 1px solid rgba(128, 128, 128, 0.2);
}

/* Display Size Variations */
.display-size-large {
    padding: 2rem;
}

.display-size-large .spaceweather-grid {
    gap: 1.5rem;
}

.display-size-large .kp-value {
    font-size: 4rem;
}

.display-size-large .metric-value {
    font-size: 2.5rem;
}

.display-size-medium {
    padding: 1.5rem;
}

.display-size-compact {
    padding: 1rem;
}

.display-size-compact .spaceweather-grid {
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.display-size-compact .kp-value {
    font-size: 2rem;
}

.display-size-compact .metric-value {
    font-size: 1.5rem;
}

.display-size-minimal {
    padding: 0.75rem;
}

.display-size-minimal .spaceweather-header {
    margin-bottom: 1rem;
}

.display-size-minimal .spaceweather-grid {
    gap: 0.5rem;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.display-size-minimal .kp-value {
    font-size: 1.5rem;
}

.display-size-minimal .metric-value {
    font-size: 1.25rem;
}

/* Animation Enhancements */
.animations-enabled .kp-card,
.animations-enabled .metric-card,
.animations-enabled .scales-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.animations-enabled .kp-value,
.animations-enabled .metric-value {
    transition: all 0.3s ease;
}

.animations-enabled .status-indicator.status-ok {
    animation: gentle-pulse 3s infinite;
}

@keyframes gentle-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .mod-spaceweather {
        padding: 1rem;
    }
    
    .spaceweather-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .kp-card,
    .scales-card {
        grid-column: span 1;
    }
    
    .scales-display {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .spaceweather-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .kp-value {
        font-size: 2.5rem !important;
    }
    
    .metric-value {
        font-size: 1.75rem !important;
    }
    
    .mod-spaceweather {
        padding: 0.75rem;
    }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    .mod-spaceweather *,
    .mod-spaceweather *::before,
    .mod-spaceweather *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .mod-spaceweather {
        border: 2px solid;
    }
    
    .kp-card,
    .metric-card,
    .scales-card {
        border: 2px solid;
        background: transparent;
    }
}

/* Focus Styles for Accessibility */
.mod-spaceweather [role="group"]:focus-within {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
    border-radius: 8px;
}