@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --bg-base: #0a0518;
    --bg-surface: rgba(22, 15, 45, 0.7);
    --bg-surface-opaque: #160f2d;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(138, 75, 235, 0.3);
    
    --text-primary: #ffffff;
    --text-secondary: #b3aed2;
    --text-muted: #6e6a8a;
    
    --accent-primary: #8a4beb;
    --accent-primary-glow: rgba(138, 75, 235, 0.4);
    --accent-success: #00ff87;
    --accent-success-glow: rgba(0, 255, 135, 0.3);
    --accent-warning: #ffb703;
    --accent-error: #ff4a5a;
    --accent-blue: #00b4d8;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="light"] {
    --bg-base: #f4f5f9;
    --bg-surface: rgba(255, 255, 255, 0.8);
    --bg-surface-opaque: #ffffff;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(138, 75, 235, 0.4);
    
    --text-primary: #120d26;
    --text-secondary: #5a547a;
    --text-muted: #8e89ad;
    
    --accent-primary: #7c3aed;
    --accent-primary-glow: rgba(124, 58, 237, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(138, 75, 235, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 255, 135, 0.08) 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="light"] body {
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(138, 75, 235, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 255, 135, 0.04) 0%, transparent 40%);
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 480px;
    background: rgba(10, 5, 24, 0.5);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    padding-bottom: calc(75px + var(--safe-area-bottom));
}

@media(min-width: 481px) {
    .app-container {
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    }
}

/* Header Styles */
.app-header {
    background: rgba(22, 15, 45, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.app-logo {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wallet-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.wallet-badge:hover {
    border-color: var(--accent-primary);
    background: rgba(138, 75, 235, 0.1);
}

.wallet-badge i {
    color: var(--accent-warning);
}

/* Tab Screens Management */
.tab-screen {
    display: none;
    padding: 20px;
    animation: fadeIn 0.4s ease;
}

.tab-screen.active {
    display: block;
}

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

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: rgba(15, 8, 32, 0.9);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 8px 10px calc(8px + var(--safe-area-bottom));
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    gap: 5px;
    cursor: pointer;
    flex: 1;
    transition: var(--transition-smooth);
    position: relative;
    padding: 6px 0;
}

.nav-item i {
    font-size: 1.25rem;
    transition: var(--transition-smooth);
}

.nav-item.active {
    color: var(--accent-primary);
}

.nav-item.active i {
    transform: translateY(-2px);
    text-shadow: 0 0 10px var(--accent-primary-glow);
}

/* Live Dot Pulse */
.live-indicator-dot {
    position: absolute;
    top: 6px;
    right: 30%;
    width: 7px;
    height: 7px;
    background-color: var(--accent-success);
    border-radius: 50%;
    display: none;
}

.live-indicator-dot.visible {
    display: block;
    box-shadow: 0 0 0 0 var(--accent-success-glow);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 var(--accent-success-glow);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(0, 255, 135, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 255, 135, 0);
    }
}

/* Typography & Headers */
h2 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: -15px;
    margin-bottom: 20px;
}

/* Glass Cards & Elements */
.glass-card {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 16px;
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 10px 30px rgba(138, 75, 235, 0.05);
}

/* Form Styles */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    padding: 16px 20px;
    border-radius: 16px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    transition: var(--transition-smooth);
}

.form-control:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(138, 75, 235, 0.2);
    background: rgba(0, 0, 0, 0.6);
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 16px 24px;
    border-radius: 30px;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: var(--font-heading);
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition-smooth);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #a26bfc 100%);
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(138, 75, 235, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(138, 75, 235, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Verification Code Blocks */
.otp-container {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin: 20px 0;
}

.otp-input {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    color: var(--accent-success);
    border-radius: 8px;
    outline: none;
    transition: var(--transition-smooth);
}

.otp-input:focus {
    border-color: var(--accent-success);
    box-shadow: 0 0 10px var(--accent-success-glow);
}

/* Authentication Container Panels */
.auth-panel {
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    animation: fadeIn 0.4s ease;
}

.auth-header {
    text-align: center;
    margin-bottom: 40px;
}

.auth-header img, .auth-header .logo-icon {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
    border-radius: 20px;
}

.auth-header h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-top: 10px;
}

.auth-switch-text {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-switch-text span {
    color: var(--accent-primary);
    cursor: pointer;
    font-weight: 600;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    z-index: 1000;
}

.toast {
    background: rgba(22, 15, 45, 0.95);
    border-left: 4px solid var(--accent-primary);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    animation: slideDown 0.3s ease;
}

.toast.success { border-left-color: var(--accent-success); }
.toast.error { border-left-color: var(--accent-error); }
.toast.info { border-left-color: var(--accent-blue); }

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Dev OTP Overlay Widget */
.dev-otp-widget {
    background: #000;
    border: 2px solid var(--accent-success);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 255, 135, 0.2);
}

.dev-otp-widget code {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent-success);
    letter-spacing: 4px;
    display: block;
    margin: 8px 0;
}

