/* ================================================================
   STYLE.CSS — LOTTERY SIMULATOR
   ================================================================
   THE ONE RULE THAT MATTERS MOST:

   Before adding a new rule, search this file (Ctrl+F) for the class
   name first. If it already exists — EDIT it in place. Never paste
   a second definition further down "just for now."

   When you do a visual "redesign pass" on something (e.g. navbar
   v2), go to its EXISTING section and rewrite it there. Do not
   start a new "NAVBAR v2" block at the bottom of the file — that
   is exactly how duplicates pile up.

   Media query overrides for a rule live directly under that rule,
   not batched into one giant block at the end of the file.
   ================================================================ */


/* ================================================================
   SECTION 1 — RESET & VARIABLES
   Browser reset and the single source of truth for colors,
   spacing, and radii. Every other section references these
   variables — never hardcode a hex color anywhere else.
   ================================================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

:root {
    /* Brand colors — navy -> blue identity, orange as the accent,
       matching the Loan Fund app family */
    --blue_dark:     #000034;
    --blue:          #0562b0;
    --blue_light:    #e8f3fc;
    --green:         #10b981;
    --green_light:   #e3f9f0;
    --red:           #dc2626;
    --red_light:     #fbe0df;
    --orange:        #f97316;
    --orange_light:  #fff1e6;
    --yellow:        #ffd23f;
    --yellow_dark:   #9a6c00;

    --text_dark:     #1a1a2e;
    --gray_text:     #55607a;
    --gray_light:    #f2f4f9;
    --gray_mid:      #e3e7f0;
    --gray_border:   #d8dce6;
    --white:         #ffffff;

    /* Signature brand gradient — navbar, footer, primary buttons, balls */
    --gradient_brand: linear-gradient(to right, var(--blue_dark), var(--blue));

    /* Fonts */
    --font_display: "Poppins", "Segoe UI", sans-serif;
    --font_body:    "Inter", "Segoe UI", Arial, sans-serif;
    --font_mono:    "JetBrains Mono", "Courier New", monospace;

    /* Spacing & shape — reuse everywhere instead of magic numbers */
    --radius:        8px;
    --radius_sm:     6px;
    --shadow_sm:     0 1px 3px rgba(0,0,0,0.08);
    --shadow_md:     0 4px 12px rgba(0,0,0,0.12);
}

body {
    font-family: var(--font_body);
    background: linear-gradient(45deg,
        rgba(5,98,176,0.10) 0%,
        rgba(249,115,22,0.08) 50%,
        rgba(0,0,52,0.10) 100%),
        var(--gray_light);
    color: var(--text_dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}


/* ================================================================
   SECTION 2 — GLOBAL LAYOUT
   Structural pieces every page shares: navbar, footer, page
   wrapper, card grids. If it appears on more than one page,
   it belongs here — not copy-pasted into a page-specific section.
   ================================================================ */

.navbar {
    background: var(--gradient_brand);
    padding: 14px 20px;
    box-shadow: var(--shadow_sm);
}

.nav_inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    width: 100%;
}

.nav_left, .nav_right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.nav_brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-family: var(--font_display);
    font-weight: 700;
    font-size: 19px;
    color: var(--orange);
}
.nav_brand .nav_brand_icon {
    font-size: 22px;
    display: inline-block;
    transition: transform 0.2s ease;
}
.nav_brand:hover .nav_brand_icon { transform: rotate(18deg); }

.nav_link {
    color: var(--white);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: bold;
    opacity: 0.9;
}
.nav_link:hover { opacity: 1; text-decoration: underline; }

.page_wrap {
    flex: 1;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

.footer {
    background: var(--gradient_brand);
    color: rgba(255,255,255,0.85);
    font-size: 12.5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 14px 20px;
    text-align: center;
}

.footer_clock {
    font-family: var(--font_mono);
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--yellow);
}

/* Card grid — dashboard-style summary tiles (reserved for future use) */
.card_grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.dash_card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px 14px;
    text-align: center;
    box-shadow: var(--shadow_sm);
}
@media (max-width: 600px) {
    .card_grid { grid-template-columns: repeat(2, 1fr); }
}

/* Content card — general-purpose panel used on every page */
.content_card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow_sm);
    padding: 22px;
    margin-bottom: 18px;
}
.content_card h2 {
    font-family: var(--font_display);
    font-size: 20px;
    margin-bottom: 8px;
}
.content_card h3 {
    font-family: var(--font_display);
    font-size: 16px;
    margin-bottom: 6px;
}


