/* ==========================================================================
   OddsEdge design system
   Tokens: navy #0F2C5C (brand) / signal blue #1E5FFF (interactive) /
   white + #F6F9FF (surfaces) / green #0F9D58 + red #E0393E (functional only)
   Type: Space Grotesk (display) + Inter (body) + IBM Plex Mono (odds data)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
    --navy: #0F2C5C;
    --navy-deep: #0A1F44;
    --signal: #1E5FFF;
    --signal-hover: #164FDB;
    --white: #FFFFFF;
    --surface: #F6F9FF;
    --sky: #EAF1FF;
    --line: #DCE6F7;
    --ink: #0B1F3A;
    --muted: #5B6B85;
    --profit: #0F9D58;
    --profit-bg: #E7F7EE;
    --amber: #E08A00;
    --amber-bg: #FFF4E0;
    --alert: #E0393E;
    --alert-bg: #FDEAEA;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(15, 44, 92, 0.06), 0 4px 16px rgba(15, 44, 92, 0.06);
    --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
    --font-body: 'Inter', 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--ink);
    background-color: var(--surface);
}

a { color: var(--signal); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
    font-family: var(--font-display);
    color: var(--navy-deep);
    letter-spacing: -0.01em;
}

:focus-visible {
    outline: 2px solid var(--signal);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- Nav ---------- */
.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    background: var(--white);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}

.site-nav .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--navy-deep);
}

.site-nav .brand .mark {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--signal), var(--navy));
    display: inline-block;
}

.site-nav .nav-links {
    display: flex;
    align-items: center;
    gap: 22px;
    font-size: 0.92rem;
    font-weight: 500;
}

.site-nav .nav-links a { color: var(--muted); }
.site-nav .nav-links a:hover { color: var(--navy-deep); text-decoration: none; }
.site-nav .nav-links a.active { color: var(--signal); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--signal);
    color: var(--white);
}
.btn-primary:hover { background: var(--signal-hover); }

.btn-outline {
    background: var(--white);
    color: var(--navy);
    border-color: var(--line);
}
.btn-outline:hover { border-color: var(--signal); color: var(--signal); }

.btn-block { width: 100%; justify-content: center; }

/* ---------- Layout ---------- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

header.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

header.page-header h1 {
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
header.page-header h1 i { color: var(--signal); font-size: 1.2rem; }

.last-updated {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--muted);
}

/* Signature element: live pulse indicator */
.live-pulse {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--profit);
}
.live-pulse .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--profit);
    animation: pulse-dot 1.8s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(15, 157, 88, 0.35); }
    50% { opacity: 0.55; box-shadow: 0 0 0 5px rgba(15, 157, 88, 0); }
}

#refresh-btn, .refresh-btn {
    background: var(--white);
    color: var(--navy);
    border: 1px solid var(--line);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
#refresh-btn:hover, .refresh-btn:hover {
    border-color: var(--signal);
    color: var(--signal);
}

/* ---------- Tabs ---------- */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--line);
}

.tab-btn {
    padding: 10px 18px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: -1px;
}
.tab-btn:hover { color: var(--navy-deep); }
.tab-btn.active { color: var(--signal); border-bottom-color: var(--signal); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---------- Summary cards ---------- */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
}
.card h3 {
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 6px;
}
.card p {
    font-family: var(--font-mono);
    font-size: 1.7rem;
    font-weight: 600;
    color: var(--navy-deep);
}

/* ---------- Filters ---------- */
.filters, .controls {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 22px;
    background: var(--white);
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
}

.filter-group { flex: 1; min-width: 180px; }

.filter-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
}

.filter-group select,
.filter-group input {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.9rem;
    background: var(--white);
    color: var(--ink);
}
.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--signal);
    box-shadow: 0 0 0 3px rgba(30, 95, 255, 0.12);
}

/* ---------- Tables ---------- */
.table-container {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; }

