/* ============================================
   MoneyWise Game Theme - Global Styles
   ============================================ */

/* CSS Custom Properties (Design Tokens) */
:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    --bg-card-hover: #123d6e;
    --accent-green: #00e676;
    --accent-red: #ff1744;
    --accent-gold: #ffd700;
    --accent-blue: #00b0ff;
    --text-primary: #e8e8e8;
    --text-muted: #8899aa;
    --border-card: rgba(255, 255, 255, 0.08);
    --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.4);
    --radius-card: 12px;
    --radius-btn: 12px;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

    /* Tier colors */
    --tier-bronze: #cd7f32;
    --tier-silver: #c0c0c0;
    --tier-gold: #ffd700;
    --tier-platinum: #e5e4e2;
    --tier-diamond: #b9f2ff;
}

/* ============================================
   Base
   ============================================ */
html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html { font-size: 16px; }
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    margin: 0;
}

a { color: var(--accent-blue); }
a:hover { color: #40c4ff; }

::selection {
    background: var(--accent-blue);
    color: #fff;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Money display - always monospace */
.money {
    font-family: var(--font-mono);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.money-positive {
    color: var(--accent-green);
}

.money-negative {
    color: var(--accent-red);
}

.money-gold {
    color: var(--accent-gold);
}

/* ============================================
   Cards
   ============================================ */
.card, .game-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    color: var(--text-primary);
    transition: border-color 0.2s, transform 0.15s;
}

.card:hover, .game-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.card-header {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border-bottom: 1px solid var(--border-card);
    color: var(--text-primary);
}

.card-body {
    color: var(--text-primary);
}

/* Stat card (financial summary) */
.stat-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-card);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow-card);
}

.stat-card .stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-card .stat-value {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-card.stat-income { border-top: 3px solid var(--accent-green); }
.stat-card.stat-expense { border-top: 3px solid var(--accent-red); }
.stat-card.stat-balance { border-top: 3px solid var(--accent-gold); }
.stat-card.stat-info { border-top: 3px solid var(--accent-blue); }

/* ============================================
   Buttons
   ============================================ */
.btn {
    border-radius: var(--radius-btn);
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border: none;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.96);
}