/* ================================================================
   SECTION 3 — GLOBAL COMPONENTS
   Buttons, form fields, badges, alerts. Anything reused across
   multiple pages/modals. This is the section you'll touch most
   often — resist the urge to redefine one of these inside a
   page-specific block instead of editing it here.
   ================================================================ */

/* --- Buttons --- */
.btn_submit {
    height: 42px;
    min-width: 130px;
    padding: 0 20px;
    background: var(--gradient_brand);
    color: var(--orange);
    font-family: var(--font_display);
    font-size: 14.5px;
    font-weight: bold;
    border: none;
    border-radius: var(--radius_sm);
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
}
.btn_submit:hover { filter: brightness(1.08); }
.btn_submit:active { transform: translateY(1px); }
.btn_submit:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }

/* Secondary action — used for "Save" (draw already exists, distinct from primary "Draw") */
.btn_save {
    height: 42px;
    min-width: 130px;
    padding: 0 20px;
    background: var(--green);
    color: var(--white);
    font-family: var(--font_display);
    font-size: 14.5px;
    font-weight: bold;
    border: none;
    border-radius: var(--radius_sm);
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
}
.btn_save:hover { filter: brightness(1.08); }
.btn_save:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
.btn_save.btn_saved { background: var(--gray_mid); color: var(--gray_text); }

.btn_cancel, .btn_back {
    background: var(--red_light);
    color: var(--red);
    border: 2px solid var(--red);
    border-radius: var(--radius_sm);
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    padding: 8px 18px;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
    display: inline-block;
}
.btn_cancel:hover, .btn_back:hover {
    background: var(--red);
    color: var(--white);
}

/* "Back to Home" — used on every sub-page instead of Cancel, since
   this is a game, not a form to abandon. Blue, matching the "open
   modal / other actions" color family, not red/green (those stay
   reserved for Cancel/Save). */
.btn_home_back {
    background: var(--blue_light);
    color: var(--blue);
    border: 2px solid var(--blue);
    border-radius: var(--radius_sm);
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    padding: 8px 18px;
    margin-bottom: 16px;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn_home_back:hover {
    background: var(--blue);
    color: var(--white);
}

/* --- Home page layout: sidebar + main content --- */
.home_layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 640px) {
    .home_layout { grid-template-columns: 1fr; }
}

.sidebar_nav {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow_sm);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar_link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius_sm);
    color: var(--text_dark);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    background: var(--gray_light);
    transition: background 0.15s, color 0.15s, transform 0.1s;
}
.sidebar_link:hover {
    background: var(--gradient_brand);
    color: var(--white);
    transform: translateX(2px);
}
.sidebar_link .sidebar_icon { font-size: 18px; }

/* --- Ad banner placeholder (charity messaging area) --- */
.ad_banner {
    background: var(--orange_light);
    border: 2px dashed var(--orange);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 18px;
}
.ad_banner .ad_icon { font-size: 28px; flex-shrink: 0; }
.ad_banner .ad_text { font-size: 13.5px; color: var(--text_dark); }
.ad_banner .ad_text strong { color: var(--orange); }

/* Two-button row — 50/50 split via Grid (flex-basis with mismatched
   element types does not split evenly even with equal flex values). */
.btn_row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 14px;
}

/* --- Form fields --- */
.field_group { margin-bottom: 14px; }
.field_row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.field_label {
    font-size: 13px;
    font-weight: bold;
    color: var(--text_dark);
    display: block;
    margin-bottom: 6px;
}

.field_input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    font-size: 15px;
    font-weight: 500;
    font-family: var(--font_body);
    color: var(--text_dark);
    background: var(--gray_light);
    border: 2px solid var(--gray_mid);
    border-radius: var(--radius_sm);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.field_input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.2);
}

.field_readonly {
    height: 46px;
    padding: 0 14px;
    background: var(--gray_light);
    border-radius: var(--radius_sm);
    display: flex;
    align-items: center;
    font-weight: bold;
    color: var(--text_dark);
    font-size: 15px;
    border: 2px solid var(--gray_mid);
}

/* Digit-entry boxes for lottery numbers — no spinner arrows,
   fixed square shape, auto-advances via JS on input. */
