/* ===============================
   Typography System
================================= */

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    background-color: #f6f8fb;
    color: #1f2937;
}

h1 {
    font-size: 24px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 16px;
    color: #1f2937;
}

h2 {
    font-size: 20px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 16px;
    color: #1f2937;
}

h3 {
    font-size: 16px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 12px;
    color: #1f2937;
}

small, .text-sm {
    font-size: 13px;
    color: #64748b;
}

/* Navbar */
.navbar {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo {
    font-weight: 600;
    font-size: 18px;
    color: #1f3a8a;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
    margin: 0;
    padding: 0;
}

.nav-links a {
    text-decoration: none;
    color: #334155;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-links .nav-dropdown-toggle {
    color: #334155;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: #1f3a8a;
}

.nav-links .nav-dropdown-toggle:hover {
    color: #1f3a8a;
}

.nav-links a.active {
    color: #1f3a8a;
    font-weight: 600;
}

/* Main */
.main-content {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

/* ===============================
   Card Polish
================================= */

.card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.card.shadow-lg {
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}

.card h3 {
    margin-top: 0;
}

/* ===============================
   Table Refinement
================================= */

table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
}

thead {
    background: #f3f4f6;
}

th {
    text-align: left;
    font-weight: 600;
    padding: 12px 14px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    color: #374151;
    background: #f3f4f6;
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}

tbody tr:hover {
    background: #f9fafb;
    transition: background 0.15s ease;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    font-size: 13px;
    color: #64748b;
}

/* ===== Section Title ===== */

/* ===== Buttons ===== */
.btn {
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    background: #1f3a8a;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn:hover {
    background: #172554;
}

.btn-secondary {
    background: #64748b;
}

.btn-danger {
    background: #dc2626;
}

/* ===============================
   Forms
================================= */

input, select, textarea {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
    line-height: 1.5;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #1f3a8a;
    box-shadow: 0 0 0 3px rgba(31, 58, 138, 0.1);
}

label {
    font-size: 14px;
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
    color: #374151;
}

.form-group {
    margin-bottom: 18px;
}

/* Unified lottery ball sizing */
.number-ball,
.ball,
.pick-ball {
    width: 42px;
    height: 42px;
    line-height: 42px;
    font-size: 16px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}


/* ===== Admin Badges ===== */
.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-admin {
    background: #dbeafe;
    color: #1e3a8a;
}

.badge-active {
    background: #dcfce7;
    color: #166534;
}

/* ===============================
   Responsive (Mobile)
================================= */

@media (max-width: 768px) {
    /* Typography */
    body {
        font-size: 14px;
    }

    h1 {
        font-size: 20px;
        margin-bottom: 14px;
    }

    h2 {
        font-size: 18px;
        margin-bottom: 12px;
    }

    h3 {
        font-size: 15px;
        margin-bottom: 10px;
    }

    /* Navbar */
    .nav-container {
        padding: 0 12px;
        height: 56px;
    }

    .logo {
        font-size: 16px;
    }

    .nav-links {
        gap: 12px;
        flex-wrap: wrap;
    }

    .nav-links a {
        font-size: 13px;
    }

    .nav-links .nav-dropdown-toggle {
        font-size: 13px;
    }

    /* Main Content */
    .main-content {
        margin: 20px auto;
        padding: 0 12px;
    }

    /* Card */
    .card {
        padding: 14px;
        border-radius: 8px;
        margin-bottom: 16px;
    }

    /* Table Mobile Optimization */
    table {
        font-size: 13px;
    }

    thead {
        display: none;
    }

    tbody {
        display: block;
    }

    tr {
        display: block;
        border: 1px solid #e5e7eb;
        border-radius: 6px;
        margin-bottom: 12px;
        padding: 0;
    }

    td {
        display: block;
        padding: 10px 12px;
        border: none;
        border-bottom: 1px solid #f1f5f9;
        text-align: right;
        position: relative;
        padding-left: 40%;
    }

    td:last-child {
        border-bottom: none;
    }

    /* Forms */
    input, select, textarea {
        padding: 12px 12px;
        font-size: 16px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    /* Buttons */
    .btn {
        padding: 10px 16px;
        width: 100%;
        font-size: 14px;
    }

    /* Footer */
    .footer {
        padding: 16px 12px;
        font-size: 12px;
    }

    /* Container Padding */
    .container {
        padding: 0 12px;
    }
}

/* ===============================
   Tablet Adjustments (769px - 1024px)
================================= */

@media (max-width: 1024px) {
    .main-content {
        padding: 0 16px;
    }

    .card {
        padding: 16px;
    }
}

/* ===============================
   Home Hero Lotto Card
================================= */

.hero-lotto-card {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 34px;
    gap: 24px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.05);
}

.hero-lotto-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left: 6px solid #1f3a8a;
    padding-left: 20px;
}

.hero-lotto-card .brand-title {
    font-size: 26px;
    font-weight: 800;
}

