/* =============================================================================
   SLEEK BLACK MINIMAL DESIGN SYSTEM
   ============================================================================= */

/* Color Palette */
:root {
    /* Backgrounds */
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-elevated: #1f1f1f;
    
    /* Borders */
    --border: #222222;
    --border-hover: #333333;
    
    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #666666;
    
    /* Accents */
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    /* Personality Colors */
    --conservative: #6366f1;
    --balanced: #8b5cf6;
    --aggressive: #ef4444;
    --gambler: #f59e0b;
    --me: #06b6d4;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    
    /* Transitions */
    --transition: 0.2s ease;
}

/* =============================================================================
   RESET & BASE
   ============================================================================= */

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

body, button, input, select, textarea {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* =============================================================================
   TYPOGRAPHY
   ============================================================================= */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
    margin-bottom: var(--spacing-md);
}

/* =============================================================================
   LAYOUT
   ============================================================================= */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =============================================================================
   CARDS
   ============================================================================= */

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    transition: all var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
}

.card-elevated {
    background: var(--bg-tertiary);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* =============================================================================
   BUTTONS
   ============================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

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

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

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #16a34a;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

/* Bot Personality Buttons */
.btn-conservative {
    background: var(--conservative);
    color: white;
}

.btn-balanced {
    background: var(--balanced);
    color: white;
}

.btn-aggressive {
    background: var(--aggressive);
    color: white;
}

.btn-gambler {
    background: var(--gambler);
    color: white;
}

.btn-me {
    background: var(--me);
    color: white;
}

/* =============================================================================
   INPUTS
   ============================================================================= */

.input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all var(--transition);
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-elevated);
}

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

/* =============================================================================
   LISTS
   ============================================================================= */

.list {
    list-style: none;
}

.list-item {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

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

.list-item:hover {
    background: var(--bg-tertiary);
}

/* =============================================================================
   BADGES
   ============================================================================= */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-success {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.badge-primary {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent);
}

/* =============================================================================
   GRID
   ============================================================================= */

.grid {
    display: grid;
    gap: var(--spacing-lg);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* =============================================================================
   FLEX UTILITIES
   ============================================================================= */

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* =============================================================================
   SPACING UTILITIES
   ============================================================================= */

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }
.p-xl { padding: var(--spacing-xl); }

/* =============================================================================
   TEXT UTILITIES
   ============================================================================= */

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.font-bold { font-weight: 600; }
.font-semibold { font-weight: 500; }

/* =============================================================================
   TOAST NOTIFICATIONS
   ============================================================================= */

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
    min-width: 300px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.toast-success {
    border-left: 3px solid var(--success);
}

.toast-error {
    border-left: 3px solid var(--danger);
}

.toast-info {
    border-left: 3px solid var(--accent);
}
.toast-invite {
    background: linear-gradient(135deg, #8957e5 0%, #a371f7 100%);
    border: 2px solid rgba(163, 113, 247, 0.5);
    color: #fff;
    animation: slideInRight 0.3s ease, tradeGlow 1.5s ease-in-out 2 alternate;
    font-size: 15px;
    padding: 14px 18px;
    max-width: 90vw;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    word-break: break-word;
}
.toast-invite .toast-action-btn {
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: background 0.2s;
    min-height: 36px;
    min-width: 64px;
    touch-action: manipulation;
}
.toast-invite .toast-action-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}
.toast-invite .toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    min-height: 36px;
    min-width: 36px;
    touch-action: manipulation;
}
.toast-invite .toast-close:hover {
    color: #fff;
}

@media (max-width: 480px) {
    .toast-invite {
        font-size: 13px;
        padding: 10px 12px;
        gap: 0.5rem;
    }
    .toast-invite .toast-action-btn {
        font-size: 0.78rem;
        padding: 5px 12px;
        min-height: 32px;
        min-width: 56px;
    }
}