th {
    text-align: left;
    padding: 12px 14px;
    background: var(--sky);
    color: var(--navy);
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

td {
    padding: 12px 14px;
    border-top: 1px solid var(--line);
    font-size: 0.88rem;
}

tbody tr:hover { background: var(--surface); }

.odds-value, td.odds-value {
    font-family: var(--font-mono);
    font-weight: 600;
    text-align: right;
}
.odds-high { color: var(--profit); }
.odds-medium { color: var(--amber); }
.odds-low { color: var(--alert); }

/* Profit indicators — arbitrage table (high >=5%, medium >=2%, low <2%) */
.profit-high { color: var(--profit); font-weight: 700; }
.profit-medium { color: var(--amber); font-weight: 700; }
.profit-low { color: var(--alert); font-weight: 700; }

/* ---------- Games list (odds dashboard) ---------- */
.games-list {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.game-item { border-bottom: 1px solid var(--line); }
.game-item:last-child { border-bottom: none; }

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    cursor: pointer;
    background: var(--white);
    transition: background-color 0.15s ease;
}
.game-header:hover { background: var(--surface); }

.game-title {
    font-weight: 600;
    font-size: 0.98rem;
    color: var(--navy-deep);
}

.game-sport {
    background: var(--sky);
    color: var(--signal);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.game-arrow { color: var(--muted); transition: transform 0.2s ease; }
.game-item.expanded .game-arrow { transform: rotate(180deg); color: var(--signal); }

.game-details {
    display: none;
    padding: 4px 18px 18px;
    background: var(--surface);
}
.game-item.expanded .game-details { display: block; }

.game-details h3 {
    font-size: 0.9rem;
    padding: 14px 0 8px;
    color: var(--navy);
}

.market-group {
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--white);
}

.market-header {
    background: var(--sky);
    padding: 10px 14px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--navy);
    display: flex;
    justify-content: space-between;
    cursor: pointer;
}

.market-content { display: none; }
.market-group.expanded .market-content { display: block; }

.bookmaker-odds th { background: var(--white); border-bottom: 1px solid var(--line); }
.bookmaker-odds tr:nth-child(even) { background: var(--surface); }

.no-data {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
    font-size: 0.9rem;
}

/* ---------- Bet Now buttons ---------- */
.btn-bet {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.76rem;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid var(--signal);
    color: var(--signal);
    background: var(--white);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.btn-bet:hover {
    background: var(--signal);
    color: var(--white);
    text-decoration: none;
}
.btn-bet i { font-size: 0.68rem; }
.btn-bet.disabled {
    border-color: var(--line);
    color: var(--muted);
    pointer-events: none;
    opacity: 0.6;
}
.bookie-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---------- Auth pages ---------- */
.auth-shell {
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-container {
    width: 100%;
    max-width: 380px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 36px 32px;
}

.auth-container h1 {
    font-size: 1.4rem;
    margin-bottom: 6px;
}
.auth-container > p {
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 24px;
}

.auth-container form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-container input {
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.92rem;
}
.auth-container input:focus {
    outline: none;
    border-color: var(--signal);
    box-shadow: 0 0 0 3px rgba(30, 95, 255, 0.12);
}

.auth-container button[type="submit"] {
    margin-top: 4px;
    background: var(--signal);
    color: var(--white);
    border: none;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
}
.auth-container button[type="submit"]:hover { background: var(--signal-hover); }

.auth-container #msg {
    min-height: 1.2em;
    font-size: 0.85rem;
    color: var(--alert);
    margin-top: 12px;
}

.auth-container p a { font-weight: 600; }
.auth-container > p:last-child {
    margin-top: 20px;
    margin-bottom: 0;
    color: var(--muted);
}

/* ---------- Pricing ---------- */
.pricing-shell { padding: 48px 20px; }

.pricing-card {
    max-width: 460px;
    margin: 0 auto;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 36px;
    text-align: center;
}

.pricing-card .price {
    font-family: var(--font-display);
    font-size: 2.6rem;
    font-weight: 700;
    color: var(--navy-deep);
    margin: 6px 0 4px;
}
.pricing-card .price span {
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--muted);
}

.pricing-card .tagline {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

#currency-prices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    margin: 20px 0;
    padding: 14px;
    background: var(--surface);
    border-radius: var(--radius-sm);
}
#currency-prices div {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--navy);
}

.pricing-card label {
    display: block;
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 18px;
    text-align: left;
}
.pricing-card select {
    margin-top: 6px;
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

.pricing-card h2 {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin: 22px 0 12px;
    text-align: left;
}

.pay-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#mpesa-form {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}
#mpesa-form input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
}

.pricing-card #msg {
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--muted);
    min-height: 1.2em;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .site-nav { padding: 14px 18px; }
    .site-nav .nav-links { gap: 14px; font-size: 0.85rem; }
    .container { padding: 22px 16px 48px; }
    .controls, .filters { flex-direction: column; }
    .game-header { flex-wrap: wrap; }
    table { font-size: 0.82rem; }
}
