/* ═══════════════════════════════════════════════════════════════
   MyBoodaa Weather v1.1 – Frontend Styles
   Cover Card 1:1 + Fullscreen PWA-style
   Responsive container scaling + Typography CSS vars
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties (defaults; overridden by inline vars from PHP) ── */
.mbw-weather-wrapper {
    --mbw-bg-from: #0a1628;
    --mbw-bg-to: #1a2d4a;
    --mbw-accent: #4a9eff;
    --mbw-glass: rgba(255, 255, 255, 0.06);
    --mbw-glass-border: rgba(255, 255, 255, 0.1);
    --mbw-text: #ffffff;
    --mbw-text-secondary: rgba(255, 255, 255, 0.55);
    --mbw-radius: 20px;

    /* Typography vars — set from PHP inline styles */
    --mbw-font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
    --mbw-cover-font-size: 14px;
    --mbw-title-size: 15px;
    --mbw-title-weight: 600;
    --mbw-title-transform: none;
    --mbw-title-lh: 1.2;
    --mbw-title-max-lines: 2;
    --mbw-title-ox: 0px;
    --mbw-title-oy: 0px;
    --mbw-badge-display: none;

    font-family: var(--mbw-font-family);
    -webkit-font-smoothing: antialiased;
}

.mbw-weather-wrapper *,
.mbw-weather-wrapper *::before,
.mbw-weather-wrapper *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}


/* ═══════════════════════════════════════
   COVER CARD – 1:1 Aspect Ratio
   Scales with container, not viewport
   ═══════════════════════════════════════ */
.mbw-cover-card {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: var(--mbw-radius);
    background: linear-gradient(160deg, var(--mbw-bg-from), var(--mbw-bg-to));
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: transform 0.35s cubic-bezier(.22, 1, .36, 1),
                box-shadow 0.35s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(255, 255, 255, 0.05);
    /* Container query on the card itself */
    container-type: inline-size;
    container-name: mbw-cover;
}
.mbw-cover-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4),
                0 0 0 1px rgba(255, 255, 255, 0.08);
}
.mbw-cover-card:active {
    transform: scale(0.97);
}

/* Decorative ambient glows */
.mbw-cover-card::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -20%;
    width: 60%;
    height: 60%;
    border-radius: 50%;
    background: radial-gradient(circle, var(--mbw-accent) 0%, transparent 70%);
    opacity: 0.12;
    pointer-events: none;
}
.mbw-cover-card::after {
    content: '';
    position: absolute;
    bottom: -20%;
    left: -15%;
    width: 50%;
    height: 50%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 179, 237, 0.5) 0%, transparent 70%);
    opacity: 0.08;
    pointer-events: none;
}

.mbw-cover-inner {
    width: 100%;
    height: 100%;
    padding: 7%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* Loading spinner */
.mbw-cover-loading {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mbw-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255,255,255,.12);
    border-top-color: var(--mbw-accent);
    border-radius: 50%;
    animation: mbw-spin 0.8s linear infinite;
}
@keyframes mbw-spin { to { transform: rotate(360deg); } }

/* ── Cover Content ── */
.mbw-cover-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    font-size: var(--mbw-cover-font-size);
    min-height: 0; /* Prevent flex overflow */
}

/* Header: Title + Badge */
.mbw-cover-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    min-height: 0;
    margin-bottom: auto;
    padding: 0 4px;
}

