/* ===================================================
   Sprudls Custom Theme — loaded after Bootstrap 5.3
   =================================================== */

/* --- Design Tokens (CSS Custom Properties) --- */
:root,
[data-bs-theme="dark"] {
    /* Site palette */
    --bg-primary: #0f0e17;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --accent-primary: #1a56db;
    --accent-secondary: #2e86de;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #808090;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --border-subtle: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(26, 86, 183, 0.5);

    /* Bootstrap variable overrides */
    --bs-body-bg: #0f0e17;
    --bs-body-color: #ffffff;
    --bs-secondary-bg: #1a1a2e;
    --bs-tertiary-bg: #16213e;
    --bs-card-bg: #1a1a2e;
    --bs-border-color: rgba(255, 255, 255, 0.1);
    --bs-link-color: #2e86de;
    --bs-link-hover-color: #4a9ee8;
}

/* --- Body --- */
body {
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1a1a2e 100%);
    min-height: 100vh;
}

/* --- Navbar overrides --- */
.navbar {
    background: rgba(15, 14, 23, 0.95) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-subtle);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.navbar-brand .brand-accent {
    color: var(--accent-secondary);
}

.nav-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.navbar .nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: all 0.2s;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
    color: var(--text-primary) !important;
    background: rgba(255, 255, 255, 0.05);
}

/* --- Buttons --- */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
    box-shadow: 0 5px 20px rgba(26, 86, 183, 0.4);
}

.btn-outline-secondary {
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--text-primary);
}

.btn-danger {
    background: rgba(220, 53, 69, 0.2);
    color: #f87171;
    border: none;
}

.btn-danger:hover {
    background: rgba(220, 53, 69, 0.4);
    color: #f87171;
}

/* --- Cards --- */
.card {
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-tertiary));
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
}

.card-body h2 {
    font-size: 1.25rem;
}

/* --- Game Cards (homepage, select_game) --- */
.game-card {
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-tertiary));
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid var(--border-subtle);
    position: relative;
    overflow: hidden;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    opacity: 0;
    transition: opacity 0.3s;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-color: var(--border-accent);
}

.game-card:hover::before {
    opacity: 1;
}

/* --- Forms --- */
.form-control,
.form-select {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 0.75rem 1rem;
}

.form-control:focus,
.form-select:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(26, 86, 219, 0.7);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
    color: var(--text-primary);
}

.form-control::placeholder {
    color: #606070;
}

.form-label {
    color: #c0c0d0;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

/* --- Auth pages (centered card layout) --- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* --- Notification dropdown --- */
.notification-bell {
    position: relative;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.25rem;
    background: none;
    border: none;
    color: var(--text-primary);
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #dc3545;
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    font-weight: bold;
    display: none;
}

.notification-badge.has-notifications {
    display: block;
}

.notifications-dropdown {
    width: 300px;
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: 12px !important;
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item.friend-request {
    background: rgba(26, 86, 183, 0.1);
}

.notification-item.game-invite {
    background: rgba(40, 167, 69, 0.1);
}

.notification-title {
    font-weight: 600;
    color: var(--text-primary);
}

.notification-actions {
    display: flex;
    gap: 0.5rem;
}

/* --- Verification warning --- */
.verification-warning {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 193, 7, 0.05));
    border: 1px solid rgba(255, 193, 7, 0.4);
    border-radius: 12px;
}

.btn-verify {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #000;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: box-shadow 0.2s;
    white-space: nowrap;
}

.btn-verify:hover {
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
    color: #000;
}

/* --- User avatar --- */
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    flex-shrink: 0;
}

.user-avatar-lg {
    width: 80px;
    height: 80px;
    font-size: 2rem;
}

.user-avatar-md {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
}

.user-avatar-sm {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
}

/* --- Tables --- */
.table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: rgba(255, 255, 255, 0.03);
}

/* --- Stat boxes --- */
.stat-box {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-secondary);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Status dots --- */
.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    display: inline-block;
}

.offline-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    display: inline-block;
}

/* --- Rank badges (leaderboard) --- */
.rank-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
}

.rank-badge.gold {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #000;
}

.rank-badge.silver {
    background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
    color: #000;
}

.rank-badge.bronze {
    background: linear-gradient(135deg, #cd7f32, #8b4513);
    color: #fff;
}

/* --- Feature cards --- */
.feature-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s;
}

.feature-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-accent);
}

/* --- Section cards --- */
.section-card {
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-tertiary));
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid var(--border-subtle);
}

/* --- How it works --- */
.how-it-works {
    background: linear-gradient(145deg, var(--bg-secondary), #0d0d15);
    border-radius: 16px;
    padding: 2.5rem;
    border: 1px solid var(--border-subtle);
}

.step-number {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 auto 1rem;
}

/* --- Quick Play section --- */
.quick-play {
    background: linear-gradient(135deg, rgba(26, 86, 183, 0.15), rgba(46, 134, 222, 0.1));
    border-radius: 20px;
    padding: 2.5rem;
    text-align: center;
    border: 1px solid rgba(26, 86, 183, 0.3);
    position: relative;
    overflow: hidden;
}

.quick-play::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(46, 134, 222, 0.1) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

.quick-play-content {
    position: relative;
    z-index: 1;
}

/* --- Match option cards (select_game) --- */
.match-option-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s;
}

.match-option-card:hover {
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.08);
}

/* --- Friend items --- */
.friend-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    transition: background 0.2s;
}

.friend-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* --- Footer --- */
.site-footer {
    background: rgba(15, 14, 23, 0.8);
    border-top: 1px solid var(--border-subtle);
}

.site-footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.site-footer a:hover {
    color: var(--text-primary);
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.3; }
}

/* --- Badges --- */
.badge-ai {
    background: rgba(26, 86, 183, 0.2) !important;
    color: var(--accent-secondary) !important;
}

.badge-multiplayer {
    background: rgba(40, 167, 69, 0.2) !important;
    color: var(--success) !important;
}

/* --- How to play info panel (select_game) --- */
.game-info-panel {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-subtle);
}

.how-to-play {
    background: rgba(26, 86, 183, 0.1);
    border: 1px solid rgba(26, 86, 183, 0.3);
    border-radius: 12px;
    padding: 1.25rem;
    margin-top: 1rem;
}

.how-to-play h4 {
    font-size: 0.9rem;
    color: var(--accent-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Logo showcase (about) --- */
.logo-showcase {
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
}

/* --- Back link --- */
.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--text-primary);
}

/* --- Contact items (about) --- */
.contact-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}
