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

:root {
    /* Color Palette - Deep Dark Mode with Neon Accents */
    --bg-base: #08090d;
    --bg-elevated: #11131c;
    --bg-glass: rgba(18, 20, 28, 0.7);
    --border-glass: rgba(255, 255, 255, 0.08);
    
    --text-main: #ffffff;
    --text-muted: #888888;
    
    /* Neon Accents */
    --accent-blue: #0070f3;
    --accent-blue-glow: rgba(0, 112, 243, 0.3);
    --accent-red: #ff003c;
    --accent-red-glow: rgba(255, 0, 60, 0.3);
    --accent-green: #00df89;
    --accent-green-glow: rgba(0, 223, 137, 0.3);
    --accent-orange: #ff9000;
    
    --radius-sm: 12px;
    --radius-md: 24px;
    --radius-lg: 32px;
    --radius-pill: 9999px;
    
    --transition-bounce: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --transition-smooth: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(0, 112, 243, 0.05), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(0, 223, 137, 0.05), transparent 25%);
    background-attachment: fixed;
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: var(--radius-pill);
}

/* ================== FLOATING DOCK ================== */
.floating-dock {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    padding: 0.5rem 0.8rem;
    gap: 0.5rem;
    z-index: 1000;
    box-shadow: 0 20px 40px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.1);
}

.dock-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-bounce);
    position: relative;
    text-decoration: none;
}

.dock-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-5px) scale(1.1);
}

.dock-item.active {
    color: var(--text-main);
    background: var(--bg-elevated);
    box-shadow: 0 8px 16px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05);
}

.dock-item.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    width: 4px;
    height: 4px;
    background: var(--text-main);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--text-main);
}

.dock-item span {
    position: absolute;
    top: -40px;
    background: var(--bg-elevated);
    color: var(--text-main);
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-glass);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition-smooth);
    white-space: nowrap;
    font-weight: 600;
}

.dock-item:hover span {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dock-divider {
    width: 1px;
    height: 30px;
    background: var(--border-glass);
    margin: 0 0.5rem;
}

.text-red {
    color: var(--accent-red) !important;
}

.dock-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background: var(--accent-red);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-base);
}

/* ================== MAIN LAYOUT ================== */
.main-wrapper {
    flex: 1;
    padding: 2rem 2rem 8rem 2rem; /* Bottom padding for dock */
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    position: relative;
}

/* ================== PAGES & SHEETS ================== */
.page {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}
.page.active {
    display: block;
}

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

/* Base styling for sheets (sub-pages) */
.bento-sheet {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
    padding: 3rem;
    min-height: calc(100vh - 12rem);
    position: relative;
    overflow: hidden;
}

.sheet-header {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-glass);
}

.sheet-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-volver {
    align-self: flex-start;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-smooth);
}
.btn-volver:hover {
    background: rgba(255,255,255,0.1);
    transform: translateX(-5px);
}

.sheet-title h1 {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
}

.sheet-title .text-gradient {
    background: linear-gradient(to right, #fff, #555);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-sub {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 500;
}

/* Hide old .page-headers that are left over from partial replacement */
.page-header {
    display: none !important;
}

/* ================== BENTO DASHBOARD ================== */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(200px, auto);
    gap: 1.5rem;
    width: 100%;
}

.bento-card {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 2rem;
    transition: transform var(--transition-smooth), border-color var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.bento-card:hover {
    border-color: rgba(255,255,255,0.2);
    transform: translateY(-5px);
}

/* 1. Profile Widget (Large) */
.bento-profile {
    grid-column: span 2;
    grid-row: span 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.profile-avatar-wrap {
    position: relative;
    width: 100px;
    height: 100px;
}

.profile-avatar-wrap img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--bg-elevated);
}

.status-indicator {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 18px;
    height: 18px;
    background: var(--accent-green);
    border-radius: 50%;
    border: 3px solid var(--bg-base);
}

.profile-info {
    flex: 1;
}

.profile-greeting {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
}

.profile-info h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0.2rem 0 0.8rem 0;
    letter-spacing: -0.5px;
}

.profile-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag {
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.tag.verified { background: rgba(0,223,137,0.1); color: var(--accent-green); border: 1px solid rgba(0,223,137,0.2); }
.tag.discord { background: rgba(88,101,242,0.1); color: #5865F2; border: 1px solid rgba(88,101,242,0.2); }

.profile-stats {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.roblox-integration, .rut-box {
    flex: 1;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.rbx-icon {
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rbx-icon img {
    width: 24px;
}

.rbx-data, .rut-box {
    display: flex;
    flex-direction: column;
}

.rbx-label, .rut-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.rbx-value, .rut-value {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 0.2rem;
}

.rbx-id {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'Space Mono', monospace;
    margin-top: 0.1rem;
}

.rut-value {
    font-family: 'Space Mono', monospace;
    font-size: 1.4rem;
    color: var(--text-main);
}

/* 2. Bank Widget (Square) */
.bento-bank {
    grid-column: span 1;
    grid-row: span 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
}

.card-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.blue-glow { background: rgba(0,112,243,0.1); color: var(--accent-blue); border: 1px solid rgba(0,112,243,0.2); }

.arrow-link {
    color: var(--text-muted);
    transition: all var(--transition-smooth);
}
.bento-bank:hover .arrow-link {
    color: var(--text-main);
    transform: translate(3px, -3px);
}

.bank-details {
    margin-top: 2rem;
}

.balance-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 1px;
}

.balance-value {
    font-family: 'Space Mono', monospace;
    font-size: 2rem;
    font-weight: 700;
    margin: 0.3rem 0 1rem 0;
}

.bank-pill {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
}

/* 3. Status Widget */
.bento-status {
    grid-column: span 1;
    grid-row: span 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(145deg, rgba(20,20,20,0.8), rgba(10,10,10,0.9));
}

.status-header {
    display: flex;
    align-items: center;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-green);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-green);
    animation: pulse 2s infinite;
}

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

.status-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 1rem 0;
}

.btn-primary-pill {
    background: var(--text-main);
    color: var(--bg-base);
    border: none;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.btn-primary-pill:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(255,255,255,0.2);
}

/* 4. Quick Actions Widget */
.bento-actions {
    grid-column: span 2;
    grid-row: span 1;
}

.bento-actions h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.action-btn {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--text-main);
    cursor: pointer;
    transition: all var(--transition-smooth);
}