/* ── Title / City ── controllable from admin */
.mbw-cover-city {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(calc(-50% + var(--mbw-title-ox)), calc(-50% + var(--mbw-title-oy)));
    z-index: 2;
    font-size: var(--mbw-title-size);
    font-weight: var(--mbw-title-weight);
    text-transform: var(--mbw-title-transform);
    line-height: var(--mbw-title-lh);
    color: var(--mbw-text);
    letter-spacing: 0.01em;
    white-space: nowrap;
    text-align: center;
    pointer-events: none;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Scale title down in small containers via container queries */
@container mbw-cover (max-width: 199px) {
    .mbw-cover-city {
        font-size: clamp(9px, 5.5cqi, 11px) !important;
        -webkit-line-clamp: 1 !important;
    }
}
@container mbw-cover (min-width: 200px) and (max-width: 279px) {
    .mbw-cover-city {
        font-size: clamp(10px, 4.8cqi, 13px) !important;
    }
}

/* ── Badge ── toggleable from admin */
.mbw-cover-badge {
    display: var(--mbw-badge-display);
    align-items: center;
    gap: 3px;
    background: var(--mbw-glass);
    border: 1px solid var(--mbw-glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 500;
    color: var(--mbw-text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}
.mbw-cover-badge svg { opacity: 0.6; }

/* Weather Icon */
.mbw-cover-icon-wrap {
    text-align: center;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}
.mbw-cover-icon {
    width: 28%;
    max-width: 90px;
    height: auto;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,.3));
    animation: mbw-float 4s ease-in-out infinite;
}
@keyframes mbw-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Temperature */
.mbw-cover-temp {
    text-align: center;
    line-height: 1;
    margin-bottom: 2px;
}
.mbw-cover-temp-value {
    font-size: clamp(28px, 15cqi, 56px);
    font-weight: 700;
    color: var(--mbw-text);
    letter-spacing: -2px;
}
.mbw-cover-temp-unit {
    font-size: clamp(14px, 7cqi, 28px);
    font-weight: 300;
    color: var(--mbw-text-secondary);
    vertical-align: super;
}

/* Description */
.mbw-cover-desc {
    text-align: center;
    font-size: inherit;
    color: var(--mbw-text-secondary);
    margin-bottom: 0;
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Meta Row */
.mbw-cover-meta {
    display: flex;
    justify-content: center;
    gap: clamp(8px, 5cqi, 20px);
    flex-wrap: wrap;
    margin-top: auto;
}
.mbw-cover-meta-item {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: clamp(9px, 3.2cqi, 12px);
    color: var(--mbw-text-secondary);
    white-space: nowrap;
}
.mbw-cover-meta-item svg {
    opacity: 0.5;
    flex-shrink: 0;
    width: clamp(10px, 3.5cqi, 14px);
    height: clamp(10px, 3.5cqi, 14px);
}


/* ═══════════════════════════════════════
   CONTAINER QUERY SCALING
   Adapts cover card content to container
   ═══════════════════════════════════════ */

/* Small containers: < 200px */
@container mbw-cover (max-width: 199px) {
    .mbw-cover-inner { padding: 6px; }
    .mbw-cover-content { gap: 1px; }
    .mbw-cover-desc { font-size: 8px; white-space: nowrap; }
    .mbw-cover-meta { gap: 4px; }
    .mbw-cover-meta-item { font-size: 8px; }
    .mbw-cover-meta-item svg { width: 8px; height: 8px; }
    .mbw-cover-icon { width: 28px; max-width: 28px; }
    .mbw-cover-badge { display: none !important; }
}

/* Compact containers: 200px – 280px */
@container mbw-cover (min-width: 200px) and (max-width: 279px) {
    .mbw-cover-inner { padding: 5%; }
    .mbw-cover-icon { width: 24%; max-width: 56px; }
    .mbw-cover-desc { font-size: 10px; }
    .mbw-cover-meta-item { font-size: 9px; }
    .mbw-cover-meta-item svg { width: 10px; height: 10px; }
    .mbw-cover-badge { padding: 2px 6px; font-size: 8px; }
}

/* Medium containers: 280px – 399px */
@container mbw-cover (min-width: 280px) and (max-width: 399px) {
    .mbw-cover-inner { padding: 6%; }
    .mbw-cover-icon { width: 26%; max-width: 72px; }
}

/* Large containers: 400px+ */
@container mbw-cover (min-width: 400px) {
    .mbw-cover-inner { padding: 24px; }
    .mbw-cover-icon { width: 28%; max-width: 100px; }
}


/* ═══════════════════════════════════════
   FULLSCREEN OVERLAY
   ═══════════════════════════════════════ */
.mbw-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: linear-gradient(180deg, var(--mbw-bg-from) 0%, var(--mbw-bg-to) 50%, #0d1b2a 100%);
    color: var(--mbw-text);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(.22, 1, .36, 1), visibility 0.4s;
    font-family: var(--mbw-font-family);
}
.mbw-fullscreen.mbw-fs-active {
    opacity: 1;
    visibility: visible;
}

.mbw-fullscreen-inner {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 20px 40px;
    min-height: 100vh;
    position: relative;
}

.mbw-fullscreen::before {
    content: '';
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--mbw-accent) 0%, transparent 70%);
    opacity: 0.08;
    pointer-events: none;
    z-index: 0;
}

