/* ============================================================
   Material Design 3 — Black & White (Monochrome) Theme
   ============================================================ */

/* ---------- Font ---------- */
@font-face {
    font-family: 'ShreeDev0714';
    src: url('font/ShreeDev0714.woff2') format('woff2'),
         url('font/ShreeDev0714.woff') format('woff'),
         url('font/ShreeDev0714.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ---------- CSS Custom Properties ---------- */
:root {
    --md-primary: #000000;
    --md-on-primary: #ffffff;
    --md-surface: #ffffff;
    --md-surface-container: #ffffff;
    --md-surface-container-high: #f5f5f5;
    --md-surface-container-highest: #eeeeee;
    --md-on-surface: #1c1b1f;
    --md-on-surface-variant: #555555;
    --md-outline: #cccccc;
    --md-outline-variant: #e0e0e0;
    --md-inverse-surface: #333333;
    --md-inverse-on-surface: #f4eff4;
    --md-elevation-1: none;
    --md-elevation-2: none;
    --md-elevation-3: 0 4px 8px 3px rgba(0,0,0,0.08), 0 1px 3px 0 rgba(0,0,0,0.04);
    --md-shape-sm: 8px;
    --md-shape-md: 0;
    --md-shape-full: 9999px;
    --md-title-large: 300 1.375rem/1.75rem 'ShreeDev0714', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --md-title-medium: 300 1rem/1.5rem 'ShreeDev0714', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --md-title-small: 300 0.875rem/1.25rem 'ShreeDev0714', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --md-body-large: 300 1rem/1.5rem 'ShreeDev0714', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --md-body-medium: 300 0.875rem/1.25rem 'ShreeDev0714', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --md-body-small: 300 0.75rem/1rem 'ShreeDev0714', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --md-label-large: 300 0.875rem/1.25rem 'ShreeDev0714', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --md-label-medium: 300 0.75rem/1rem 'ShreeDev0714', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --md-label-small: 300 0.688rem/1rem 'ShreeDev0714', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --md-display-small: 300 2.25rem/2.75rem 'ShreeDev0714', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
    height: 100%;
    background-color: #EBDDCC;
}

/* ---------- Background Glow Layer (Gemini-style) ---------- */
.bg-glow {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% 40%, #FFC068 0%, #FFD699 30%, #EBDDCC 55%, transparent 75%),
        radial-gradient(ellipse 60% 40% at 55% 35%, #FFB347 0%, #FFC068 20%, #EBDDCC 50%, transparent 60%);
    animation: glowFadeIn 1.2s ease-out 0.2s forwards, glowBreathe 8s ease-in-out 1.5s infinite alternate;
}

.bg-glow::after {
    content: '';
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse 70% 50% at 55% 45%, #FFB347 0%, #FFD699 25%, #EBDDCC 50%, transparent 60%);
    opacity: 0;
    animation: glowFadeIn 1.5s ease-out 0.5s forwards, glowDrift 12s ease-in-out 2s infinite alternate;
}

@keyframes glowFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes glowBreathe {
    0%   { opacity: 0.6; transform: scale(1); }
    50%  { opacity: 1;   transform: scale(1.04); }
    100% { opacity: 0.7; transform: scale(0.97); }
}

@keyframes glowDrift {
    0%   { opacity: 0.25; transform: translate(0%, 0%) scale(1); }
    33%  { opacity: 0.45; transform: translate(2%, -1%) scale(1.06); }
    66%  { opacity: 0.35; transform: translate(-1%, 1%) scale(0.94); }
    100% { opacity: 0.5;  transform: translate(1%, -2%) scale(1.03); }
}

body {
    font: var(--md-body-large);
    color: var(--md-on-surface);
    background: transparent;
    position: relative;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- MD3 Surface (main wrapper) ---------- */
.site-wrapper {
    width: 100%;
    max-width: 960px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 0 clamp(12px, 3vw, 24px) clamp(12px, 3vh, 24px);
    padding-bottom: calc(clamp(12px, 3vh, 24px) + var(--safe-bottom));
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

.dashboard {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 2vh, 16px);
    flex: 1;
    justify-content: space-between;
}

/* Desktop: spread items vertically to fill empty space */
@media (min-width: 769px) {
    .dashboard {
        gap: clamp(10px, 2.5vh, 20px);
        justify-content: space-evenly;
        padding: 12px 0;
    }
}

/* ---------- Fade-in Animation ---------- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.control-bar,
.countdown-card {
    opacity: 0;
    animation: fadeInUp 0.5s ease-out both;
}

.control-bar       { animation-delay: 0s; }
.countdown-card    { animation-delay: 0.25s; }

/* ---------- Progress Info Label ---------- */
.progress-info {
    font: var(--md-body-small);
    color: var(--md-on-surface-variant);
    text-align: center;
    margin-bottom: 6px;
}

/* ---------- Progress Tooltip ---------- */
.progress-tooltip {
    font: var(--md-body-small);
    font-weight: 700;
    color: rgb(222, 138, 22);
    text-align: center;
    min-height: 1.2em;
    margin-bottom: 4px;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.progress-tooltip.visible {
    visibility: visible;
    opacity: 1;
}

/* ---------- Site Logo ---------- */
.site-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.site-logo img {
    height: clamp(32px, 6vh, 64px);
    width: auto;
    display: block;
}

/* ---------- MD3 Control Bar ---------- */
.control-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

/* ---------- Filled Dropdown ---------- */
.dropdown-btn {
    font: var(--md-label-large);
    color: var(--md-on-surface);
    background: transparent;
    border: none;
    border-radius: var(--md-shape-full);
    padding: 6px 16px;
    min-height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    transition: background 0.15s ease;
    touch-action: manipulation;
}

.dropdown-btn:hover {
    background: var(--md-surface-container-high);
}

.dropdown-btn:focus-visible {
    outline: 2px solid var(--md-primary);
    outline-offset: 2px;
}

.dropdown-arrow {
    font-size: 0.65rem;
    line-height: 1;
    transition: transform 0.2s ease;
}

.region-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

/* MD3 Menu surface */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 180px;
    background: var(--md-surface-container);
    border-radius: var(--md-shape-sm);
    box-shadow: var(--md-elevation-3);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    overflow: hidden;
    pointer-events: none;
    padding: 4px 0;
}

.region-dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-item {
    font: var(--md-body-medium);
    color: var(--md-on-surface);
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.dropdown-item:hover {
    background: var(--md-surface-container-highest);
}

.dropdown-item.active {
    background: var(--md-primary);
    color: var(--md-on-primary);
    font-weight: 600;
}

.lang-btn {
    font: var(--md-label-large);
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--md-on-surface);
    background: transparent;
    border: none;
    border-radius: var(--md-shape-full);
    padding: 6px 16px;
    min-height: 40px;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    transition: background 0.15s ease;
}

.lang-btn:hover {
    background: rgb(222, 138, 22);
    color: #ffffff;
}

.lang-btn:focus-visible {
    outline: 2px solid var(--md-primary);
    outline-offset: 2px;
}

/* ---------- Flat card (no box, no shadow) ---------- */
.card {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

.countdown-card {
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: clamp(150px, 35vh, 260px);
}

/* ---------- MD3 Countdown Section ---------- */

.countdown-wrapper {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 12px;
    user-select: none;
}

.countdown-wrapper .countdown-subtitle {
    flex-basis: 100%;
    text-align: center;
}

.number {
    font: var(--md-display-small);
    font-weight: 100;
    font-size: clamp(3rem, 15vw, 11rem);
    line-height: 1;
    color: var(--md-primary);
    transition: color 0.3s ease, font-size 0.3s ease, opacity 0.25s ease;
    font-variant-numeric: tabular-nums;
    letter-spacing: -2px;
}

.countdown-card.browsing .number {
    opacity: 0.7;
}

.label {
    font: var(--md-label-large);
    font-size: clamp(0.7rem, 2vw, 1.3rem);
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--md-on-surface-variant);
    transition: opacity 0.25s ease;
}

.countdown-subtitle {
    font: var(--md-body-medium);
    font-size: clamp(0.65rem, 2vw, 1.3rem);
    color: var(--md-on-surface-variant);
    min-height: 1.25em;
    opacity: 0.85;
    transition: opacity 0.25s ease;
    letter-spacing: 0.5px;
    font-variant-numeric: tabular-nums;
}

/* ---------- MD3 Navigation ---------- */
.nav-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    margin-top: clamp(8px, 2vh, 20px);
    gap: 6px 8px;
    padding: 4px 0;
}

.nav-container .holiday-details {
    grid-column: 1 / -1;
    grid-row: 1;
    padding: 0 4px 4px;
}

.nav-container .nav-btn:first-child {
    grid-column: 1;
    grid-row: 2;
    justify-self: end;
}

.nav-container .break-btn {
    grid-column: 2;
    grid-row: 2;
    justify-self: center;
}

.nav-container .nav-btn:last-child {
    grid-column: 3;
    grid-row: 2;
    justify-self: start;
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .nav-container {
        gap: 6px 10px;
    }
    .nav-container .holiday-details {
        padding: 0 2px 2px;
    }
}

/* ---------- Break Button ---------- */
.break-btn {
    font: var(--md-label-large);
    font-size: 0.85rem;
    color: rgb(222, 138, 22);
    background: rgba(222, 138, 22, 0.15);
    border: none;
    border-radius: var(--md-shape-full);
    padding: 8px 18px;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    white-space: nowrap;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.break-btn:hover {
    transform: scale(1.1);
    background: rgb(222, 138, 22);
    color: #ffffff;
}

/* ---------- MD3 Minimal Text Button (Back / Next) ---------- */
.nav-btn {
    font: var(--md-label-large);
    font-size: 2.8rem;
    font-weight: 700;
    color: rgb(222, 138, 22);
    background: transparent;
    border: none;
    border-radius: var(--md-shape-full);
    padding: 12px 28px;
    min-height: 72px;
    min-width: 80px;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    white-space: nowrap;
    width: auto;
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease;
}

.nav-btn:hover:not(:disabled) {
    background: rgb(222, 138, 22);
    color: #ffffff;
}

.nav-btn:active:not(:disabled) {
    background: rgb(190, 118, 18);
    color: #ffffff;
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-btn:focus-visible {
    outline: 2px solid var(--md-primary);
    outline-offset: 2px;
}

/* ---------- MD3 Holiday Details ---------- */
.holiday-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    padding: 4px 8px;
    height: auto;
    min-height: clamp(50px, 10vh, 80px);
    justify-content: center;
}

.holiday-name {
    font: var(--md-title-large);
    font-size: clamp(0.9rem, 2.5vw, 1.8rem);
    font-weight: 700;
    text-align: center;
    line-height: 1.35;
    min-height: 1.35em;
}

.holiday-date {
    min-height: 1.5em;
}

.holiday-date {
    font: var(--md-body-medium);
    color: var(--md-on-surface-variant);
    margin-top: 2px;
    text-align: center;
    width: 100%;
}

/* ---------- Bottom Action Buttons Hover ---------- */
#btn-importance:hover,
#btn-burnout:hover {
    background: rgb(222, 138, 22) !important;
    color: #ffffff !important;
}

/* ---------- Progress Bar ---------- */
.progress-section {
    width: 100%;
    margin: 0 auto;
    padding: 0;
}

/* Desktop: constrain width to match the control-bar content area */
@media (min-width: 601px) {
    .progress-section {
        max-width: calc(100% - 8px);
    }
}

.progress-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.progress-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: flex-start;
}

.progress-bar .progress-cell {
    flex: 0 0 auto;
    box-sizing: border-box;
}

.progress-bar .progress-cell > div {
    border-radius: 50%;
    border: 5px solid transparent;
    background-clip: padding-box;
}

/* ---------- MD3 Footer Banner ---------- */
.footer-banner {
    text-align: center;
    font: var(--md-body-medium);
    color: var(--md-on-surface-variant);
    margin-top: 12px;
    min-height: 1.4em;
}

/* ---------- MD3 Toast (Snackbar) ---------- */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--md-inverse-surface);
    color: var(--md-inverse-on-surface);
    padding: 12px 24px;
    border-radius: var(--md-shape-sm);
    font: var(--md-body-medium);
    z-index: 9999;
    opacity: 0;
    transition: all 0.35s ease;
    pointer-events: none;
    max-width: 88%;
    text-align: center;
    box-shadow: var(--md-elevation-3);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---------- Footer ---------- */
.footer-spacer {
    flex: 1 0 auto;
    min-height: 24px;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 16px 0 4px;
    font: var(--md-body-small);
    color: var(--md-on-surface-variant);
    flex-wrap: wrap;
}

/* Push content up so fixed footer doesn't overlap */

.footer-links a {
    color: var(--md-on-surface-variant);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--md-on-surface);
}