/* Polls UI */
.poll-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.poll-status-tag {
    background: rgba(0, 255, 135, 0.1);
    color: var(--accent-success);
    border: 1px solid rgba(0, 255, 135, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.75rem;
}

.poll-status-tag.ended {
    background: rgba(255, 74, 90, 0.1);
    color: var(--accent-error);
    border-color: rgba(255, 74, 90, 0.2);
}

.contestant-row {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.contestant-row:hover {
    border-color: var(--accent-primary);
    background: rgba(138, 75, 235, 0.05);
}

.contestant-row.selected {
    border-color: var(--accent-success);
    background: rgba(0, 255, 135, 0.03);
}

.contestant-info {
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 2;
}

.contestant-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-family: var(--font-heading);
    color: #fff;
    border: 2px solid var(--border-color);
}

.contestant-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.contestant-percentage {
    font-weight: 700;
    font-size: 0.95rem;
    z-index: 2;
}

.contestant-progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: rgba(138, 75, 235, 0.15);
    z-index: 1;
    transition: width 0.8s cubic-bezier(0.1, 0.8, 0.3, 1);
}

.contestant-row.selected .contestant-progress-bar {
    background: rgba(0, 255, 135, 0.1);
}

/* Verification Badge */
.verified-badge {
    color: var(--accent-blue) !important;
    font-size: 0.9rem;
    margin-left: 4px;
}

/* Chat UI */
.chat-messages-container {
    height: 400px;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 12px;
}

.chat-bubble {
    display: flex;
    gap: 10px;
    max-width: 85%;
    align-self: flex-start;
}

.chat-bubble.self {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.chat-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: 14px;
    border-top-left-radius: 0;
    font-size: 0.9rem;
    line-height: 1.4;
    position: relative;
}

.chat-bubble.self .chat-content {
    background: var(--accent-primary);
    border-color: rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    border-top-right-radius: 0;
}

.chat-sender {
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 3px;
    gap: 4px;
}

.chat-bubble.self .chat-sender {
    color: rgba(255, 255, 255, 0.8);
}

.chat-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    align-self: flex-end;
    margin-top: 4px;
    display: block;
    text-align: right;
}

.chat-bubble.self .chat-time {
    color: rgba(255, 255, 255, 0.6);
}

.chat-input-row {
    display: flex;
    gap: 8px;
}

.chat-input-row .form-control {
    flex: 1;
}

.chat-input-row .btn {
    width: auto;
    padding: 0 16px;
}

.chat-limit-notice {
    font-size: 0.8rem;
    color: var(--accent-warning);
    text-align: center;
    margin-top: 8px;
}

/* Tournaments UI */
.tournament-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin: 15px 0;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.league-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.league-table th, .league-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
}

.league-table th {
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-secondary);
    font-weight: 600;
}

.league-table tr:last-child td {
    border-bottom: none;
}

.league-table td.team-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.league-table td.pts-cell {
    font-weight: 700;
    color: var(--accent-success);
}

/* Fixture Row */
.fixture-row {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
}

.fixture-row:hover {
    border-color: var(--accent-primary);
}

.fixture-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.fixture-status {
    font-weight: 700;
    color: var(--accent-primary);
}

.fixture-status.live {
    color: var(--accent-success);
    display: flex;
    align-items: center;
    gap: 4px;
}

.fixture-status.live::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--accent-success);
    border-radius: 50%;
    animation: pulse 1.2s infinite;
}

.fixture-teams-score {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
}

.team-score-item {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.team-score-item.away {
    justify-content: flex-end;
}

.score-display {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 800;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 10px;
    border-radius: 6px;
}

.fixture-venue {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* Instagram Bio Style Profile */
.profile-card {
    text-align: center;
    position: relative;
    padding-top: 30px;
}

.profile-avatar-container {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 16px;
    position: relative;
    border: 3px solid var(--accent-primary);
    box-shadow: 0 0 20px var(--accent-primary-glow);
    background: var(--bg-surface-opaque);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar-container img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.profile-avatar-container .avatar-fallback {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--text-secondary);
}

.profile-verification-checkbox {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--bg-base);
    border: 2px solid var(--accent-primary);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-name {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.profile-username {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.profile-bio {
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text-secondary);
    margin: 15px 0;
    padding: 0 10px;
    text-align: left;
}

.profile-stats-row {
    display: flex;
    justify-content: space-around;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
    margin: 15px 0;
}

.profile-stat-box {
    display: flex;
    flex-direction: column;
}

.profile-stat-val {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

/* Modal center overlays */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-surface-opaque);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    animation: scaleUp 0.3s ease;
}

@keyframes scaleUp {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Fund Tab payment options */
.payment-option-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-smooth);
}

.payment-option-card:hover {
    border-color: var(--accent-primary);
}

.payment-option-card.selected {
    border-color: var(--accent-success);
    background: rgba(0, 255, 135, 0.05);
}

.payment-option-details {
    display: flex;
    flex-direction: column;
}

.payment-option-title {
    font-weight: 700;
    font-size: 1rem;
}

.payment-option-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.payment-option-price {
    font-family: var(--font-heading);
    font-weight: 800;
    color: var(--accent-success);
}
