/* ==========================================================================
   SCREENSAVER & DYNAMIC WEATHER STYLESHEET - SIMPLE POS
   ========================================================================== */

#screensaver-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    background-color: #050b14;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s ease;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    user-select: none;
    overflow: hidden;
}

#screensaver-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Background Image Layer with ultra-smooth cinematic Zoom In & Zoom Out */
#screensaver-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 1.2s ease-in-out, filter 1s ease;
    animation: screensaverSmoothZoom 25s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}

@keyframes screensaverSmoothZoom {
    0% {
        transform: scale(1.0);
    }
    50% {
        transform: scale(1.12);
    }
    100% {
        transform: scale(1.0);
    }
}

/* Canvas Overlay for Rain, Stars, Lightning, & Splashes */
#screensaver-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

/* Lightning Flash Effect */
#screensaver-lightning {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.95), rgba(180, 220, 255, 0.6));
    opacity: 0;
    pointer-events: none;
    z-index: 3;
    transition: opacity 0.05s ease-out;
}

#screensaver-lightning.flash {
    opacity: 1;
}

/* Humid Fog / Mist Layer */
.screensaver-mist {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        90deg, 
        rgba(255,255,255,0) 0%, 
        rgba(255,255,255,0.12) 30%, 
        rgba(255,255,255,0.03) 60%, 
        rgba(255,255,255,0.15) 80%, 
        rgba(255,255,255,0) 100%
    );
    pointer-events: none;
    z-index: 4;
    opacity: 0;
    transition: opacity 1.5s ease;
    animation: mistFlow 40s linear infinite;
}

.screensaver-overlay[data-weather*="mendung"] .screensaver-mist,
.screensaver-overlay[data-weather*="hujan"] .screensaver-mist {
    opacity: 1;
}

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

/* Ambient Vignette Gradient */
.screensaver-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 40%, rgba(0, 0, 0, 0.55) 100%),
                linear-gradient(to bottom, rgba(0, 0, 0, 0.4) 0%, transparent 30%, transparent 70%, rgba(0, 0, 0, 0.65) 100%);
    pointer-events: none;
    z-index: 5;
}

/* ==========================================================================
   GOOGLE WEATHER WIDGET OVERLAY
   ========================================================================== */

#screensaver-weather-widget {
    position: absolute;
    top: 36px;
    left: 40px;
    z-index: 10;
    max-width: 440px;
    width: calc(100% - 80px);
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 28px;
    padding: 24px 28px;
    color: #ffffff;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.2);
    transition: transform 0.4s ease, opacity 0.4s ease;
}

#screensaver-weather-widget:hover {
    background: rgba(15, 23, 42, 0.68);
    border-color: rgba(255, 255, 255, 0.3);
}

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

.sw-location {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    color: #e2e8f0;
}

.sw-time-badge {
    font-size: 0.85rem;
    font-weight: 600;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    padding: 4px 10px;
    border-radius: 12px;
    letter-spacing: 0.5px;
}

.sw-clock-section {
    margin-bottom: 18px;
}

.sw-clock {
    font-size: 3.8rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -1.5px;
    background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-variant-numeric: tabular-nums;
}

.sw-clock-sec {
    font-size: 1.8rem;
    font-weight: 600;
    opacity: 0.8;
}

.sw-date {
    font-size: 1.05rem;
    font-weight: 500;
    color: #94a3b8;
    margin-top: 6px;
    text-transform: capitalize;
}

.sw-main-temp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 12px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sw-temp-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 4px;
}

.sw-temp-val {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 0.9;
    color: #ffffff;
}

.sw-temp-unit {
    font-size: 1.4rem;
    font-weight: 600;
    color: #38bdf8;
    margin-top: 4px;
}

.sw-condition-box {
    text-align: right;
}

.sw-weather-icon {
    width: 52px;
    height: 52px;
    margin-left: auto;
    margin-bottom: 4px;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3));
}

.sw-condition-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #f1f5f9;
}

.sw-condition-desc {
    font-size: 0.82rem;
    color: #94a3b8;
}

/* Weather Stats Grid */
.sw-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.sw-stat-card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 10px 8px;
    text-align: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.sw-stat-card:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.sw-stat-icon {
    font-size: 1.1rem;
    margin-bottom: 4px;
    display: block;
}

.sw-stat-val {
    font-size: 0.9rem;
    font-weight: 700;
    color: #ffffff;
}

.sw-stat-lbl {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 2px;
}

/* Hourly Forecast Strip */
.sw-hourly-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.sw-hourly-strip::-webkit-scrollbar {
    display: none;
}

.sw-hourly-item {
    flex: 1;
    min-width: 60px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 8px 4px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.sw-hourly-item.active {
    background: rgba(56, 189, 248, 0.2);
    border-color: rgba(56, 189, 248, 0.4);
}

.sw-hourly-time {
    font-size: 0.72rem;
    color: #cbd5e1;
}

.sw-hourly-icon {
    font-size: 1.1rem;
    margin: 4px 0;
}

.sw-hourly-temp {
    font-size: 0.82rem;
    font-weight: 600;
    color: #ffffff;
}

/* ==========================================================================
   BOTTOM FLOATING CONTROL BAR
   ========================================================================== */

#screensaver-controls {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 40px;
    padding: 8px 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    max-width: 95vw;
    overflow-x: auto;
    scrollbar-width: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#screensaver-controls::-webkit-scrollbar {
    display: none;
}

.sc-preset-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.sc-preset-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    transform: translateY(-2px);
}

.sc-preset-btn.active {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    border-color: #38bdf8;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
}

.sc-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.15);
}

.sc-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sc-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.08);
}

.sc-action-btn.active {
    background: #ef4444;
    border-color: #f87171;
}

/* Exit Hint Overlay */
.screensaver-exit-hint {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.78rem;
    letter-spacing: 0.5px;
    pointer-events: none;
    z-index: 90;
    animation: fadeInOutHint 6s infinite ease-in-out;
}

@keyframes fadeInOutHint {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.9; }
}

/* Header Trigger Button (Preview Screensaver) */
.btn-screensaver-preview {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(14, 165, 233, 0.15);
    border: 1px solid rgba(14, 165, 233, 0.3);
    color: #38bdf8;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-screensaver-preview:hover {
    background: rgba(14, 165, 233, 0.3);
    color: #ffffff;
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.4);
}

/* Responsive adjustments */
@media (max-width: 640px) {
    #screensaver-weather-widget {
        top: 20px;
        left: 20px;
        width: calc(100% - 40px);
        padding: 18px 20px;
    }
    .sw-clock {
        font-size: 2.8rem;
    }
    .sw-temp-val {
        font-size: 2.8rem;
    }
    #screensaver-controls {
        bottom: 16px;
        padding: 6px 12px;
        gap: 8px;
    }
}
