/**
 * Weather CSS
 * Styling for the HexGrinder Weather System component
 * Version: 1.0
 * Last Updated: December 26, 2025
 */

/* =====================
   WEATHER TAB STYLES
   ===================== */

.weather-tab {
    position: fixed;
    left: 0;
    top: calc(var(--header-height) + 1rem);
    bottom: 0;
    transform: translateX(-320px);
    -webkit-transform: translateX(-320px);
    z-index: 1001;
    display: flex;
    flex-direction: row-reverse;
    transition: transform 0.3s ease;
    -webkit-transition: -webkit-transform 0.3s ease;
    pointer-events: none;
}

.weather-tab.open {
    transform: translateX(0);
    -webkit-transform: translateX(0);
    pointer-events: auto;
}

.weather-handle {
    background: linear-gradient(135deg, var(--accent-mystic) 0%, #5a3c9f 100%);
    color: white;
    padding: 1rem 0.5rem;
    cursor: pointer;
    border-radius: 0 4px 4px 0;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
    pointer-events: auto;
    position: relative;
    z-index: 1000;
    align-self: flex-start;
    margin-top: 60%;
}

.weather-handle:hover {
    background: linear-gradient(135deg, #8a6ccf 0%, #7a5cbf 100%);
    box-shadow: 4px 0 16px var(--glow-mystic);
}

.weather-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-left: none;
    border-radius: 0 4px 4px 0;
    width: 320px;
    max-height: calc(100vh - var(--header-height) - 2rem);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem 1.5rem 1.5rem 2.5rem;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    align-self: flex-start;
    margin-top: 1rem;
}

.weather-tab.open .weather-panel {
    pointer-events: auto;
}

.weather-title {
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--accent-mystic);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.weather-section {
    margin-bottom: 1.5rem;
}

.weather-section-title {
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

/* Season Selector */
.season-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.season-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.6rem 0.25rem;
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.season-btn .season-icon {
    font-size: 1.2rem;
}

.season-btn:hover {
    background: var(--bg-card);
    border-color: var(--accent-mystic);
}

.season-btn.active {
    background: linear-gradient(135deg, var(--accent-mystic) 0%, #5a3c9f 100%);
    border-color: var(--accent-mystic);
    color: white;
    box-shadow: 0 2px 8px rgba(138, 108, 207, 0.4);
}

.current-season-display {
    text-align: center;
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.9rem;
    color: var(--accent-mystic);
    margin-top: 0.5rem;
    font-style: italic;
}

/* Weather Roll Buttons */
.weather-roll-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-mystic) 0%, #5a3c9f 100%);
    border: none;
    color: white;
    padding: 0.85rem;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.weather-roll-btn:hover {
    background: linear-gradient(135deg, #8a6ccf 0%, #7a5cbf 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(138, 108, 207, 0.4);
}

.weather-roll-btn:active {
    transform: translateY(0);
}

.weather-roll-btn.secondary {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.weather-roll-btn.secondary:hover {
    background: var(--bg-card);
    border-color: var(--accent-mystic);
    color: var(--accent-mystic);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(138, 108, 207, 0.2);
}

/* Button rolling and disabled states */
.weather-roll-btn.rolling {
    animation: weather-button-pulse 0.2s ease-in-out infinite;
    background: linear-gradient(135deg, #8a6ccf 0%, #7a5cbf 100%) !important;
    border-color: var(--accent-mystic) !important;
    color: white !important;
}

.weather-roll-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

@keyframes weather-button-pulse {
    0%, 100% { box-shadow: 0 0 5px var(--glow-mystic); }
    50% { box-shadow: 0 0 15px var(--glow-mystic); }
}

/* Result Display */
.weather-result-box {
    background: var(--bg-elevated);
    border: 2px solid var(--accent-mystic);
    border-radius: 4px;
    padding: 1.25rem;
    margin-top: 1rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Misty reveal overlay */
.weather-result-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center,
        rgba(201, 168, 76, 0.9) 0%,
        rgba(160, 130, 50, 0.95) 40%,
        rgba(18, 18, 26, 0.98) 100%);
    opacity: 0;
    transition: opacity 0.4s ease-out;
    pointer-events: none;
    z-index: 10;
}

.weather-result-box.misting::before {
    opacity: 1;
    animation: weather-mist-swirl 1s ease-in-out infinite;
}

.weather-result-box.revealing::before {
    animation: weather-mist-fade 0.7s ease-out forwards;
}

@keyframes weather-mist-swirl {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        filter: blur(0px);
    }
    33% {
        transform: scale(1.05) rotate(1deg);
        filter: blur(1px);
    }
    66% {
        transform: scale(0.98) rotate(-1deg);
        filter: blur(2px);
    }
}

@keyframes weather-mist-fade {
    0% { opacity: 1; filter: blur(0px); }
    50% { opacity: 0.6; filter: blur(4px); }
    100% { opacity: 0; filter: blur(8px); }
}

.weather-result-box.misting {
    border-color: #8a6ccf;
    box-shadow: 0 0 30px var(--glow-mystic);
}

.weather-result-value.revealed {
    animation: weather-emerge-from-mist 0.6s ease-out;
}

.weather-result-description.revealed {
    animation: weather-emerge-from-mist 0.5s ease-out 0.1s backwards;
}

@keyframes weather-emerge-from-mist {
    0% { transform: scale(0.8); opacity: 0; filter: blur(4px); }
    60% { transform: scale(1.1); opacity: 1; filter: blur(0px); }
    100% { transform: scale(1); opacity: 1; filter: blur(0px); }
}

.weather-result-label {
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.weather-result-value {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-mystic);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
}

.weather-result-description {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.5;
    font-style: italic;
    margin-bottom: 0.75rem;
}

.weather-result-details {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-subtle);
}

/* Weather History */
.weather-history {
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-elevated);
    border-radius: 4px;
    padding: 0.75rem;
}

.weather-history-entry {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.85rem;
}

.weather-history-entry:last-child {
    border-bottom: none;
}

.weather-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.weather-history-name {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    color: var(--accent-mystic);
    text-transform: uppercase;
    font-size: 0.8rem;
}

.weather-history-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.weather-history-desc {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.4;
}

.clear-weather-btn {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 0.5rem;
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    margin-top: 0.5rem;
    transition: all 0.2s;
}

.clear-weather-btn:hover {
    background: var(--accent-ember);
    border-color: var(--accent-ember);
    color: white;
}

/* Scrollbar styling for weather history */
.weather-history::-webkit-scrollbar {
    width: 6px;
}

.weather-history::-webkit-scrollbar-track {
    background: var(--bg-card);
}

.weather-history::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 3px;
}

.weather-history::-webkit-scrollbar-thumb:hover {
    background: var(--border-glow);
}

/* Empty state */
.weather-history .empty-state {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .weather-tab {
        transform: translateX(-280px);
        -webkit-transform: translateX(-280px);
    }

    .weather-tab.open {
        transform: translateX(0);
        -webkit-transform: translateX(0);
    }

    .weather-panel {
        width: 280px;
        max-height: 70vh;
    }

    .weather-handle {
        margin-top: 60%;
    }

    .season-btn {
        padding: 0.5rem 0.2rem;
        font-size: 0.65rem;
    }

    .season-btn .season-icon {
        font-size: 1rem;
    }
}
