/* ==================== BASE STYLES ==================== */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #09090b;
    color: white;
}

body.modal-open {
    overflow: hidden;
}

/* Fallback utility classes used by tab/modal toggles */
.hidden {
    display: none !important;
}

.flex {
    display: flex !important;
}

.hidden.flex {
    display: none !important;
}

.glass {
    background: rgba(39, 39, 42, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid #27272a;
}

/* Cleaner section spacing */
.px-6 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.mt-6 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 1rem;
}
/* ==================== BOTTOM TAB NAVIGATION ==================== */
.app-shell {
    padding-bottom: 6.5rem;
}

.bottom-tab-shell {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: flex;
    justify-content: center;
    padding: 0 0.75rem calc(env(safe-area-inset-bottom, 0px) + 0.65rem);
    pointer-events: none;
}

.bottom-tab-bar {
    width: 100%;
    max-width: 28rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
    padding: 0.38rem;
    border-radius: 1.2rem;
    border: 1px solid #30303a;
    background: rgba(24, 24, 27, 0.94);
    backdrop-filter: blur(22px);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
}

.tab-button.bottom-tab-button {
    border: 0;
    border-radius: 0.95rem;
    padding: 0.72rem 0.8rem;
    background: transparent;
    color: #a1a1aa;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: transform 0.16s ease, background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.tab-button.bottom-tab-button:hover {
    color: #f4f4f5;
}

.tab-button.bottom-tab-button:active {
    transform: scale(0.97);
}

.tab-button.bottom-tab-button.active {
    color: #fafafa;
    background: linear-gradient(170deg, rgba(57, 57, 64, 0.95), rgba(39, 39, 46, 0.95));
    box-shadow: inset 0 0 0 1px #3f3f46, 0 8px 18px rgba(0, 0, 0, 0.28);
}

/* ==================== FILTER BUTTONS ==================== */
.filter-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #71717a;
    font-weight: 500;
}

.filter-buttons {
    display: inline-flex;
    background-color: #18181b;
    border: 1px solid #27272a;
    border-radius: 9999px;
    padding: 3px;
    gap: 2px;
}

.filter-btn {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #a1a1aa;
    background: transparent;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-btn:hover {
    color: #e4e4e7;
}

.filter-btn.active {
    background-color: white;
    color: #18181b;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ==================== BILL CARDS ==================== */
.bill-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.bill-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.bill-card:active {
    transform: scale(0.985);
}

/* ==================== MODAL ANIMATION ==================== */
#bill-modal .glass {
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), 
                opacity 0.25s ease;
}

/* ==================== ACCESSIBILITY IMPROVEMENTS ==================== */
.text-\[10px\] {
    color: #a1a1aa; /* zinc-400 - better contrast */
}

#current-time {
    color: #d4d4d8; /* zinc-300 - better contrast */
}

/* ==================== LIVE PRICE SCORECARDS ==================== */
.live-now-wrap {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    padding-top: 1.1rem;
    margin-top: 0.4rem;
    width: 100%;
    box-sizing: border-box;
}

.now-card {
    background: linear-gradient(160deg, rgba(44, 44, 52, 0.92), rgba(30, 30, 36, 0.92));
    border: 1px solid #30303a;
    border-radius: 1.7rem !important;
    padding: 1.2rem 1.3rem 1.1rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 14px 30px rgba(0, 0, 0, 0.24);
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#current-price .slot-reel-wrapper {
    width: 0.56em !important;
    min-width: 0.56em;
}

.scorecard-value .slot-reel-wrapper {
    width: 0.5em !important;
    min-width: 0.5em;
}

.slot-reel {
    will-change: transform;
}

.slot-decimal {
    margin: 0 -0.01em;
}

.slot-suffix {
    padding-left: 0.02em;
    flex-shrink: 0;
}

.slot-static {
    display: inline-flex;
    align-items: flex-end;
    flex-shrink: 0;
}

.now-card::after {
    content: "";
    position: absolute;
    inset: auto -18% -58% auto;
    width: 12.5rem;
    height: 12.5rem;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.22) 0%, rgba(16, 185, 129, 0) 68%);
    pointer-events: none;
}

.now-card-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.95rem;
    min-height: 9rem;
    position: relative;
    z-index: 1;
    width: 100%;
}