.footer-sep {
    opacity: 0.4;
}

/* ============================================================
   Responsive — MD3 breakpoints
   ============================================================ */

/* Tablet */
@media (max-width: 768px) {
    body {
        padding: 16px;
        padding-bottom: calc(16px + var(--safe-bottom));
    }
    .number {
        font-size: 14rem;
    }
    .holiday-name {
        font-size: 2rem;
        font-weight: 700;
    }
}

/* Mobile - everything fits in viewport (latest iPhone ~390x844) */
@media (max-width: 600px) {
    body {
        min-height: 100vh;
    }

    .site-wrapper {
        padding: 8px;
        padding-bottom: calc(8px + var(--safe-bottom));
        min-height: 100vh;
    }

    .dashboard {
        gap: 6px;
        flex: 1;
        justify-content: flex-start;
        padding: 0;
    }

    .countdown-card {
        min-height: auto;
        padding: 16px 8px;
    }

    .countdown-wrapper {
        gap: 6px;
        margin: 4px 0;
    }

    .number {
        font-size: clamp(7.2rem, 36vw, 24rem);
        letter-spacing: -2px;
        line-height: 1;
    }

    .label {
        font-size: clamp(1.4rem, 4vw, 2.6rem);
    }

    .countdown-subtitle {
        font-size: clamp(1.3rem, 4vw, 2.6rem);
    }

    .nav-container {
        margin-top: 10px;
        gap: 10px;
    }

    .nav-container > .nav-btn {
        padding: 12px 20px !important;
        min-height: 58px;
        min-width: 64px;
        font-size: 2.2rem !important;
    }

    .holiday-name {
        font-size: 1.6rem;
        font-weight: 700;
        line-height: 1.2;
    }

    .holiday-date {
        font-size: 0.72rem;
    }

    .holiday-details {
        padding: 2px 6px;
    }

    .progress-section {
        overflow-y: auto;
        width: 100%;
        max-width: 100%;
        max-height: 35vh;
        margin: 2px auto;
        padding: 0;
    }

    .control-bar {
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 4px;
        padding: 2px 0;
    }

    .dropdown-btn {
        padding: 5px 12px !important;
        font-size: 0.72rem !important;
        min-height: 32px;
    }

    .dropdown-menu {
        min-width: 140px;
    }

    .dropdown-item {
        padding: 6px 14px;
        font-size: 0.72rem;
    }

    .lang-btn {
        padding: 5px 12px !important;
        font-size: 0.72rem !important;
        min-height: 32px;
    }

    .progress-bar {
        gap: 2px;
        width: 100%;
    }

    .footer-banner {
        font-size: 0.75rem !important;
        margin-top: 4px;
    }

    .footer-spacer {
        min-height: 8px;
    }

    .footer-links {
        font-size: 0.6rem;
    }

    .toast {
        bottom: 12px;
        padding: 8px 16px;
        font-size: 0.75rem;
        max-width: 94%;
    }
}

