
/* =========================================================
   PICKMYDIGIT - COMPLETE SHARED STYLESHEET
   Mobile-app layout, forms, dashboard and quarter-pizza menu
   ========================================================= */

:root {
    --bg: #0b0f14;
    --surface: #121821;
    --surface-2: #18212c;
    --text: #f4f7fb;
    --muted: #9ba7b5;
    --border: #273241;
    --primary: #6d5dfc;
    --primary-2: #5547df;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 18px;
    --shadow: 0 12px 30px rgba(0, 0, 0, .22);
}

/* =========================================================
   GLOBAL
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

img {
    max-width: 100%;
}

.container {
    width: min(100% - 28px, 760px);
    margin: auto;
}

.page {
    padding: 20px 0 92px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: 1.55rem;
    margin-bottom: 8px;
}

h2 {
    font-size: 1.15rem;
    margin-bottom: 10px;
}

h3 {
    font-size: 1rem;
    margin-bottom: 8px;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: .86rem;
}

.text-primary {
    color: #9b91ff;
}

.stack {
    display: grid;
    gap: 14px;
}

.row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.between {
    justify-content: space-between;
}

/* =========================================================
   APP CONTAINER AND HEADER
   ========================================================= */

.app-container {
    position: relative;
    min-height: 100vh;
    padding-bottom: 84px;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 40;
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(11, 15, 20, .96);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
}

.brand {
    font-size: 1.05rem;
    font-weight: 800;
}

.app-content {
    width: min(100% - 24px, 760px);
    margin: 0 auto;
    padding: 18px 0 28px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.user-avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
}

.user-name {
    max-width: 125px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

.wallet-badge,
.leader-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    font-size: .8rem;
    font-weight: 700;
}

.leader-badge {
    width: 38px;
    flex: 0 0 38px;
    padding: 0;
    font-size: 1rem;
}

/* =========================================================
   CARDS AND LAYOUTS
   ========================================================= */

.card {
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 14px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

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

.stat {
    min-width: 0;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--surface-2);
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.stat-label {
    font-size: .78rem;
    color: var(--muted);
}

/* =========================================================
   BUTTONS
   ========================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    border: 0;
    border-radius: 13px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    text-align: center;
    transition: background-color .15s ease;
}

.btn:hover {
    background: var(--primary-2);
}

.btn-secondary {
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #263244;
}

.btn-success {
    background: var(--success);
}

.btn-danger {
    background: var(--danger);
}

.btn-warning {
    background: var(--warning);
    color: #111;
}

.btn-block {
    width: 100%;
}

.btn:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 2px solid #a5b4fc;
    outline-offset: 3px;
}

/* =========================================================
   FORMS
   ========================================================= */

.form-group {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.form-group label {
    font-size: .9rem;
    font-weight: 600;
}

.form-control,
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
select,
textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    border-radius: 13px;
    padding: 12px 13px;
    outline: none;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    accent-color: var(--primary);
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(109, 93, 252, .16);
}

textarea.form-control,
textarea {
    min-height: 110px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #8290a0;
    opacity: 1;
}

.password-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.password-field input {
    flex: 1;
    min-width: 0;
}

.password-toggle {
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text);
}

/* =========================================================
   ALERTS AND BADGES
   ========================================================= */

.alert {
    padding: 12px 14px;
    border-radius: 13px;
    border: 1px solid var(--border);
    background: var(--surface);
    margin-bottom: 14px;
    overflow-wrap: anywhere;
}

.alert-success {
    border-color: rgba(34, 197, 94, .4);
}

.alert-danger {
    border-color: rgba(239, 68, 68, .4);
}

.alert-warning {
    border-color: rgba(245, 158, 11, .4);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.badge-success {
    color: #86efac;
}

.badge-danger {
    color: #fca5a5;
}

.badge-warning {
    color: #fcd34d;
}

/* =========================================================
   TABLES
   ========================================================= */

.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 560px;
}

th,
td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
}

/* =========================================================
   AUTHENTICATION PAGES
   ========================================================= */

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 14px;
}

.auth-card {
    width: min(100%, 430px);
    margin: 0 auto;
}

.auth-logo {
    text-align: center;
    margin-bottom: 20px;
}

.auth-logo .brand-mark {
    width: 58px;
    height: 58px;
    margin: 0 auto 12px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: var(--primary);
    color: #fff;
    font-weight: 900;
    font-size: 1.25rem;
}

.auth-links {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-size: .88rem;
}

.auth-footer {
    margin-top: 16px;
    text-align: center;
}

.auth-actions {
    display: grid;
    gap: 10px;
}

/* =========================================================
   LEGACY SHARED NAVIGATION CLASSES
   ========================================================= */

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(11, 15, 20, .92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    width: min(100% - 28px, 760px);
    min-height: 62px;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.menu-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 1.2rem;
}