.now-card-main {
    min-width: 0;
    flex: 1 1 auto;
}

.now-card-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.28rem 0.56rem;
    border-radius: 999px;
    border: 1px solid rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.14);
    color: #6ee7b7;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.now-card-emoji-wrap {
    justify-self: end;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 6.1rem;
    height: 6.1rem;
    border-radius: 1.4rem;
    background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.02) 58%, rgba(0, 0, 0, 0) 72%);
}

#current-price.current-price-value {
    font-size: clamp(2.7rem, 11vw, 4rem);
    line-height: 1.03;
    letter-spacing: -0.05em;
    margin-top: 0.52rem;
    min-height: 1.1em;
    white-space: nowrap;
    overflow: visible;
    display: flex;
    align-items: flex-end;
    font-weight: 700;
    color: #f4f4f5;
}

#current-time.current-price-time {
    color: #9ca3af;
    margin-top: 0.45rem;
    font-size: 1.05rem;
}

#current-emoji.current-emoji {
    font-size: clamp(3.5rem, 12vw, 4.8rem);
    line-height: 1;
    margin-top: 0;
    display: block;
}

.stats-section {
    margin-top: 1.25rem;
}

.stats-header {
    margin: 0 0 0.55rem 0.2rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    color: #71717a;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.72rem;
}

.price-stat-card {
    background: linear-gradient(165deg, rgba(42, 42, 48, 0.94), rgba(28, 28, 34, 0.94));
    border-color: #30303a;
    border-radius: 1rem;
    padding: 0.82rem 0.74rem 0.78rem;
    min-width: 0;
}

.clickable-scorecard {
    width: 100%;
    display: block;
    text-align: left;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 0.16s ease, border-color 0.18s ease, box-shadow 0.2s ease;
}

.clickable-scorecard:active {
    transform: scale(0.985);
}

.clickable-scorecard:hover {
    border-color: #3f3f46;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
}

.clickable-scorecard.active-scorecard {
    border-color: #22c55e !important;
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.35), 0 10px 22px rgba(6, 78, 59, 0.32);
}

.stat-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.price-stat-card.avg .stat-label {
    color: #6ee7b7;
}

.price-stat-card.high .stat-label {
    color: #fca5a5;
}

.price-stat-card.low .stat-label {
    color: #7dd3fc;
}

.scorecard-value.stat-value {
    font-size: clamp(0.88rem, 3.9vw, 1.12rem) !important;
    line-height: 1.28;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: visible !important;
    display: flex;
    align-items: flex-end;
    min-height: 1.42em;
    margin-top: 0.22rem;
    padding-right: 0.06em;
}

.scorecard-detail-panel {
    margin-top: 0.82rem;
    border-radius: 16px;
    border: 1px solid #30303a;
    background: linear-gradient(160deg, rgba(30, 30, 36, 0.97), rgba(20, 20, 24, 0.97));
}

.scorecard-detail-panel.pop-in {
    animation: scorecard-detail-pop 220ms ease-out;
}

.scorecard-detail-panel.pop-out {
    animation: scorecard-detail-pop-out 180ms ease-in forwards;
}

.scorecard-detail-content {
    padding: 0.9rem 1rem;
}

.scorecard-detail-title {
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #a1a1aa;
    margin-bottom: 0.4rem;
}

.scorecard-detail-value {
    font-size: clamp(1.35rem, 6vw, 1.75rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
    font-weight: 700;
    color: #fafafa;
    margin-bottom: 0.4rem;
}

.scorecard-detail-subtitle {
    font-size: 0.84rem;
    line-height: 1.35;
    color: #d4d4d8;
}

@keyframes scorecard-detail-pop {
    0% {
        opacity: 0;
        transform: translateY(12px) scale(0.985);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes scorecard-detail-pop-out {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(8px) scale(0.99);
    }
}

.slot-number {
    display: inline-flex;
    align-items: flex-end;
    gap: 0.01em;
    max-width: 100%;
}

.slot-reel-wrapper {
    overflow: hidden;
    display: inline-block;
    width: 0.52em !important;
    min-width: 0.52em;
}

#current-price .slot-reel-wrapper {
    width: 0.56em !important;
    min-width: 0.56em;
}

.scorecard-value .slot-reel-wrapper {
    width: 0.5em !important;
    min-width: 0.5em;
}

.scorecard-value.stat-value .slot-number {
    gap: 0.01em;
}

.slot-reel {
    will-change: transform;
}

.slot-decimal {
    margin: 0 -0.01em;
}

.slot-suffix {
    padding-left: 0.02em;
    flex-shrink: 0;
}

/* ==================== CHART CONTAINER ==================== */
#price-chart {
    min-height: 220px;
}