.number_box {
    width: 48px;
    height: 48px;
    text-align: center;
    display: inline-block;
    margin: 3px;
    font-size: 18px;
    font-family: var(--font_mono);
    font-weight: 700;
    color: var(--text_dark);
    background: var(--gray_light);
    border: 2px solid var(--gray_mid);
    border-radius: var(--radius_sm);
    -moz-appearance: textfield;
}
.number_box:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.2);
}
.number_box::-webkit-outer-spin-button,
.number_box::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* --- Badges / pills --- */
.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    height: 24px;
    padding: 0 10px;
    border-radius: var(--radius_sm);
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}
.pill_active { background: var(--green_light); color: var(--green); }
.pill_closed { background: var(--blue_light);  color: var(--blue);  }
.pill_warn   { background: var(--orange_light); color: var(--orange); }
.pill_demo   { background: var(--yellow); color: #4a3300; }

/* --- Alerts --- */
.alert_error, .alert_success, .alert_info {
    border-radius: var(--radius_sm);
    padding: 10px 14px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.alert_error   { background: var(--red_light);   color: var(--red);   box-shadow: inset 4px 0 0 0 var(--red); }
.alert_success { background: var(--green_light); color: #0b6b45;      box-shadow: inset 4px 0 0 0 var(--green); }
.alert_info    { background: var(--blue_light);  color: var(--blue);  box-shadow: inset 4px 0 0 0 var(--blue); }

/* --- Lottery balls — reused on Play Compare, Play Random, My Numbers --- */
.ball {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gradient_brand);
    color: var(--white);
    margin: 4px;
    font-weight: 700;
    font-family: var(--font_mono);
    font-size: 15px;
}
.ball.ball_match {
    background: var(--orange);
    color: #241300;
    box-shadow: 0 0 0 3px rgba(255,122,41,0.25);
}

/* --- Text utilities --- */
.subtext { font-size: 13px; color: var(--gray_text); }
.gloss   { font-size: 12px; color: var(--gray_text); font-style: italic; }
.error_text { color: var(--red); margin-top: 12px; font-size: 13.5px; }


/* ================================================================
   SECTION 4 — GLOBAL MODALS
   Every modal in the app (confirmations, "Info ..." detail popups,
   forms) shares this shell. Page-specific modals only add their
   OWN body content in Section 5 — never redefine .modal_box here.
   Not in use yet in this project — kept ready for future features
   (e.g. a "confirm save" or "game rules" modal).
   ================================================================ */

.modal_overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal_overlay.modal_open { display: flex; }

.modal_box {
    background: var(--white);
    border-radius: var(--radius);
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow_md);
}

.modal_header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray_light);
}
.modal_close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--gray_text);
}

.modal_body { padding: 20px; }

.modal_footer {
    padding: 14px 20px 18px;
    border-top: 1px solid var(--gray_light);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.modal_footer_single {
    display: flex;
    justify-content: flex-end;
}
.modal_footer_single > button { flex: 0 0 50%; }

.modal_field_label { font-size: 14px; font-weight: 700; color: var(--text_dark); }
.modal_field_value,
.field_readonly.modal_field_value,
.field_input.modal_field_value { color: var(--blue); }


/* ================================================================
   SECTION 5 — PAGE-SPECIFIC STYLES
   One sub-section per page/view. Put something here ONLY if it
   truly can't be generalized into Sections 2-4. If you catch
   yourself copying a rule from one page's sub-section into
   another's, that's a signal it belongs in a global section instead.
   ================================================================ */

/* ---- Dashboard ---- */
.dashboard_list { list-style: none; margin-top: 8px; }
.dashboard_list li { margin-bottom: 6px; }
.dashboard_list a { color: var(--blue); font-weight: 600; text-decoration: none; }
.dashboard_list a:hover { text-decoration: underline; }

/* ---- Play Compare / Play Random ---- */
.draw_result { margin-top: 20px; }

/* ---- My Numbers ---- */
.history_row {
    border-bottom: 1px solid var(--gray_border);
    padding: 12px 0;
}
.history_row:last-child { border-bottom: none; }


/* ================================================================
   SECTION 6 — SHARED RESPONSIVE OVERRIDES
   Most media-query tweaks should live directly under the rule they
   modify (see .card_grid above for the pattern). Use this section
   only for a handful of truly page-independent, catch-all rules —
   not as a dumping ground for every mobile fix in the app.
   ================================================================ */

@media (max-width: 480px) {
    .page_wrap { padding-left: max(12px, env(safe-area-inset-left));
                 padding-right: max(12px, env(safe-area-inset-right)); }
}