.dropdown {
    display: none;
    position: absolute;
    right: 14px;
    top: 58px;
    min-width: 190px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.dropdown.open {
    display: grid;
}

.dropdown a,
.dropdown button {
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    padding: 11px 12px;
    border-radius: 10px;
}

.dropdown a:hover,
.dropdown button:hover {
    background: var(--surface-2);
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    background: rgba(18, 24, 33, .96);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(14px);
}

.bottom-nav-inner {
    width: min(100%, 760px);
    margin: auto;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
}

.bottom-nav a {
    min-height: 62px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--muted);
    font-size: .72rem;
}

.bottom-nav a.active {
    color: var(--text);
}

.bottom-nav .nav-icon {
    font-size: 1.05rem;
}

/* =========================================================
   FIXED BOTTOM BAR
   The hamburger button lives in footer.php.
   ========================================================= */

.app-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    background: rgba(11, 15, 25, .98);
    border-top: 1px solid var(--border);
    z-index: 80;
}

.menu-trigger {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    box-shadow: 0 5px 16px rgba(239, 68, 68, .35);
    position: relative;
    z-index: 90;
    transition: transform .2s ease, background-color .2s ease;
}

.menu-trigger:active {
    transform: scale(.93);
}

.menu-trigger svg {
    width: 21px;
    height: 21px;
    fill: currentColor;
}

.menu-trigger[aria-expanded="true"] {
    background: #334155;
}

.menu-trigger[hidden] {
    display: none;
}

.ad-banner {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    background: #111827;
    border: 1px dashed #374151;
    border-radius: 9px;
    color: var(--muted);
    font-size: 10px;
    letter-spacing: .4px;
    font-weight: 600;
    text-align: center;
}

/* =========================================================
   QUARTER-PIZZA MENU OVERLAY
   Matches header.php:
   id="pizzaOverlay", class="pizza-overlay"
   ========================================================= */

.pizza-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0, 0, 0, .58);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .22s ease, visibility .22s ease;
}

.pizza-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Quarter-circle background */

.pizza-nav {
    position: absolute;
    left: 0;
    bottom: 64px;
    width: 270px;
    height: 270px;
    overflow: visible;
    background: radial-gradient(
        circle at bottom left,
        #25344a 0%,
        #111827 68%,
        #0f172a 100%
    );
    border: 1px solid #475569;
    border-bottom: 0;
    border-left: 0;
    border-top-right-radius: 100%;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .55);
    transform: scale(.7);
    transform-origin: bottom left;
    opacity: 0;
    pointer-events: none;
    transition: transform .25s ease, opacity .2s ease;
}