.hero-lotto-card .brand-sub {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
    letter-spacing: 1px;
}

.hero-lotto-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
}

.hero-lotto-card .meta-label {
    font-size: 13px;
    color: #6b7280;
}

.hero-lotto-card .meta-value {
    font-size: 18px;
    font-weight: 600;
}

.hero-lotto-card .meta-block:first-child .meta-value {
    font-size: 22px;
    font-weight: 800;
}

.hero-lotto-numbers {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-lotto-card .numbers-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
}

.hero-lotto-card .numbers-section {
    margin-bottom: 18px;
}

.hero-lotto-card .numbers-label {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 10px;
}

.hero-lotto-card .numbers-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 0;
}

.hero-lotto-card .ball {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(to bottom, #ffb347, #f97316);
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 17px;
    flex: 0 0 44px;
}

.hero-lotto-card .ball.special {
    background: linear-gradient(to bottom, #ff6b6b, #dc2626);
    color: #ffffff;
}

/* === 近四期卡片區塊 === */
.recent-section {
    margin-top: 40px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
}

.mini-hero-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 18px 22px;
    margin-bottom: 16px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.04);
}

.mini-hero-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 14px;
}

.mini-draw {
    font-weight: 600;
}

.mini-date {
    font-size: 13px;
    color: #6b7280;
}

.mini-numbers-section {
    margin-bottom: 12px;
}

.mini-numbers-label {
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 8px;
}

.mini-numbers-columns {
    display: flex;
    gap: 24px;
    margin-top: 12px;
}

.mini-numbers-col {
    flex: 1;
}

.mini-numbers-col .mini-numbers-label {
    margin-bottom: 8px;
}

.mini-numbers-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.mini-ball {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(to bottom, #ffb347, #f97316);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.mini-ball.special {
    background: linear-gradient(to bottom, #ff6b6b, #dc2626);
    color: white;
}

/* Minimal lotto ball UI styles for payout method badges */
.lotto-ball {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.lotto-ball-main {
    background: radial-gradient(circle at 30% 30%, #ffb347, #ff8c00);
}

.lotto-ball-special {
    background: radial-gradient(circle at 30% 30%, #ff6b6b, #d90429);
}

/* === KPI 獎金資訊區塊 === */
.kpi-section {
    margin-top: 50px;
}

.kpi-meta-line {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 20px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.kpi-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 26px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.04);
}

.kpi-label {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 12px;
}

.kpi-value {
    font-size: 22px;
    font-weight: 700;
}

@media (max-width: 768px) {
    .hero-lotto-card {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }
}
/* === 彩種下拉選單優化 === */
.topbar__form select {
    height: 42px;
    padding: 0 14px;
    font-size: 15px;
    line-height: 1.4;
    border-radius: 10px;
    box-sizing: border-box;
}

.topbar__form select option {
    font-size: 15px;
}

/* Lab Dashboard v1.1 (safe layout only) */
.dashboard-container .kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dashboard-container .kpi-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.dashboard-container .kpi-value {
    font-size: 20px;
    font-weight: 600;
}

.dashboard-container .kpi-label {
    font-size: 13px;
    color: #666;
}

.dashboard-container .recommend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
}

.dashboard-container .recommend-card,
.dashboard-container .recommend-grid .rec-card {
    background: #fff;
    padding: 20px 24px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.dashboard-container .lab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.dashboard-container .lab-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
}

.dashboard-container .recommend-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #1f2937;
}

.dashboard-container .recommend-sub {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 10px;
}

.dashboard-container .ball-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dashboard-container .lotto-ball {
    width: 34px;
    height: 34px;
    font-size: 14px;
}

.lab-ranking-table thead th,
#rankingTable thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f3f4f6;
}

.lab-ranking-table tbody td:first-child,
#rankingTable tbody td:first-child {
    font-weight: 700;
    color: #1f3a8a;
}

/* Navbar Protection */
.navbar {
    height: 64px;
    display: flex;
    align-items: center;
}

.navbar .nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Redeem page: Enterprise layout with scoped styles */
.redeem-page .card {
    padding: 0;
}

.redeem-page .redeem-draw-card {
    border-radius: 18px;
    border: 1px solid #dbe2ef;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.07);
}

.redeem-page .redeem-draw-body {
    padding: 22px 24px;
}

.redeem-page .redeem-draw-kicker {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #1e3a8a;
    text-transform: uppercase;
    background: #e0e7ff;
    padding: 5px 10px;
    border-radius: 999px;
    margin-bottom: 14px;
}

.redeem-page .redeem-draw-hero {
    display: grid;
    grid-template-columns: 1.1fr 1fr 2fr;
    gap: 24px;
    align-items: center;
}

.redeem-page .redeem-draw-brand {
    border-left: 6px solid #1f3a8a;
    padding-left: 20px;
}

.redeem-page .redeem-draw-brand .brand-title {
    font-size: 42px;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.1;
}