/* Primary - Green gradient */
.btn-game-primary, .btn-success {
    background: linear-gradient(135deg, #00c853, #00e676);
    color: #0a0a1a;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 230, 118, 0.3);
}

.btn-game-primary:hover, .btn-success:hover {
    background: linear-gradient(135deg, #00e676, #69f0ae);
    color: #0a0a1a;
    box-shadow: 0 4px 16px rgba(0, 230, 118, 0.4);
    transform: translateY(-1px);
}

/* Danger - Red gradient */
.btn-game-danger, .btn-danger {
    background: linear-gradient(135deg, #d50000, #ff1744);
    color: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(255, 23, 68, 0.3);
}

.btn-game-danger:hover, .btn-danger:hover {
    background: linear-gradient(135deg, #ff1744, #ff5252);
    box-shadow: 0 4px 16px rgba(255, 23, 68, 0.4);
    transform: translateY(-1px);
}

/* Gold / Warning */
.btn-game-gold, .btn-warning {
    background: linear-gradient(135deg, #f9a825, #ffd700);
    color: #0a0a1a;
    border: none;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.btn-game-gold:hover, .btn-warning:hover {
    background: linear-gradient(135deg, #ffd700, #ffeb3b);
    color: #0a0a1a;
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.4);
    transform: translateY(-1px);
}

/* Blue / Info */
.btn-game-blue, .btn-primary {
    background: linear-gradient(135deg, #0091ea, #00b0ff);
    color: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 176, 255, 0.3);
}

.btn-game-blue:hover, .btn-primary:hover {
    background: linear-gradient(135deg, #00b0ff, #40c4ff);
    box-shadow: 0 4px 16px rgba(0, 176, 255, 0.4);
    transform: translateY(-1px);
}

/* Outline variants */
.btn-outline-primary {
    background: transparent;
    color: var(--accent-blue);
    border: 1px solid var(--accent-blue);
}
.btn-outline-primary:hover {
    background: rgba(0, 176, 255, 0.15);
    color: #40c4ff;
    border-color: #40c4ff;
}

.btn-outline-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.btn-outline-danger {
    background: transparent;
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}
.btn-outline-danger:hover {
    background: rgba(255, 23, 68, 0.15);
    color: #ff5252;
}

/* Disabled */
.btn:disabled, .btn.disabled {
    opacity: 0.4;
    pointer-events: none;
    transform: none !important;
}

/* Large End Month button */
.btn-end-month {
    background: linear-gradient(135deg, #f9a825, #ffd700);
    color: #0a0a1a;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.75rem 3rem;
    border-radius: var(--radius-btn);
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.35);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-end-month:hover {
    background: linear-gradient(135deg, #ffd700, #ffeb3b);
    box-shadow: 0 6px 28px rgba(255, 215, 0, 0.5);
    transform: translateY(-2px);
}

.btn-end-month:disabled {
    background: linear-gradient(135deg, #555, #666);
    color: #999;
    box-shadow: none;
}

/* ============================================
   Navbar
   ============================================ */
.navbar {
    background-color: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border-card);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: -0.02em;
}

.navbar-brand .brand-icon {
    color: var(--accent-gold);
    font-size: 1.4rem;
}

/* ============================================
   Forms
   ============================================ */
.form-control, .form-select {
    background-color: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-btn);
    color: var(--text-primary);
    padding: 0.6rem 1rem;
}

.form-control:focus, .form-select:focus {
    background-color: var(--bg-secondary);
    border-color: var(--accent-blue);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(0, 176, 255, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-label {
    color: var(--text-primary);
    font-weight: 600;
}

.form-text {
    color: var(--text-muted);
}

.form-range::-webkit-slider-track {
    background: var(--bg-card);
}

.form-range::-webkit-slider-thumb {
    background: var(--accent-blue);
}

/* ============================================
   Badges
   ============================================ */
.badge {
    font-weight: 600;
    border-radius: 6px;
    padding: 0.3em 0.65em;
}

.badge.bg-light {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

/* ============================================
   Alerts
   ============================================ */
.alert {
    background-color: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-card);
    color: var(--text-primary);
}

.alert-info {
    background-color: rgba(0, 176, 255, 0.1);
    border-color: rgba(0, 176, 255, 0.25);
    color: #80d8ff;
}

.alert-success {
    background-color: rgba(0, 230, 118, 0.1);
    border-color: rgba(0, 230, 118, 0.25);
    color: #69f0ae;
}

.alert-warning {
    background-color: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.25);
    color: #ffd740;
}

.alert-danger {
    background-color: rgba(255, 23, 68, 0.1);
    border-color: rgba(255, 23, 68, 0.25);
    color: #ff5252;
}

/* ============================================
   Modals
   ============================================ */
.modal-content {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-card);
    color: var(--text-primary);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.modal-header {
    border-bottom: 1px solid var(--border-card);
}

.modal-footer {
    border-top: 1px solid var(--border-card);
}

.btn-close {
    filter: invert(1);
}

/* ============================================
   Tables
   ============================================ */
.table {
    color: var(--text-primary);
}

.table > :not(caption) > * > * {
    background-color: transparent;
    border-bottom-color: var(--border-card);
    color: var(--text-primary);
}

.table-hover > tbody > tr:hover > * {
    background-color: rgba(255, 255, 255, 0.03);
}

.table-success { background-color: rgba(0, 230, 118, 0.12) !important; }
.table-danger { background-color: rgba(255, 23, 68, 0.12) !important; }

/* ============================================
   Scrollbar
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #1a4a7a;
}

/* ============================================
   Backgrounds for sections
   ============================================ */
.bg-dark {
    background-color: var(--bg-secondary) !important;
}

.bg-light {
    background-color: var(--bg-card) !important;
}

/* ============================================
   Utilities
   ============================================ */
.text-game-green { color: var(--accent-green) !important; }
.text-game-red { color: var(--accent-red) !important; }
.text-game-gold { color: var(--accent-gold) !important; }
.text-game-blue { color: var(--accent-blue) !important; }

.border-game-green { border-color: var(--accent-green) !important; }
.border-game-red { border-color: var(--accent-red) !important; }
.border-game-gold { border-color: var(--accent-gold) !important; }
.border-game-blue { border-color: var(--accent-blue) !important; }

/* Icon inline with text */
.icon-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