.pizza-overlay.active .pizza-nav {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Individual menu links */

.nav-pizza-item {
    position: absolute;
    width: 48px;
    height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 2px;
    border: 2px solid #475569;
    border-radius: 50%;
    background: #1e293b;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .45);
    opacity: 0;
    pointer-events: none;
    transform: scale(.5);
    transition:
        opacity .18s ease,
        transform .24s ease,
        background-color .15s ease;
    z-index: 10;
}

.pizza-overlay.active .nav-pizza-item {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

.nav-pizza-item:hover,
.nav-pizza-item:focus-visible {
    background: #3b82f6;
    border-color: #60a5fa;
    outline: none;
}

.nav-pizza-item:active {
    transform: scale(.92);
}

.nav-pizza-item.active {
    background: #4f46e5;
    border-color: #818cf8;
}

.nav-pizza-icon {
    font-size: 16px;
    line-height: 1;
}

.nav-pizza-label {
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 7px;
    line-height: 1;
    font-weight: 700;
    color: #cbd5e1;
}

/* Eight links:
   Home, History, Leaderboard, Notifications,
   Transfer, Me, Settings, Logout. */

.nav-pizza-item:nth-child(1) {
    left: 207px;
    bottom: 3px;
}

.nav-pizza-item:nth-child(2) {
    left: 190px;
    bottom: 43px;
}

.nav-pizza-item:nth-child(3) {
    left: 163px;
    bottom: 82px;
}

.nav-pizza-item:nth-child(4) {
    left: 128px;
    bottom: 119px;
}

.nav-pizza-item:nth-child(5) {
    left: 87px;
    bottom: 151px;
}

.nav-pizza-item:nth-child(6) {
    left: 45px;
    bottom: 181px;
}

.nav-pizza-item:nth-child(7) {
    left: 3px;
    bottom: 204px;
}

.nav-pizza-item:nth-child(8) {
    left: 3px;
    bottom: 151px;
}

/* =========================================================
   MOBILE RESPONSIVENESS
   ========================================================= */

@media (max-width: 560px) {
    .container {
        width: min(100% - 20px, 760px);
    }

    .page {
        padding-top: 14px;
    }

    .card {
        padding: 15px;
    }

    .app-content {
        width: min(100% - 20px, 760px);
        padding-top: 14px;
    }

    .grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 380px) {
    .app-header {
        padding: 9px;
        gap: 6px;
    }

    .user-name {
        max-width: 78px;
        font-size: .85rem;
    }

    .wallet-badge {
        padding: 6px;
        font-size: .7rem;
    }

    .pizza-nav {
        width: 235px;
        height: 235px;
    }

    .nav-pizza-item {
        width: 43px;
        height: 43px;
    }

    .nav-pizza-item:nth-child(1) {
        left: 178px;
        bottom: 3px;
    }

    .nav-pizza-item:nth-child(2) {
        left: 158px;
        bottom: 37px;
    }

    .nav-pizza-item:nth-child(3) {
        left: 133px;
        bottom: 70px;
    }

    .nav-pizza-item:nth-child(4) {
        left: 103px;
        bottom: 102px;
    }

    .nav-pizza-item:nth-child(5) {
        left: 69px;
        bottom: 130px;
    }

    .nav-pizza-item:nth-child(6) {
        left: 35px;
        bottom: 155px;
    }

    .nav-pizza-item:nth-child(7) {
        left: 2px;
        bottom: 177px;
    }

    .nav-pizza-item:nth-child(8) {
        left: 2px;
        bottom: 131px;
    }
}

/* Respect the visitor's reduced-motion preference. */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .pizza-overlay,
    .pizza-nav,
    .nav-pizza-item,
    .menu-trigger {
        transition: none;
    }
}


/* =========================================================
   THEME SUPPORT
   The saved preference is applied to <html data-theme="...">.
   ========================================================= */

html[data-theme="light"] {
    color-scheme: light;
    --bg: #f2f5fb;
    --surface: #ffffff;
    --surface-2: #f7f9fd;
    --text: #172033;
    --muted: #68758a;
    --border: #dce3ef;
    --primary: #5b4de8;
    --primary-2: #493bcf;
    --success: #16834a;
    --danger: #c62828;
    --warning: #a86400;
    --shadow: 0 12px 30px rgba(30, 52, 95, .10);
}

html[data-theme="dark"] {
    color-scheme: dark;
}

html[data-theme="light"],
html[data-theme="light"] body {
    background-color: var(--bg);
    color: var(--text);
}

/* Shared bars used hard-coded dark colors in the original stylesheet. */
html[data-theme="light"] .app-header {
    background: rgba(255, 255, 255, .96);
    border-bottom-color: var(--border);
}

html[data-theme="light"] .app-topbar {
    background: rgba(255, 255, 255, .94);
    border-bottom-color: var(--border);
}

html[data-theme="light"] .bottom-nav {
    background: rgba(255, 255, 255, .96);
    border-top-color: var(--border);
}

html[data-theme="light"] .app-footer {
    background: rgba(255, 255, 255, .98);
    border-top-color: var(--border);
}

html[data-theme="light"] .btn-secondary:hover {
    background: #e8edf6;
}

html[data-theme="light"] .ad-banner {
    background: #f7f9fd;
    border-color: #cbd5e1;
    color: #68758a;
}

/* Light-mode version of the quarter-circle navigation. */
html[data-theme="light"] .pizza-nav {
    background: radial-gradient(
        circle at bottom left,
        #e5ecf8 0%,
        #f8faff 68%,
        #ffffff 100%
    );
    border-color: #cbd5e1;
    box-shadow: 0 12px 30px rgba(30, 52, 95, .20);
}

html[data-theme="light"] .nav-pizza-item {
    background: #ffffff;
    color: #172033;
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(30, 52, 95, .16);
}

html[data-theme="light"] .nav-pizza-label {
    color: #475569;
}

html[data-theme="light"] .nav-pizza-item:hover,
html[data-theme="light"] .nav-pizza-item:focus-visible {
    background: #dbeafe;
    border-color: #60a5fa;
    color: #172033;
}

html[data-theme="light"] .nav-pizza-item.active {
    background: #4f46e5;
    border-color: #818cf8;
    color: #ffffff;
}

html[data-theme="light"] .nav-pizza-item.active .nav-pizza-label {
    color: #ffffff;
}

html[data-theme="light"] .text-primary {
    color: #5145cd;
}

html[data-theme="light"] .badge-success {
    color: #166534;
}

html[data-theme="light"] .badge-danger {
    color: #991b1b;
}

html[data-theme="light"] .badge-warning {
    color: #854d0e;
}

/* Keep the overlay visible while ensuring the page underneath is light. */
html[data-theme="light"] .pizza-overlay {
    background: rgba(15, 23, 42, .32);
}