.action-btn i {
    font-size: 2rem;
    transition: transform var(--transition-bounce);
}

.action-btn span {
    font-size: 0.85rem;
    font-weight: 600;
}

.action-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.2);
}
.action-btn:hover i {
    transform: scale(1.2);
}

/* ================== OLD CLASSES FALLBACKS (DO NOT REMOVE) ================== */
/* Essential for existing logic */
.btn-action, .btn-banco, .btn-banco-primary, .outline {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.btn-action:hover { background: rgba(255,255,255,0.1); }
.banco-input, .form-input, input, select {
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--border-glass);
    color: white;
    padding: 1rem;
    border-radius: var(--radius-sm);
    width: 100%;
}
.modal-overlay {
    position: fixed; top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(5px);
    display:flex; align-items:center; justify-content:center;
    z-index: 9999;
}
.modal-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 2rem; width: 90%; max-width: 500px;
}
.btn-close {
    background: transparent; border:none; color: var(--text-muted);
    font-size: 1.5rem; cursor:pointer; float:right;
}
.cart-drawer-overlay {
    position: fixed; top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.5); display:none; z-index: 8000;
}
.cart-drawer-overlay.open { display:block; }
.cart-drawer {
    position: fixed; top:0; right:-400px; width:400px; max-width:100%; height:100%;
    background: var(--bg-elevated); z-index: 8001; transition: 0.3s;
    border-left: 1px solid var(--border-glass);
    display:flex; flex-direction:column; padding:2rem;
}
.cart-drawer.open { right:0; }

/* Grid fallbacks for other pages so they don't break visually */
.banco-grid, .personaje-grid, .vehiculos-grid, .multas-list, .legal-grid, .ajustes-list {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.banco-card, .personaje-card, .vehiculo-card, .multa-item, .legal-card, .ajuste-item {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 2rem;
    transition: transform var(--transition-smooth);
}
.banco-card:hover, .personaje-card:hover, .vehiculo-card:hover, .multa-item:hover, .legal-card:hover, .ajuste-item:hover {
    transform: translateY(-3px);
    border-color: rgba(255,255,255,0.15);
}
.recompensa-center {
    display: flex; justify-content: center; align-items: center;
    min-height: 50vh;
}
.recompensa-card {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 3rem; text-align: center; max-width: 400px;
}

/* Tienda Items */
.tienda-item {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-smooth);
}
.tienda-item:hover {
    transform: translateY(-5px);
    border-color: rgba(255,255,255,0.2);
}
.tienda-item img {
    width: 100%; height: 200px; object-fit: cover;
}
.tienda-item-info {
    padding: 1.5rem; flex: 1; display:flex; flex-direction:column; justify-content: space-between;
}

/* ================== AI ASSISTANT ================== */
.ai-assistant-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
}

.ai-orb {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #0070f3, #00df89);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(0, 223, 137, 0.5), inset 0 0 10px rgba(255,255,255,0.5);
    animation: breathe 3s infinite ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    transition: transform var(--transition-bounce);
}

.ai-orb:hover {
    transform: scale(1.1);
}

@keyframes breathe {
    0% { transform: scale(1); box-shadow: 0 0 20px rgba(0, 223, 137, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 35px rgba(0, 112, 243, 0.6); }
    100% { transform: scale(1); box-shadow: 0 0 20px rgba(0, 223, 137, 0.4); }
}

.ai-chat-bubble {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 300px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all var(--transition-bounce);
    transform-origin: bottom right;
}

.ai-chat-bubble.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ai-chat-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 0.8rem;
}

.ai-chat-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.ai-chat-message {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 1rem;
    background: rgba(255,255,255,0.03);
    padding: 1rem;
    border-radius: var(--radius-sm);
}

.ai-chat-input {
    display: flex;
    gap: 0.5rem;
}

.ai-chat-input input {
    flex: 1;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-pill);
    padding: 0.6rem 1rem;
    color: var(--text-main);
    font-size: 0.85rem;
}

.ai-chat-input input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-chat-input button {
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: not-allowed;
    opacity: 0.5;
}

@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }
    .bento-profile, .bento-actions {
        grid-column: span 1;
    }
    .floating-dock {
        width: 90%;
        justify-content: space-between;
        padding: 0.5rem;
    }
    .dock-item span {
        display: none;
    }
}