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

:root {
    --primary: #3b82f6;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #0f172a;
    --darker: #020617;
    --light: #f8fafc;
    --white: #ffffff;
    --border: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --sidebar-width: 260px;
}

* { box-sizing: border-box; }

[x-cloak] { display: none !important; }

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--darker);
    color: var(--text-main);
}

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-green { color: var(--success); }
.btn-block { width: 100%; display: block; }

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.btn-sm { padding: 0.4rem 1rem; font-size: 0.85rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1.1rem; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-light { background: white; color: var(--dark); }

/* Loading */
.loading-overlay {
    position: fixed; inset: 0; background: var(--darker); z-index: 9999;
    display: flex; align-items: center; justify-content: center;
}
.spinner {
    width: 40px; height: 40px; border: 4px solid #1e293b;
    border-top: 4px solid var(--primary); border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Dashboard Layout */
.dashboard-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width); background: var(--dark); color: white;
    display: flex; flex-direction: column; position: fixed; height: 100vh;
    border-right: 1px solid var(--border);
}
.sidebar-header {
    padding: 1.5rem; font-size: 1.1rem; font-weight: 700; letter-spacing: 1px;
    border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 0.75rem;
}
.sidebar-menu { list-style: none; padding: 1rem 0; margin: 0; flex: 1; }
.sidebar-menu li a {
    display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1.5rem;
    color: var(--text-muted); text-decoration: none; transition: 0.2s;
}
.sidebar-menu li.active a, .sidebar-menu li a:hover {
    color: white; background: rgba(59, 130, 246, 0.1); border-left: 3px solid var(--primary);
}
.sidebar-footer {
    padding: 1rem; border-top: 1px solid var(--border);
}

.user-info { display: flex; align-items: center; gap: 0.75rem; }
.avatar {
    width: 32px; height: 32px; background: var(--primary); border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.details { display: flex; flex-direction: column; font-size: 0.85rem; flex: 1; }
.details .role { font-size: 0.7rem; color: var(--text-muted); }
.btn-logout { background: none; border: none; color: var(--text-muted); cursor: pointer; }
.btn-logout:hover { color: var(--danger); }

.main-content {
    flex: 1; margin-left: var(--sidebar-width); background: var(--darker);
}
.top-bar {
    background: var(--dark); padding: 0.75rem 2rem; display: flex; justify-content: space-between;
    align-items: center; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.market-status { font-size: 0.85rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }
.pulse { width: 8px; height: 8px; background: var(--success); border-radius: 50%; box-shadow: 0 0 10px var(--success); }
.top-actions { display: flex; align-items: center; gap: 1rem; }
.guest-actions { display: flex; gap: 0.5rem; }

.icon-btn {
    width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border);
    background: var(--dark); color: var(--text-muted); cursor: pointer;
}

.view-content { padding: 2rem; }

/* Hero Banner inside Dashboard */
.hero-banner {
    background-size: cover; background-position: center; border-radius: 1rem;
    padding: 3rem 2rem; margin-bottom: 2rem; border: 1px solid var(--border);
}
.hero-banner h1 { margin: 0 0 0.5rem 0; font-size: 2rem; font-weight: 800; }
.hero-banner p { margin: 0; color: var(--text-muted); font-size: 1.1rem; }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.stat-card {
    background: var(--dark); padding: 1.5rem; border-radius: 0.75rem;
    border: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between;
}
.prediction-card .price { font-family: 'JetBrains Mono', monospace; font-size: 1.5rem; font-weight: 700; margin: 0.5rem 0; }
.prediction-status { font-size: 0.85rem; font-weight: 600; }
.prediction-status.up { color: var(--success); }
.prediction-status.down { color: var(--danger); }

.sentiment-bar { width: 100%; height: 6px; background: #1e293b; border-radius: 3px; margin-top: 1rem; }
.sentiment-bar .fill { height: 100%; background: var(--success); border-radius: 3px; box-shadow: 0 0 10px var(--success); }

.stat-card .icon {
    width: 50px; height: 50px; border-radius: 12px; display: flex; align-items: center;
    justify-content: center; font-size: 1.5rem; color: white;
}
.bg-blue { background: rgba(59, 130, 246, 0.2); color: var(--primary); }
.bg-green { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.bg-purple { background: rgba(139, 92, 246, 0.2); color: #8b5cf6; }
.stat-card h3 { margin: 0; font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }

/* Charts Section */
.charts-section { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
.chart-card {
    background: var(--dark); padding: 1.5rem; border-radius: 0.75rem;
    border: 1px solid var(--border);
}
.chart-container { position: relative; height: 300px; }
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-list li {
    display: flex; align-items: center; gap: 1rem; padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}
.activity-list li:last-child { border-bottom: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.status-badge {
    margin-left: auto; padding: 0.25rem 0.75rem; border-radius: 4px;
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
}
.status-badge.bullish { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.status-badge.bearish { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.status-badge.neutral { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }

/* Gallery */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.gallery-item {
    position: relative; border-radius: 0.75rem; overflow: hidden; height: 220px;
    border: 1px solid var(--border); cursor: pointer;
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; opacity: 0.6; transition: 0.3s; }
.gallery-item:hover img { opacity: 0.9; transform: scale(1.02); }
.gallery-item .overlay {
    position: absolute; inset: 0; background: linear-gradient(transparent, rgba(0,0,0,0.9));
    display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end;
    padding: 1.5rem; color: white;
}
.gallery-item .overlay p { font-size: 0.8rem; color: var(--text-muted); margin: 0.5rem 0; }

/* Tables */
.card { background: var(--dark); border-radius: 0.75rem; border: 1px solid var(--border); overflow: hidden; }
.card-header { padding: 1.5rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.badge { background: var(--primary); padding: 0.4rem 0.8rem; border-radius: 20px; font-size: 0.75rem; font-weight: 700; }
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 1rem 1.5rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: rgba(255,255,255,0.02); font-weight: 600; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
td { font-size: 0.9rem; font-family: 'JetBrains Mono', monospace; }

/* Modal */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 1000;
    display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px);
}
.modal {
    background: var(--dark); width: 100%; max-width: 400px; padding: 2.5rem;
    border-radius: 1rem; border: 1px solid var(--border); box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-size: 0.85rem; font-weight: 500; color: var(--text-muted); }
.form-group input {
    width: 100%; padding: 0.75rem; border: 1px solid var(--border);
    background: var(--darker); color: white; border-radius: 0.5rem; font-family: inherit;
}
.switch-auth { text-align: center; margin-top: 1.5rem; font-size: 0.85rem; color: var(--text-muted); }
.switch-auth a { color: var(--primary); text-decoration: none; font-weight: 600; }

/* Mobile */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: 0.3s; z-index: 100; }
    .main-content { margin-left: 0; }
    .charts-section { grid-template-columns: 1fr; }
    .hero-banner h1 { font-size: 1.5rem; }
}