/* Dashboard Page Specific Styles (scoped to the dashboard page) */

/* Use CSS Grid so cards align exactly with the container (same width as meteoalarm alert).
   Max 4 cards per row on desktop, responsive down to 3/2/1 columns. */
html[data-page="dashboard"] #dashboard-grid {
    width: 100%; /* fill the parent container (same width as meteoalarm alert) */
    display: grid;
    grid-template-columns: repeat(4, minmax(260px, 1fr));
    grid-auto-rows: 1fr; /* force rows to equal height so cards in the same row match */
    gap: 0.5rem; /* slightly tighter than before so each card is wider */
    align-items: stretch; /* ensure grid items stretch to fill the row height */
    box-sizing: border-box;
    margin: 0; /* remove negative margins so grid lines up with alert box */
    padding: 0;
}

/* Reduce vertical spacing between stacked rows inside cards on dashboard only
   This lowers the CSS variable used by `.card-body p + p` to bring the divider
   closer to the previous value rows. Kept scoped to dashboard to avoid global
   visual regressions. */
/* dashboard spacing left as default variables (no override) */

/* Make each direct child a grid item that fills its column */
html[data-page="dashboard"] #dashboard-grid > * {
    padding: 0; /* card spacing handled by gap */
    width: 100%;
    box-sizing: border-box;
    display: flex; /* make each grid item a flex column so its .glass-card can stretch */
    flex-direction: column;
}

/* Ensure grid items stretch to fill the implicit grid row height */
html[data-page="dashboard"] #dashboard-grid > * {
    align-items: stretch;
    align-self: stretch;
    height: 100%;
    min-height: 0; /* allow children to shrink/grow correctly inside flex/grid */
}

/* Make the glass-card fill the grid item's height explicitly */
html[data-page="dashboard"] #dashboard-grid > * > .glass-card {
    height: 100%;
}

/* Ensure previous bootstrap column classes don't override our grid sizing */
html[data-page="dashboard"] #dashboard-grid > .col-12,
html[data-page="dashboard"] #dashboard-grid > .col-sm-6,
html[data-page="dashboard"] #dashboard-grid > .col-lg-3 {
    width: 100% !important;
}

/* Breakpoints: keep maximum 4 columns, reduce columns on smaller screens */
@media (max-width: 1199px) {
    html[data-page="dashboard"] #dashboard-grid {
        grid-template-columns: repeat(3, minmax(240px, 1fr));
    }
}

@media (max-width: 991px) {
    html[data-page="dashboard"] #dashboard-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }
}

@media (max-width: 767px) {
    html[data-page="dashboard"] #dashboard-grid {
        grid-template-columns: 1fr;
    }
    html[data-page="dashboard"] .current-temp {
        font-size: 2.5rem;
    }
}

html[data-page="dashboard"] .dashboard-summary {
    background: var(--tblr-card-bg);
    border-radius: var(--tblr-border-radius);
    padding: 1.5rem;
    box-shadow: var(--tblr-shadow);
}

html[data-page="dashboard"] .weather-overview {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

html[data-page="dashboard"] .current-conditions {
    text-align: center;
    padding: 2rem;
}

html[data-page="dashboard"] .current-temp {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--tblr-primary);
}

html[data-page="dashboard"] .condition-desc {
    font-size: 1.1rem;
    color: var(--tblr-muted);
    margin-bottom: 1rem;
}

/* Card improvements for better responsive behavior */
html[data-page="dashboard"] .glass-card {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto; /* allow the card to grow to fill the grid cell */
    min-height: 0; /* avoid min-height conflicts so card can fully fill grid cell */
}

html[data-page="dashboard"] .glass-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Temperature card specific styling */
html[data-page="dashboard"] .temp-card .glass-card {
    min-height: 220px;
}

/* Wind card specific styling */
html[data-page="dashboard"] .wind-card .glass-card {
    min-height: 200px;
}

/* Ensure consistent card heights */
html[data-page="dashboard"] #dashboard-grid > .col-12 .glass-card,
html[data-page="dashboard"] #dashboard-grid > .col-sm-6 .glass-card,
html[data-page="dashboard"] #dashboard-grid > .col-lg-3 .glass-card {
    height: 100%;
}
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px) saturate(140%) brightness(110%);
    -webkit-backdrop-filter: blur(16px) saturate(140%) brightness(110%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow:
        0 12px 40px rgba(31, 38, 135, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.15) inset,
        0 1px 0 rgba(255, 255, 255, 0.25) inset;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 25% 25%, rgba(255,255,255,0.4) 1px, transparent 2px),
        radial-gradient(circle at 75% 75%, rgba(255,255,255,0.3) 0.8px, transparent 1.5px),
        radial-gradient(circle at 50% 50%, rgba(255,255,255,0.35) 1.2px, transparent 2.2px),
        linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    background-size: 200px 200px, 150px 150px, 180px 180px, 100% 100%;
    pointer-events: none;
    border-radius: inherit;
    opacity: 0.7;
}

.glass-card:hover {
    box-shadow:
        0 16px 48px rgba(31, 38, 135, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset,
        0 1px 0 rgba(255, 255, 255, 0.35) inset;
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px) scale(1.02);
    backdrop-filter: blur(20px) saturate(150%) brightness(115%);
    -webkit-backdrop-filter: blur(20px) saturate(150%) brightness(115%);
}

.glass-card:hover::before {
    opacity: 0.9;
    transform: scale(1.05);
}

/* Enhanced glass effect for dark mode */
[data-theme="dark"] .glass-card {
    background: rgba(17, 25, 40, 0.25);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 1px 0 rgba(255, 255, 255, 0.1) inset;
}

[data-theme="dark"] .glass-card::before {
    background:
        radial-gradient(circle at 25% 25%, rgba(255,255,255,0.15) 1px, transparent 2px),
        radial-gradient(circle at 75% 75%, rgba(255,255,255,0.12) 0.8px, transparent 1.5px),
        radial-gradient(circle at 50% 50%, rgba(255,255,255,0.18) 1.2px, transparent 2.2px),
        linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 50%);
}

[data-theme="dark"] .glass-card:hover {
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset,
        0 1px 0 rgba(255, 255, 255, 0.15) inset;
}