#usage-vs-spend-chart {
    min-height: 220px;
}

.usage-insight-card {
    color: #d1fae5;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.22);
}

/* ==================== GENERAL UTILITIES ==================== */
button:focus-visible {
    outline: 2px solid #22c55e;
    outline-offset: 2px;
}

/* ============================================
   RECENT READINGS - CLEANER DESIGN
   ============================================ */

#recent-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.recent-readings-meta {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.4rem;
    padding-right: 0.18rem;
}

.reading-count-meta {
    font-size: 0.68rem;
    line-height: 1;
    letter-spacing: 0.04em;
    color: #71717a;
    text-transform: uppercase;
}

#recent-list > div {
    background-color: #18181b;
    border: 1px solid #27272a;
    border-radius: 16px;
    padding: 14px 16px;
    transition: all 0.2s ease;
}

#recent-list > div:hover {
    background-color: #27272a;
    border-color: #3f3f46;
    transform: translateY(-1px);
}

/* Make the price number stand out a bit more */
#recent-list .font-semibold {
    font-size: 1.35rem;
    letter-spacing: -0.5px;
}

/* Date/time line styling */
#recent-list .text-\[10px\] {
    color: #71717a;
    font-size: 10px;
    margin-top: 1px;
}

/* Emoji size consistency */
#recent-list .text-3xl {
    font-size: 1.65rem;
    line-height: 1;
}

/* ============================================
   MY BILLS TAB - CLEANER DESIGN
   ============================================ */

/* Summary Scorecards */
#bills-tab-content .glass {
    background-color: #18181b;
    border: 1px solid #27272a;
    border-radius: 16px;
    transition: all 0.2s ease;
}

#bills-tab-content .glass:hover {
    border-color: #3f3f46;
}

/* Bill History Cards */
.bill-card {
    background-color: #18181b;
    border: 1px solid #27272a;
    border-radius: 16px;
    padding: 16px;
    transition: all 0.2s ease;
}

.bill-card:hover {
    background-color: #27272a;
    border-color: #3f3f46;
    transform: translateY(-1px);
}

.bill-season-filters {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin: 0 0 0.95rem;
}

.bill-season-chip {
    border: 1px solid #2f2f39;
    background: #1a1a22;
    color: #a1a1aa;
    padding: 0.38rem 0.9rem;
    border-radius: 999px;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.bill-season-chip:hover {
    color: #e4e4e7;
    border-color: #3f3f46;
}

.bill-season-chip.active {
    background: #22c55e;
    border-color: #22c55e;
    color: #052e16;
}

/* Bill card text improvements */
.bill-card .font-semibold {
    font-size: 1.05rem;
    letter-spacing: -0.3px;
}

.bill-card .text-xs {
    color: #71717a;
}

/* Summary numbers in My Bills */
#total-bills,
#total-spent,
#avg-effective-rate,
#avg-vs-market {
    font-size: clamp(1.25rem, 5.2vw, 1.7rem);
    line-height: 1.2;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: visible;
    min-height: 1.24em;
}

.bill-breakdown-chart-wrap {
    position: relative;
    height: 240px;
    width: 100%;
}

.bill-record-chart-wrap {
    position: relative;
    height: 190px;
    width: 100%;
}

#total-bills .slot-number,
#total-spent .slot-number,
#avg-effective-rate .slot-number,
#avg-vs-market .slot-number {
    gap: 0.01em;
}

/* Modal styling */
#bill-modal .glass {
    background-color: #18181b;
    border: 1px solid #27272a;
    border-radius: 24px 24px 0 0;
}

#bill-modal {
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 0.4rem);
    overscroll-behavior: contain;
}

