/* ================================================
   MOBILE OPTIMIZATION FIX - v2
   File: assets/css/mobile-fix.css
   - Forces combined layout on mobile
   - Hides "Clock & Weather Layout" toggle on mobile
   - Weather/time sections hide independently
   - Improved font sizes for readability
   - Search bar positioned below widgets
   ================================================ */


/* -----------------------------------------------
   MOBILE: 768px and below
   ----------------------------------------------- */
@media (max-width: 768px) {

    /* --- Force combined layout on mobile --- */
    /* Always show combined widget, always hide separate ones */
    body.homepage-template .widgets-container {
        top: 12px !important;
        right: 12px !important;
        flex-direction: column !important;
        gap: 0 !important;
        align-items: flex-end !important;
        z-index: 15 !important;
    }

    /* Always hide separate time and weather widgets on mobile */
    body.homepage-template .time-widget,
    body.homepage-template .weather-widget {
        display: none !important;
    }

    /* Always show combined widget on mobile (JS override handled separately) */
    body.homepage-template .combined-widget {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important;
        gap: 4px !important;
        padding: 10px 14px !important;
        min-width: 100px !important;
    }

    /* Hide the separator — not needed when stacked */
    body.homepage-template .combined-separator {
        display: none !important;
    }

    /* --- Weather side: icon + temp side by side --- */
    .combined-weather-side {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 6px !important;
        min-height: auto !important;
        width: 100% !important;
    }

    .combined-weather-icon {
        font-size: 18px !important;
        margin-bottom: 0 !important;
    }

    body.homepage-template .combined-temp {
        font-size: 18px !important;
        font-weight: 500 !important;
        line-height: 1 !important;
    }

    /* --- Time side: date above, time below --- */
    .combined-time-side {
        flex-direction: column !important;
        align-items: flex-end !important;
        gap: 1px !important;
        min-height: auto !important;
        width: 100% !important;
    }

    .combined-date {
        font-size: 11px !important;
        font-weight: 500 !important;
        text-align: right !important;
        order: 1 !important;
    }

    body.homepage-template .combined-widget .combined-time,
    body.homepage-template .combined-time {
        font-size: 22px !important;
        font-weight: 400 !important;
        line-height: 1 !important;
        text-align: right !important;
        order: 2 !important;
    }

    /* --- Weather description (Overcast text) --- */
    /* This lives in the separate weather widget but
       we also add it to combined via JS data update */
    .combined-weather-description {
        font-size: 11px !important;
        color: var(--text-secondary) !important;
        text-align: right !important;
        width: 100% !important;
        line-height: 1 !important;
    }

    /* --- When only Weather is hidden on mobile ---
       .combined-weather-side gets hidden by JS,
       combined widget stays visible with time only */
    body.homepage-template .combined-widget .combined-weather-side.mobile-hidden {
        display: none !important;
    }

    /* --- When only Clock is hidden on mobile ---
       .combined-time-side gets hidden by JS,
       combined widget stays visible with weather only */
    body.homepage-template .combined-widget .combined-time-side.mobile-hidden {
        display: none !important;
    }

    /* --- Hide "Clock & Weather Layout" toggle row on mobile --- */
    /* The setting item that contains #combinedLayout toggle */
    .setting-item:has(#combinedLayout) {
        display: none !important;
    }

    /* --- Search bar: below the widget stack --- */
    body.homepage-template .search-container {
        top: 115px !important;
    }

    /* --- Min temp fix: make it readable --- */
    body.homepage-template .temp-min {
        font-size: 12px !important;
        opacity: 1 !important;
    }

    body.homepage-template .temp-max {
        font-size: 18px !important;
    }
}


/* -----------------------------------------------
   MOBILE PORTRAIT: 480px and below
   ----------------------------------------------- */
@media (max-width: 480px) {

    body.homepage-template .widgets-container {
        top: 10px !important;
        right: 10px !important;
    }

    body.homepage-template .combined-widget {
        padding: 8px 10px !important;
        gap: 3px !important;
    }

    .combined-weather-icon {
        font-size: 16px !important;
    }

    body.homepage-template .combined-temp {
        font-size: 16px !important;
    }

    .combined-date {
        font-size: 10px !important;
    }

    body.homepage-template .combined-widget .combined-time,
    body.homepage-template .combined-time {
        font-size: 20px !important;
    }

    /* Search bar */
    body.homepage-template .search-container {
        top: 108px !important;
    }
}


/* -----------------------------------------------
   VERY SMALL: 360px and below
   ----------------------------------------------- */
@media (max-width: 360px) {

    body.homepage-template .combined-widget {
        padding: 6px 8px !important;
    }

    body.homepage-template .combined-temp {
        font-size: 14px !important;
    }

    body.homepage-template .combined-widget .combined-time,
    body.homepage-template .combined-time {
        font-size: 18px !important;
    }

    .combined-date {
        font-size: 9px !important;
    }

    body.homepage-template .search-container {
        top: 100px !important;
    }
}