/* Top Bar */
.mbw-fs-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(180deg, var(--mbw-bg-from) 60%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.mbw-fs-back,
.mbw-fs-locate {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--mbw-glass-border);
    background: var(--mbw-glass);
    color: var(--mbw-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s, transform .2s;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.mbw-fs-back:hover, .mbw-fs-locate:hover {
    background: rgba(255,255,255,.12);
    transform: scale(1.05);
}
.mbw-fs-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Main Weather */
.mbw-fs-main {
    text-align: center;
    padding: 20px 0 32px;
    position: relative;
    z-index: 1;
}
.mbw-fs-icon-wrap { margin-bottom: 8px; }
.mbw-fs-icon {
    width: 120px;
    height: 120px;
    filter: drop-shadow(0 8px 24px rgba(0,0,0,.4));
    animation: mbw-float 4s ease-in-out infinite;
}
.mbw-fs-temp-big {
    font-size: 72px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -3px;
    margin-bottom: 4px;
}
.mbw-fs-desc {
    font-size: 16px;
    color: var(--mbw-text-secondary);
    text-transform: capitalize;
    margin-bottom: 4px;
}
.mbw-fs-minmax {
    font-size: 14px;
    color: var(--mbw-text-secondary);
}

/* Detail Pills */
.mbw-fs-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 28px;
    position: relative;
    z-index: 1;
}
.mbw-fs-pill {
    background: var(--mbw-glass);
    border: 1px solid var(--mbw-glass-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    transition: background .2s, transform .2s;
}
.mbw-fs-pill:hover {
    background: rgba(255,255,255,.1);
    transform: translateY(-2px);
}
.mbw-fs-pill svg { opacity: 0.5; }
.mbw-fs-pill span {
    font-size: 15px;
    font-weight: 600;
    color: var(--mbw-text);
}
.mbw-fs-pill small {
    font-size: 10px;
    color: var(--mbw-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sections */
.mbw-fs-section {
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}
.mbw-fs-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--mbw-text-secondary);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.mbw-fs-section-title svg { opacity: 0.5; }

/* Hourly */
.mbw-fs-hourly-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.mbw-fs-hourly-scroll::-webkit-scrollbar { display: none; }

.mbw-fs-hour-item {
    flex-shrink: 0;
    width: 72px;
    background: var(--mbw-glass);
    border: 1px solid var(--mbw-glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 14px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    scroll-snap-align: start;
}
.mbw-fs-hour-item.mbw-now {
    background: rgba(74, 158, 255, 0.15);
    border-color: rgba(74, 158, 255, 0.3);
}
.mbw-fs-hour-time { font-size: 11px; font-weight: 600; color: var(--mbw-text-secondary); }
.mbw-fs-hour-icon { width: 36px; height: 36px; }
.mbw-fs-hour-temp { font-size: 15px; font-weight: 700; color: var(--mbw-text); }
.mbw-fs-hour-pop { font-size: 10px; color: var(--mbw-accent); font-weight: 500; }

/* Daily */
.mbw-fs-daily-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mbw-fs-day-row {
    display: grid;
    grid-template-columns: 1fr 40px 1fr 50px;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--mbw-glass);
    border: 1px solid var(--mbw-glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 14px;
    transition: background .2s;
}
.mbw-fs-day-row:hover { background: rgba(255,255,255,.08); }
.mbw-fs-day-name { font-size: 14px; font-weight: 600; color: var(--mbw-text); }
.mbw-fs-day-icon { width: 36px; height: 36px; }
.mbw-fs-day-temps { display: flex; align-items: center; gap: 4px; }
.mbw-fs-day-bar {
    flex: 1;
    height: 4px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--mbw-accent), #f6ad55);
}
.mbw-fs-day-max { font-size: 14px; font-weight: 600; color: var(--mbw-text); }
.mbw-fs-day-min { font-size: 14px; color: var(--mbw-text-secondary); margin-right: 4px; }
.mbw-fs-day-pop { font-size: 12px; color: var(--mbw-accent); text-align: right; font-weight: 500; }


/* ═══════════════════════════════════════
   FULLSCREEN ANIMATIONS
   ═══════════════════════════════════════ */
.mbw-fs-active .mbw-fs-main       { animation: mbw-slideUp .5s cubic-bezier(.22,1,.36,1) .1s both; }
.mbw-fs-active .mbw-fs-details    { animation: mbw-slideUp .5s cubic-bezier(.22,1,.36,1) .2s both; }
.mbw-fs-active .mbw-fs-section:nth-child(3) { animation: mbw-slideUp .5s cubic-bezier(.22,1,.36,1) .3s both; }
.mbw-fs-active .mbw-fs-section:nth-child(4) { animation: mbw-slideUp .5s cubic-bezier(.22,1,.36,1) .35s both; }

@keyframes mbw-slideUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ═══════════════════════════════════════
   VIEWPORT RESPONSIVE (fullscreen only)
   ═══════════════════════════════════════ */
@media (max-width: 400px) {
    .mbw-fs-temp-big { font-size: 56px; }
    .mbw-fs-details { gap: 6px; }
    .mbw-fs-pill { padding: 10px 6px; }
    .mbw-fs-icon { width: 90px; height: 90px; }
}

/* ── Elementor Flex Fix ── */
.elementor-widget-shortcode .mbw-weather-wrapper,
.elementor-element .mbw-weather-wrapper {
    width: 100%;
}
.elementor-widget-shortcode .mbw-cover-card,
.elementor-element .mbw-cover-card {
    max-width: 100%;
}