/* Small phones */
@media (max-width: 400px) {
    .number {
        font-size: clamp(7.2rem, 36vw, 24rem);
    }

    .label {
        font-size: clamp(1.4rem, 4vw, 2.6rem);
    }

    .countdown-subtitle {
        font-size: clamp(1.3rem, 4vw, 2.6rem);
    }

    .holiday-name {
        font-size: 1.6rem;
        font-weight: 700;
    }

    .holiday-date {
        font-size: 0.72rem;
    }

    .nav-container {
        padding: 0;
        gap: 5px;
    }

    .nav-container > .nav-btn {
        padding: 12px 20px !important;
        min-height: 58px;
        min-width: 64px;
        font-size: 2.2rem !important;
    }

    .lang-btn {
        padding: 5px 10px !important;
        font-size: 0.65rem !important;
        min-height: 32px;
    }
}

/* Landscape on small screens */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        min-height: 100vh;
    }

    .site-wrapper {
        padding: 6px;
        box-sizing: border-box;
    }

    .dashboard {
        gap: 8px;
    }

    .number {
        font-size: clamp(5rem, 37.5vw, 15rem);
    }

    .countdown-card {
        min-height: auto;
    }

    .countdown-wrapper {
        gap: 6px;
    }

    .nav-container {
        padding: 4px 0;
        margin-top: 6px;
    }

    .nav-btn {
        padding: 12px 24px !important;
        font-size: 1.1rem !important;
        min-height: 48px;
    }

    .holiday-name {
        font-size: 1.4rem;
        font-weight: 700;
    }

    .holiday-date {
        font-size: 0.7rem;
    }

    .footer-banner {
        font-size: 0.75rem !important;
        margin-top: 4px;
    }
}
