/**
 * Survivor.market - Main Stylesheet
 */

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors */
    --bg-dark: #0a0a0f;
    --bg-card: #12121a;
    --bg-elevated: #1a1a24;
    --green: #00ff88;
    --green-dim: rgba(0, 255, 136, 0.15);
    --red: #ff3366;
    --red-dim: rgba(255, 51, 102, 0.15);
    --gold: #ffd700;
    --gold-dim: rgba(255, 215, 0, 0.15);
    --blue: #00d4ff;
    --blue-dim: rgba(0, 212, 255, 0.15);
    --purple: #a855f7;
    --purple-dim: rgba(168, 85, 247, 0.15);
    --text-primary: #ffffff;
    --text-secondary: #8a8a9a;
    --text-muted: #5a5a6a;
    --border: rgba(255,255,255,0.08);
    --border-hover: rgba(255,255,255,0.15);
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    
    /* Typography */
    --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    
    /* Radius */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Grid Background */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(0,255,136,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,255,136,0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

/* Navigation */
.nav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: var(--space-md) var(--space-xl);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--green), var(--blue));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-text span {
    color: var(--green);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 15px;
    transition: color 0.2s;
}

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

.nav-link.active {
    color: var(--green);
}

.user-pill {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: var(--radius-full);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--green), var(--blue));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #000;
}

.user-streak {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--gold);
}

.user-credits {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--green);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 17px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--green), #00cc6a);
    color: #000;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,255,136,0.3);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--text-secondary);
    background: var(--bg-elevated);
}

.btn-danger {
    background: linear-gradient(135deg, var(--red), #cc2952);
    color: #fff;
}

/* Forms */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.form-input {
    width: 100%;
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-size: 16px;
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--green);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-error {
    color: var(--red);
    font-size: 14px;
    margin-top: var(--space-sm);
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
}

/* Stock Cards */
.stock-card {
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.stock-card:hover {
    border-color: var(--green);
    transform: translateY(-2px);
}

.stock-card.selected {
    border-color: var(--green);
    background: var(--green-dim);
}

.stock-card.used {
    opacity: 0.4;
    pointer-events: none;
}

.stock-symbol {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
}

.stock-name {
    font-size: 13px;
    color: var(--text-muted);
}

.stock-price {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 600;
}

.stock-change {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
}

.stock-change.up {
    background: var(--green-dim);
    color: var(--green);
}

.stock-change.down {
    background: var(--red-dim);
    color: var(--red);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.badge-green {
    background: var(--green-dim);
    color: var(--green);
}

.badge-red {
    background: var(--red-dim);
    color: var(--red);
}

.badge-gold {
    background: var(--gold-dim);
    color: var(--gold);
}

.badge-blue {
    background: var(--blue-dim);
    color: var(--blue);
}

/* Streak Display */
.streak-box {
    text-align: center;
    padding: var(--space-lg);
    background: linear-gradient(135deg, var(--gold-dim), transparent);
    border-radius: var(--radius);
}

.streak-number {
    font-family: var(--font-mono);
    font-size: 4rem;
    font-weight: 700;
    color: var(--gold);
    line-height: 1;
}

.streak-label {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: var(--space-sm);
}

/* Timer */
.timer {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--red-dim);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--red);
}

.timer-dot {
    width: 8px;
    height: 8px;
    background: var(--red);
    border-radius: 50%;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Leaderboard */
.leaderboard-row {
    display: flex;
    align-items: center;
    padding: var(--space-md);
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.leaderboard-row:hover {
    background: var(--bg-elevated);
}

.leaderboard-row:last-child {
    border-bottom: none;
}

.leaderboard-rank {
    width: 40px;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.1rem;
}

.leaderboard-rank.gold { color: #ffd700; }
.leaderboard-rank.silver { color: #c0c0c0; }
.leaderboard-rank.bronze { color: #cd7f32; }

.leaderboard-user {
    flex: 1;
    margin-left: var(--space-sm);
}

.leaderboard-name {
    font-weight: 600;
}

.leaderboard-pick {
    font-size: 12px;
    color: var(--text-muted);
}

.leaderboard-streak {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--green);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

.toast.success { border-left: 4px solid var(--green); }
.toast.error { border-left: 4px solid var(--red); }
.toast.warning { border-left: 4px solid var(--gold); }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    max-width: 480px;
    width: 90%;
    transform: scale(0.9);
    transition: transform 0.25s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-gold { color: var(--gold); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        gap: var(--space-md);
    }
    
    .nav-links .nav-link {
        display: none;
    }
    
    .hide-mobile {
        display: none !important;
    }
}