@keyframes slideInRight {
    from { transform: translateX(400px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes tradeGlow {
    from { box-shadow: 0 8px 24px rgba(137, 87, 229, 0.3); }
    to { box-shadow: 0 8px 32px rgba(137, 87, 229, 0.6), 0 0 16px rgba(163, 113, 247, 0.3); }
}

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

/* =============================================================================
   SCROLLBAR
   ============================================================================= */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* =============================================================================
   ANIMATIONS
   ============================================================================= */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* PlayFab Badge & Friends */
.pf-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.pf-badge-connected {
    border-color: var(--success);
    color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}
.pf-badge-pending {
    border-color: var(--warning);
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.pf-friend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.pf-friend-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.pf-friend-online {
    background: var(--success);
}
.pf-friend-offline {
    background: var(--text-muted);
}
.pf-friend-ingame {
    background: #8957e5;
}
.pf-friend-name {
    flex: 1;
}
.pf-friend-item {
    cursor: pointer;
    transition: background 0.15s;
}
.pf-friend-item:hover {
    background: rgba(255,255,255,0.05);
}
.pf-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.4rem 0.5rem 0.2rem;
}
.pf-spectate-btn {
    background: rgba(137, 87, 229, 0.2) !important;
    color: #8957e5 !important;
    border: 1px solid #8957e5;
}
.pf-spectate-btn:hover {
    background: rgba(137, 87, 229, 0.4) !important;
}
.pf-request-item {
    cursor: default;
}
.ll-request-item:hover {
    background: transparent;
}
.ll-search-result {
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
}
.ll-search-result:hover {
    background: rgba(255,255,255,0.08);
}

/* Player Popup / Modal */
.player-popup-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    animation: fadeIn 0.15s ease;
}
.player-popup {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 320px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    overflow: hidden;
}
.popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem 0.5rem;
    border-bottom: 1px solid var(--border);
}
.popup-title {
    font-size: 1rem;
    font-weight: 600;
}
.popup-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.popup-close:hover {
    color: var(--text-primary);
}
.popup-body {
    padding: 0.75rem 1rem;
}
.popup-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
    word-break: break-all;
}
.popup-detail code {
    font-size: 0.7rem;
    background: var(--bg-tertiary);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}
.popup-actions {
    padding: 0.5rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.popup-action {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}
.popup-action:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
.popup-action-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
}
.popup-action.disabled {
    opacity: 0.5;
    cursor: default;
}
.popup-action.disabled:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* EOS Badge & Friends */
.eos-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.eos-badge-connected {
    border-color: var(--success);
    color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}
.eos-badge-pending {
    border-color: var(--warning);
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.eos-friend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.eos-friend-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.eos-friend-online,
.eos-friend-friend {
    background: var(--success);
}
.eos-friend-away,
.eos-friend-invite_sent {
    background: var(--warning);
}
.eos-friend-offline,
.eos-friend-other {
    background: var(--text-muted);
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.15s ease;
}
.login-modal {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 380px;
    max-width: 90vw;
    padding: 2rem;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}
.login-header h2 {
    font-size: 1.5rem;
    margin: 0 0 0.25rem;
}
.login-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.25rem;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.login-tab {
    flex: 1;
    padding: 0.5rem;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
}
.login-tab.active {
    background: var(--accent);
    color: white;
}
.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.login-field label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}
.login-field .input {
    width: 100%;
    box-sizing: border-box;
}
.login-error {
    font-size: 0.8rem;
    color: var(--danger);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.2);
}
.login-skip {
    display: block;
    width: 100%;
    margin-top: 1rem;
    padding: 0.5rem;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    text-align: center;
}
.login-skip:hover {
    color: var(--text-secondary);
}

/* Social Overlay */
.social-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.15s ease;
}
.social-modal {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 420px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
    overflow: hidden;
}
.social-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.social-header h3 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.social-refresh-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.1rem 0.4rem;
    line-height: 1;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}
.social-refresh-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.social-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.social-close:hover {
    color: var(--text-primary);
}
.social-search {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.social-search .input {
    width: 100%;
    box-sizing: border-box;
    font-size: 0.85rem;
}
.social-search-result {
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
}
.social-search-result:hover {
    background: rgba(255,255,255,0.08);
}
.social-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
}
.social-tab {
    flex: 1;
    padding: 0.6rem;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}
.social-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.social-tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
    min-height: 150px;
    max-height: 300px;
}
.social-friend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s;
}
.social-friend-item:hover {
    background: rgba(255,255,255,0.05);
}
.social-friend-name {
    flex: 1;
}
.social-friend-status-text {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.social-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1.25rem 0.3rem;
}
.social-request-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1.25rem;
    font-size: 0.85rem;
}
.social-request-actions {
    display: flex;
    gap: 0.3rem;
    margin-left: auto;
}