.redeem-page .redeem-draw-brand .brand-sub {
    font-size: 13px;
    color: #64748b;
    margin-top: 8px;
    letter-spacing: 0.15em;
}

.redeem-page .redeem-draw-meta {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.redeem-page .redeem-draw-meta .meta-label {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
}

.redeem-page .redeem-draw-meta .meta-value {
    font-size: 30px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.15;
}

.redeem-page .redeem-draw-meta .meta-block:first-child .meta-value {
    font-size: 36px;
}

.redeem-page .redeem-draw-meta .meta-block:not(:first-child) .meta-value {
    font-size: 30px;
    font-weight: 700;
}

.redeem-page .redeem-draw-meta .meta-value-sm {
    font-size: 17px !important;
    font-weight: 600 !important;
}

.redeem-page .redeem-draw-numbers .numbers-title {
    font-size: 30px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 18px;
}

.redeem-page .redeem-draw-numbers .numbers-section {
    margin-bottom: 14px;
}

.redeem-page .redeem-draw-numbers .numbers-label {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 8px;
}

.redeem-page .redeem-draw-numbers .numbers-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.redeem-page .redeem-draw-numbers .ball {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    font-weight: 700;
    color: #0f172a;
    background: linear-gradient(180deg, #ffd477 0%, #f59e0b 100%);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.55), 0 4px 10px rgba(245, 158, 11, 0.25);
}

.redeem-page .redeem-draw-numbers .ball.special {
    color: #fff;
    background: linear-gradient(180deg, #ff7a7a 0%, #dc2626 100%);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.45), 0 4px 10px rgba(220, 38, 38, 0.25);
}

.redeem-page .redeem-draw-numbers .numbers-empty {
    font-size: 22px;
    font-weight: 700;
    color: #94a3b8;
}

.redeem-page .card-header {
    padding: 14px 18px;
    font-size: 16px;
    font-weight: 700;
    border-bottom: 1px solid #e5e7eb;
}

.redeem-page .card-body {
    padding: 18px;
}

/* Redeem Lotto Grid - Updated 2026-03-04 v3 - Center aligned */
.redeem-page .lotto-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
    margin-top: 12px;
}

/* Redeem Balls */
.redeem-page .lotto-ball {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid #444;
    font-size: 15px;
    font-weight: 600;
    background: white;
    color: #333;
    cursor: pointer;
    transition: all 0.15s ease;
}

.redeem-page .lotto-ball:hover {
    background: #2b6cb0;
    color: white;
    border-color: #2b6cb0;
}

.redeem-page .lotto-ball.active {
    background: #2b6cb0;
    color: white;
    border-color: #2b6cb0;
}

/* Zone2 Ball Styling */
.redeem-page #zone2Block .lotto-ball {
    border-color: #666;
}

.redeem-page #zone2BallWrap {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
}

.redeem-page #zone2Block .lotto-ball:hover {
    background: #c84e1a;
    color: white;
    border-color: #c84e1a;
}

.redeem-page #zone2Block .lotto-ball.active {
    background: #c84e1a;
    color: white;
    border-color: #c84e1a;
}

.redeem-page .redeem-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.redeem-page .redeem-info-grid .label {
    font-size: 12px;
    color: #888;
}

.redeem-page .redeem-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

.redeem-page .btn-primary {
    background: #1f3a8a;
    color: #fff;
}

.redeem-page .btn-outline-secondary {
    background: transparent;
    color: #64748b;
    border: 1px solid #cbd5e1;
}

.redeem-page .btn-outline-secondary:hover {
    background: #f8fafc;
}

@media (max-width: 768px) {
    .redeem-page .redeem-draw-body {
        padding: 18px 16px;
    }

    .redeem-page .redeem-draw-hero {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .redeem-page .redeem-draw-brand .brand-title {
        font-size: 34px;
    }

    .redeem-page .redeem-draw-meta .meta-value {
        font-size: 24px;
    }

    .redeem-page .redeem-draw-meta .meta-block:first-child .meta-value {
        font-size: 28px;
    }

    .redeem-page .redeem-draw-meta .meta-block:not(:first-child) .meta-value {
        font-size: 24px;
    }

    .redeem-page .redeem-draw-numbers .numbers-title {
        font-size: 24px;
        margin-bottom: 14px;
    }

    .redeem-page .lotto-grid {
        justify-content: center;
    }

    .redeem-page .redeem-info-grid {
        grid-template-columns: 1fr;
    }
}

/* Navbar Dropdown */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #1e2a44;
    padding: 8px 0;
    border-radius: 8px;
    min-width: 150px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
    z-index: 1000;
    margin-top: 4px;
}

.nav-dropdown-menu a {
    display: block;
    padding: 10px 16px;
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s ease;
}

.nav-dropdown-menu a:hover {
    background: rgba(255,255,255,0.1);
}

.nav-dropdown.open .nav-dropdown-menu {
    display: block;
}
