:root {
    --primary: #7C6DFA;
    --primary-light: #C4B5FD;
    --accent: #10D98A;
    --red: #F43F5E;
    --bg-dark: #08111F;
    --text-primary: #FFFFFF;
    --text-secondary: #94A3B8;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-stroke: rgba(255, 255, 255, 0.1);
    --glass-blur: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    max-width: 100%;
}

img {
    max-width: 100%;
    height: auto;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    font-size: 15px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-stroke);
    border-radius: 20px;
}

/* Navbar */
.navbar {
    padding: 12px 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 2000;
    background: rgba(8, 17, 31, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: -0.5px;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo .moon { color: var(--text-primary); }
.logo .list { color: var(--primary); }

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
}

.btn-primary-sm {
    background: var(--primary);
    color: white;
    padding: 8px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    font-weight: 600;
    cursor: pointer;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 2100;
}

.menu-toggle .bar {
    width: 24px;
    height: 2px;
    background-color: var(--text-primary);
    margin: 3px 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-toggle.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-toggle.active .bar:nth-child(2) { opacity: 0; }
.menu-toggle.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* Side Drawer */
.nav-menu {
    position: fixed;
    top: 75px;
    right: -110%;
    width: 240px;
    max-height: calc(100vh - 100px);
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 2050;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow-y: auto;
}

.nav-menu.active { right: 20px; }

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 2040;
    opacity: 0;
    visibility: hidden;
}

.menu-overlay.active { opacity: 1; visibility: visible; }

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(255,255,255,0.02);
}

.drawer-header {
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: 900;
}