.bill-modal-panel {
    max-height: calc(100vh - 2.6rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* My Bills tab spacing */
#bills-tab-content {
    padding-top: 1rem;
}

#bills-tab-content .grid {
    gap: 12px;
}

/* ============================================
   WEATHER INSIGHTS
   ============================================ */
.weather-insights-shell {
    background: linear-gradient(165deg, rgba(38, 38, 45, 0.95), rgba(24, 24, 30, 0.95));
    border-color: #30303a;
}

.weather-insights-header {
    display: flex;
    justify-content: space-between;
    gap: 0.9rem;
    align-items: flex-start;
}

.weather-insights-title-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.weather-beta-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(14, 165, 233, 0.4);
    color: #7dd3fc;
    background: rgba(14, 165, 233, 0.14);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.weather-insights-subtitle {
    margin-top: 0.36rem;
    font-size: 0.73rem;
    line-height: 1.35;
    color: #a1a1aa;
}

.weather-insights-actions {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.weather-action-btn {
    border: 1px solid #3f3f46;
    background: #1f1f26;
    color: #e4e4e7;
    border-radius: 999px;
    padding: 0.33rem 0.74rem;
    font-size: 0.7rem;
    font-weight: 600;
    transition: all 0.16s ease;
}

.weather-action-btn:hover {
    border-color: #52525b;
    color: #fafafa;
}

.weather-action-btn-primary {
    border-color: rgba(34, 197, 94, 0.5);
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}

.weather-action-btn-primary:hover {
    border-color: rgba(74, 222, 128, 0.65);
    color: #dcfce7;
}

.weather-insights-body {
    margin-top: 0.8rem;
    display: grid;
    gap: 0.75rem;
}

.weather-insights-status {
    border: 1px dashed #3f3f46;
    border-radius: 0.9rem;
    padding: 0.7rem 0.8rem;
    font-size: 0.8rem;
    color: #d4d4d8;
    background: rgba(24, 24, 27, 0.8);
}

.weather-insights-status.error {
    border-color: rgba(248, 113, 113, 0.4);
    background: rgba(127, 29, 29, 0.2);
    color: #fecaca;
}

.weather-insights-status.loading {
    border-style: solid;
    border-color: rgba(34, 197, 94, 0.4);
    color: #dcfce7;
}

.weather-forecast-cards {
    display: flex;
    gap: 0.55rem;
    overflow-x: auto;
    padding-bottom: 0.2rem;
}

.weather-forecast-card {
    min-width: 136px;
    border: 1px solid #31313b;
    border-radius: 14px;
    padding: 0.62rem;
    background: linear-gradient(165deg, rgba(42, 42, 49, 0.95), rgba(27, 27, 34, 0.95));
}

.weather-forecast-day {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.74rem;
    color: #d4d4d8;
}

.weather-forecast-temp {
    margin-top: 0.22rem;
    font-size: 0.78rem;
    color: #a1a1aa;
}

.weather-forecast-price {
    margin-top: 0.4rem;
    font-size: 1.18rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #f4f4f5;
}

.weather-forecast-support {
    margin-top: 0.28rem;
    font-size: 0.65rem;
    line-height: 1.35;
    color: #a1a1aa;
}

.weather-bin-stats {
    border: 1px solid #32323d;
    border-radius: 0.9rem;
    overflow: hidden;
}

.weather-bin-row {
    display: grid;
    grid-template-columns: 1.15fr auto auto;
    gap: 0.55rem;
    align-items: baseline;
    padding: 0.58rem 0.72rem;
    border-bottom: 1px solid #2a2a33;
    background: rgba(24, 24, 29, 0.84);
}

.weather-bin-row:last-child {
    border-bottom: none;
}

.weather-bin-label {
    font-size: 0.74rem;
    color: #e4e4e7;
}

.weather-bin-value {
    font-size: 0.8rem;
    color: #f4f4f5;
    font-weight: 600;
}

.weather-bin-count {
    font-size: 0.69rem;
    color: #a1a1aa;
}

.weather-insight-callout {
    border: 1px solid rgba(34, 197, 94, 0.35);
    border-radius: 0.9rem;
    background: rgba(6, 95, 70, 0.22);
    color: #dcfce7;
    padding: 0.68rem 0.78rem;
    font-size: 0.8rem;
    line-height: 1.4;
}