.nav-section-switcher {
    display: flex;
    gap: 6px;
    margin-top: 5px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.section-chip {
    flex: 1;
    padding: 8px 12px;
    border-radius: 100px;
    background: transparent;
    border: none;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: 0.2s;
    touch-action: manipulation;
}

.section-chip.active {
    background: var(--primary);
    color: white;
}

/* Market Section */
.market-preview { padding: 100px 0 60px; }
.section-title { text-align: center; font-size: 32px; margin-bottom: 20px; }

.chips { display: flex; justify-content: center; gap: 10px; margin-bottom: 24px; }
.chip { padding: 8px 16px; border-radius: 100px; background: var(--glass-bg); border: 1px solid var(--glass-stroke); font-size: 14px; cursor: pointer; transition: 0.2s; }
.chip.active { background: var(--primary); border-color: var(--primary); }

.market-table { padding: 15px; }
.table-header, .table-row {
    display: grid;
    grid-template-columns: 40px 2fr 1fr 1fr 1.2fr;
    padding: 12px 8px;
    align-items: center;
}

.table-header { border-bottom: 1px solid var(--glass-stroke); color: var(--text-secondary); font-size: 13px; font-weight: 600; }
.table-row { border-bottom: 1px solid rgba(255,255,255,0.03); cursor: pointer; transition: 0.2s; }
.table-row:hover { background: rgba(255,255,255,0.02); }

.table-row .token { display: flex; align-items: center; gap: 10px; }
.token-info-text { display: flex; flex-direction: column; min-width: 0; }
.token-info-text strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.token-info-text small { color: var(--text-secondary); font-size: 11px; }

.table-row .price { font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.table-row .change { font-size: 12px; font-weight: 700; }
.up { color: var(--accent); }
.down { color: var(--red); }

/* Trending Grid */
.trending-grid {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    margin-bottom: 20px;
    padding: 10px 0;
    scrollbar-width: none; /* Firefox */
}
.trending-grid::-webkit-scrollbar { display: none; } /* Chrome/Safari */
.trending-card {
    min-width: 160px;
    flex-shrink: 0;
    padding: 10px;
    cursor: pointer;
    transition: 0.2s;
}
.trending-card:hover { transform: translateY(-2px); background: rgba(255,255,255,0.08); }

/* Portfolio */
.portfolio-stats { background: linear-gradient(135deg, rgba(124,109,250,0.1), rgba(16,217,138,0.05)); padding: 30px; text-align: center; }
#portfolio-total { font-size: 36px; font-weight: 900; color: var(--primary-light); }

/* Modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); z-index: 2999; opacity: 0; pointer-events: none; transition: 0.3s; }
.modal-overlay.active { opacity: 1; pointer-events: all; }

.token-modal, .auth-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
    overflow-y: auto;
    max-height: 90vh;
    width: calc(100% - 32px);
    box-sizing: border-box;
}
.token-modal.active, .auth-modal.active { opacity: 1; pointer-events: all; transform: translate(-50%, -50%) scale(1); }
.token-modal { width: 95%; max-width: 600px; padding: 24px; }
.auth-modal {
    width: 95%;
    max-width: 420px;
    padding: 40px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.auth-modal h2 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.auth-modal p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px 16px;
    color: white;
    font-size: 15px;
    outline: none;
    transition: 0.2s;
}

.form-group input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(124, 109, 250, 0.1);
}

.forgot-password {
    text-align: right;
    margin-top: -12px;
    margin-bottom: 24px;
}

.forgot-password span {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-light);
    cursor: pointer;
    transition: 0.2s;
}

.forgot-password span:hover {
    color: white;
}

.auth-divider {
    margin: 24px 0;
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
}

.auth-divider::before, .auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.google-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    background: white;
    color: #1f1f1f;
    border: none;
    transition: 0.2s;
    touch-action: manipulation;
}

.google-btn:hover {
    background: #f1f1f1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#user-profile {
    text-align: center;
    padding: 10px 0;
}

#user-profile h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

#user-profile p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 30px;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    color: white;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(244, 63, 94, 0.1);
    color: var(--red);
    transform: rotate(90deg);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

/* Mobile Optimizations - FIT MANY THINGS */
@media (max-width: 768px) {
    body { font-size: 13px; overflow-x: hidden; width: 100%; position: relative; }
    .container { padding: 0 12px; width: 100%; }
    .navbar { padding: 8px 0; }
    .logo { font-size: 16px; }
    .nav-actions .btn-primary-sm, .nav-divider { display: none; }
    .btn-ghost { padding: 5px !important; font-size: 0; }
    .btn-ghost::before { content: '👤'; font-size: 18px; }

    .market-preview { padding-top: 30px; width: 100%; overflow-x: hidden; }
    .section-title { font-size: 22px; margin-bottom: 20px; padding: 0 10px; }

    .chips { gap: 6px; overflow-x: auto; justify-content: flex-start; padding-bottom: 10px; margin-bottom: 16px; -webkit-overflow-scrolling: touch; }
    .chip { padding: 6px 12px; font-size: 12px; white-space: nowrap; }

    .market-table { padding: 0; border-radius: 12px; width: 100%; overflow-x: hidden; }
    .table-header, .table-row { grid-template-columns: 24px 1.5fr 1fr 0.8fr; padding: 10px 4px; gap: 4px; width: 100%; }
    .table-header span:last-child, .table-row .mcap { display: none; }
    
    .table-row .token img { width: 22px; height: 22px; }
    .token-info-text strong { font-size: 12px; }
    .token-info-text small { font-size: 10px; }
    .table-row .price { font-size: 12px; }
    .table-row .change { font-size: 10px; }

    .trending-dashboard { padding: 12px !important; width: 100%; }
    .trending-grid {
        gap: 8px;
        padding: 4px 0 12px;
        margin: 0 -12px;
        padding-left: 12px;
        -webkit-overflow-scrolling: touch;
    }
    .trending-card {
        min-width: 130px;
        flex-shrink: 0;
        padding: 8px;
    }
    .trending-grid::-webkit-scrollbar { display: none; }
    .trending-card img { width: 22px !important; height: 22px !important; }
    .trending-card strong { font-size: 13px !important; }
    
    .nav-menu { top: 65px; width: 220px; padding: 16px; }
    
    #portfolio-total { font-size: 28px; }
    .portfolio-stats { padding: 20px 10px; }
}

@media (max-width: 380px) {
    .table-header, .table-row { grid-template-columns: 20px 1.5fr 1fr 0.7fr; gap: 4px; }
    .token-info-text strong { font-size: 11px; }
}

/* Animations */
@keyframes flashGreen { 0% { color: var(--accent); } 100% { color: var(--text-primary); } }
@keyframes flashRed { 0% { color: var(--red); } 100% { color: var(--text-primary); } }
.flash-green { animation: flashGreen 1s ease-out; }
.flash-red { animation: flashRed 1s ease-out; }

.desktop-only { display: flex; }
@media (max-width: 768px) {
    .desktop-only { display: none !important; }
}

/* Utilities */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    touch-action: manipulation;
}
.btn-primary:hover { background: var(--primary-light); }
.btn-secondary {
    background: rgba(255,255,255,0.05);
    color: white;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
}

footer { padding: 40px 0; text-align: center; border-top: 1px solid var(--glass-stroke); color: var(--text-secondary); font-size: 12px; }

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

