/* ==========================================
   CARTEIRA CRIPTO — Design System
   Dark mode por defeito, Light mode opcional
   Inspirado em CoinStats/Binance
   ========================================== */

/* ==========================================
   1. RESET & VARIÁVEIS CSS
   ========================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Dark mode (default) */
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-tertiary: #1a1a35;
    --bg-card: #14142b;
    --bg-hover: #1e1e40;
    --bg-input: #1a1a35;
    --border-color: rgba(108, 92, 231, 0.15);
    --border-light: rgba(255, 255, 255, 0.06);

    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b80;
    --text-heading: #ffffff;

    --accent-primary: #6c5ce7;
    --accent-secondary: #a29bfe;
    --accent-gradient: linear-gradient(135deg, #6c5ce7, #a29bfe);
    --accent-glow: rgba(108, 92, 231, 0.3);

    --green: #00cea2;
    --green-bg: rgba(0, 206, 162, 0.1);
    --green-border: rgba(0, 206, 162, 0.3);
    --red: #e74c3c;
    --red-bg: rgba(231, 76, 60, 0.1);
    --red-border: rgba(231, 76, 60, 0.3);
    --yellow: #f39c12;
    --yellow-bg: rgba(243, 156, 18, 0.1);
    --blue: #3498db;
    --blue-bg: rgba(52, 152, 219, 0.1);

    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --topbar-height: 65px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
    --shadow-accent: 0 4px 20px rgba(108, 92, 231, 0.2);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* Light mode */
[data-theme="light"] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9fa;
    --bg-card: #ffffff;
    --bg-hover: #f0f0f5;
    --bg-input: #f5f5fa;
    --border-color: rgba(108, 92, 231, 0.12);
    --border-light: rgba(0, 0, 0, 0.08);

    --text-primary: #2d2d3a;
    --text-secondary: #6b6b80;
    --text-muted: #9a9ab0;
    --text-heading: #1a1a2e;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.1);
}

/* ==========================================
   2. RESET
   ========================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: var(--accent-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--accent-primary);
}

img {
    max-width: 100%;
    display: block;
}

/* ==========================================
   3. LAYOUT — SIDEBAR + CONTENT
   ========================================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-light);
    min-height: var(--topbar-height);
}

.sidebar-brand .logo-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.sidebar-brand h2 {
    font-size: 18px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 0 12px 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    transition: var(--transition);
    margin-bottom: 2px;
    font-size: 14px;
    font-weight: 500;
    position: relative;
}

.nav-link i {
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--accent-gradient);
    color: #ffffff;
    box-shadow: var(--shadow-accent);
}

.nav-link .badge-nav {
    margin-left: auto;
    background: var(--accent-primary);
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.nav-link.active .badge-nav {
    background: rgba(255, 255, 255, 0.25);
}

/* Sidebar User */
.sidebar-user {
    padding: 16px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user .user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-user .user-info {
    overflow: hidden;
}

.sidebar-user .user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-plan {
    font-size: 11px;
    color: var(--accent-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* MAIN CONTENT */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    min-width: 0;
    overflow-x: hidden;
    transition: var(--transition);
}

.page-content {
    padding: 28px;
    max-width: 100%;
    overflow-x: hidden;
}

/* TOPBAR */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 500;
    backdrop-filter: blur(20px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-left h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-heading);
}

.btn-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius-sm);
}

.btn-sidebar-toggle:hover {
    background: var(--bg-hover);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 16px;
}

.btn-theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
}

/* PAGE CONTENT */
.page-content {
    padding: 28px;
    overflow-x: hidden;
    max-width: 100vw;
}

/* ==========================================
   4. CARDS
   ========================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    transition: var(--transition);
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

.card:hover {
    border-color: rgba(108, 92, 231, 0.3);
    box-shadow: var(--shadow-md);
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.card-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-heading);
    line-height: 1.2;
}

.card-value.small {
    font-size: 22px;
}

.kpi-card {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.kpi-card .card-body {
    flex: 1;
    min-width: 0;
}

.kpi-card .card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

/* KPI Card values: fit on one line, no breaks, no ellipsis */
.kpi-card .card-value {
    font-size: clamp(18px, 1.5vw, 26px);
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
    white-space: nowrap;
    line-height: 1.2;
}

.kpi-card .card-subtitle {
    font-size: clamp(11px, 0.9vw, 13px);
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.card-icon.purple {
    background: rgba(108, 92, 231, 0.12);
    color: #a29bfe;
}

.card-icon.green {
    background: var(--green-bg);
    color: var(--green);
}

.card-icon.red {
    background: var(--red-bg);
    color: var(--red);
}

.card-icon.blue {
    background: var(--blue-bg);
    color: var(--blue);
}

.card-icon.yellow {
    background: var(--yellow-bg);
    color: var(--yellow);
}

/* KPI Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

/* Second row: 2 smaller cards centered */
.kpi-grid .card:nth-child(n+4) {
    grid-column: span 1;
}


/* ==========================================
   5. TABELAS
   ========================================== */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    background: var(--bg-tertiary);
    padding: 12px 10px;
    /* Reduced from 16px to fit better */
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-align: left;
    white-space: normal;
    /* Allow wrapping to prevent overflow */
    border-bottom: 1px solid var(--border-light);
}

.data-table thead th:first-child {
    border-radius: var(--border-radius-sm) 0 0 0;
}

.data-table thead th:last-child {
    border-radius: 0 var(--border-radius-sm) 0 0;
    text-align: right;
}

.data-table tbody td {
    padding: 14px 10px;
    /* Reduced from 16px to fit better */
    font-size: 14px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tbody td:last-child {
    white-space: nowrap;
    width: 1%;
    /* Collapse column width to minimum necessary for action buttons */
    text-align: right;
}

.data-table tbody tr {
    transition: var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Asset row */
.asset-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.asset-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.asset-name {
    font-weight: 600;
    color: var(--text-primary);
}

.asset-symbol {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ==========================================
   6. FORMULÁRIOS
   ========================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

.form-row {
    display: grid;
    /* Changed minmax basis from 200px to 0 so it correctly drops to 1fr via our global media queries on mobile */
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 16px;
}

.form-help {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==========================================
   7. BOTÕES
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(108, 92, 231, 0.35);
    color: white;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.btn-success {
    background: linear-gradient(135deg, #00b894, #00cea2);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: white;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--border-radius-sm);
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==========================================
   8. BADGES & TAGS
   ========================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-green {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid var(--green-border);
}

.badge-red {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid var(--red-border);
}

.badge-purple {
    background: rgba(108, 92, 231, 0.12);
    color: var(--accent-secondary);
    border: 1px solid rgba(108, 92, 231, 0.3);
}

.badge-yellow {
    background: var(--yellow-bg);
    color: var(--yellow);
    border: 1px solid rgba(243, 156, 18, 0.3);
}

.badge-blue {
    background: var(--blue-bg);
    color: var(--blue);
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.pnl-positive {
    color: var(--green);
}

.pnl-negative {
    color: var(--red);
}

/* ==========================================
   9. MODAL
   ========================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(20px);
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-heading);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    transition: var(--transition-fast);
}

.modal-close:hover {
    color: var(--red);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ==========================================
   10. TOAST NOTIFICATIONS
   ========================================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
    width: 100%;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.4s ease;
    transition: var(--transition);
}

.toast.removing {
    animation: slideOutRight 0.3s ease forwards;
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.toast-success .toast-icon {
    color: var(--green);
}

.toast-error .toast-icon {
    color: var(--red);
}

.toast-warning .toast-icon {
    color: var(--yellow);
}

.toast-info .toast-icon {
    color: var(--blue);
}

.toast-success {
    border-left: 3px solid var(--green);
}

.toast-error {
    border-left: 3px solid var(--red);
}

.toast-warning {
    border-left: 3px solid var(--yellow);
}

.toast-info {
    border-left: 3px solid var(--blue);
}

.toast-body {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ==========================================
   11. CHARTS
   ========================================== */
.chart-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    padding: 20px 0;
}

.chart-container canvas {
    max-width: 100% !important;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.chart-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-heading);
}

.chart-filters {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    padding: 3px;
}

.chart-filter-btn {
    padding: 6px 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition-fast);
    font-family: 'Inter', sans-serif;
}

.chart-filter-btn.active,
.chart-filter-btn:hover {
    background: var(--accent-primary);
    color: white;
}

/* ==========================================
   12. AUTOCOMPLETE
   ========================================== */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    max-height: 280px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    display: none;
}

.autocomplete-results.show {
    display: block;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.autocomplete-item:hover {
    background: var(--bg-hover);
}

.autocomplete-item img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.autocomplete-item .coin-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.autocomplete-item .coin-symbol {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ==========================================
   13. AI CHAT
   ========================================== */
.ai-chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: var(--border-radius);
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.ai-message.user {
    align-self: flex-end;
    background: var(--accent-gradient);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message.assistant {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-bottom-left-radius: 4px;
}

.ai-chat-input {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
}

.ai-chat-input input {
    flex: 1;
}

/* ==========================================
   14. LOADING & SKELETON
   ========================================== */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-light);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--border-radius-sm);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ==========================================
   15. LANDING PAGE
   ========================================== */
.landing-page {
    min-height: 100vh;
    background: var(--bg-primary);
}

.landing-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.landing-nav .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-heading);
}

/* ==========================================
   HERO SLIDER
   ========================================== */
.hero-slider {
    position: relative;
    width: 100vw;
    height: 600px;
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #000;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 1;
}

.slide.active {
    opacity: 1;
    z-index: 2;
}

.slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.4) 100%);
    z-index: 3;
}

.slide-content {
    position: relative;
    z-index: 4;
    max-width: 800px;
    padding: 0 20px;
}

.slide-content h1 {
    font-size: 56px;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 24px;
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.slide-content .btn {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Welcome Section
   ========================================== */
.landing-welcome {
    padding: 80px 20px;
    background: var(--bg-primary);
}

.welcome-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.welcome-text h2 {
    font-size: 42px;
    font-weight: 800;
    margin-bottom: 24px;
    color: var(--text-primary);
    line-height: 1.2;
}

.welcome-text p {
    font-size: 18px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 30px;
}

.welcome-image img {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.welcome-image img:hover {
    transform: scale(1.02);
}

@media (max-width: 992px) {
    .welcome-container {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }

    .welcome-text h2 {
        font-size: 32px;
    }

    .welcome-text div {
        justify-content: center;
    }
}

.features-section-header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 40px;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.features-section-header h2 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text-heading);
}

.features-section-header h2.premium-title {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.features-section-header p {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.landing-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px 80px;
}

.landing-features.premium {
    max-width: 900px;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
}

@media (max-width: 768px) {
    .landing-features.premium {
        grid-template-columns: 1fr;
    }
}


.feature-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    text-align: center;
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
}

.feature-card .feature-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 24px;
    color: white;
}

.feature-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-heading);
}

.feature-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Auth Forms (Landing) */
.auth-container {
    max-width: 440px;
    margin: 0 auto;
    padding: 0 20px 60px;
}

.auth-card {
    background: linear-gradient(145deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border: 1px solid rgba(108, 92, 231, 0.25);
    border-radius: var(--border-radius-lg);
    padding: 36px;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.4), 0 0 40px rgba(108, 92, 231, 0.1);
}

.auth-card h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-heading);
    text-align: center;
}

.auth-card .auth-subtitle {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 28px;
    font-size: 14px;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 28px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    padding: 3px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition-fast);
    font-family: 'Inter', sans-serif;
}

.auth-tab.active {
    background: var(--accent-gradient);
    color: white;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-light);
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-muted);
}

.alert-message {
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid var(--green-border);
}

.alert-error {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid var(--red-border);
}

.alert-info {
    background: var(--blue-bg);
    color: var(--blue);
    border: 1px solid rgba(52, 152, 219, 0.3);
}

/* ==========================================
   16. UPGRADE PAGE
   ========================================== */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    max-width: 800px;
    margin: 0 auto;
}

.plan-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 32px;
    text-align: center;
    position: relative;
    transition: var(--transition);
}

.plan-card.recommended {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-accent);
}

.plan-card.recommended::before {
    content: '⭐ RECOMENDADO';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-gradient);
    color: white;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.plan-card h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 8px;
}

.plan-price {
    font-size: 40px;
    font-weight: 800;
    color: var(--accent-primary);
    margin: 16px 0;
}

.plan-price span {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-muted);
}

.plan-features {
    list-style: none;
    text-align: left;
    margin: 24px 0;
}

.plan-features li {
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.plan-features li i {
    color: var(--green);
    width: 18px;
}

.plan-features li.disabled {
    color: var(--text-muted);
    text-decoration: line-through;
}

.plan-features li.disabled i {
    color: var(--red);
}

/* ==========================================
   17. FEAR & GREED GAUGE
   ========================================== */
.fng-gauge {
    text-align: center;
    padding: 20px;
}

.fng-value {
    font-size: 48px;
    font-weight: 800;
    margin: 10px 0;
}

.fng-label {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
}

/* ==========================================
   18. EMPTY STATES
   ========================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    color: var(--text-heading);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ==========================================
   19. FILTERS BAR
   ========================================== */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    font-size: 13px;
}

/* ==========================================
   20. GRID LAYOUTS
   ========================================== */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* ==========================================
   21. SCROLL CUSTOMIZATION
   ========================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(108, 92, 231, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(108, 92, 231, 0.5);
}

/* ==========================================
   22. ANIMATIONS
   ========================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.animate-in {
    animation: fadeIn 0.5s ease forwards;
}

.card {
    animation: fadeInUp 0.4s ease forwards;
}

/* Stagger cards */
.kpi-grid .card:nth-child(1) {
    animation-delay: 0.05s;
}

.kpi-grid .card:nth-child(2) {
    animation-delay: 0.1s;
}

.kpi-grid .card:nth-child(3) {
    animation-delay: 0.15s;
}

.kpi-grid .card:nth-child(4) {
    animation-delay: 0.2s;
}

.kpi-grid .card:nth-child(5) {
    animation-delay: 0.25s;
}

.kpi-grid .card:nth-child(6) {
    animation-delay: 0.3s;
}

/* ==========================================
   23. RESPONSIVE
   ========================================== */
@media (max-width: 1024px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-content {
        margin-left: 0;
        max-width: 100vw;
    }

    .btn-sidebar-toggle {
        display: flex;
    }

    .page-content {
        padding: 20px 16px;
    }

    .topbar {
        padding: 0 16px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .hero-slider {
        height: 50vh;
        min-height: 400px;
    }

    .slide-content h1 {
        font-size: 32px;
    }

    .landing-nav {
        padding: 15px 20px;
    }

    .card-value {
        font-size: 22px;
    }

    .plans-grid {
        grid-template-columns: 1fr;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .auth-container {
        padding: 0 16px 40px;
    }

    .modal {
        width: 95%;
        margin: 10px;
    }
}

@media (max-width: 540px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .slide-content h1 {
        font-size: 28px;
    }

    .topbar-left h1 {
        font-size: 16px;
    }

    .data-table {
        font-size: 13px;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 10px 8px;
    }

    /* Hide less critical columns on small screens */
    .data-table thead th:nth-child(2),
    .data-table tbody td:nth-child(2),
    .data-table thead th:nth-child(6),
    .data-table tbody td:nth-child(6) {
        display: none;
    }

    .data-table thead th {
        font-size: 11px;
    }

    .data-table tbody td {
        font-size: 12px;
    }

    .asset-cell {
        gap: 6px;
    }

    .asset-logo {
        width: 24px !important;
        height: 24px !important;
    }

    .asset-name {
        font-size: 12px;
    }

    .asset-symbol {
        display: none;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .filters-bar form {
        flex-direction: column;
        align-items: stretch !important;
    }

    .filters-bar .form-control {
        width: 100% !important;
    }

    .btn-group {
        flex-wrap: wrap;
    }
}

/* Admin top stats grid */
.admin-top-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 600px) {
    .admin-top-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

@media (max-width: 768px) {
    .sidebar-overlay.active {
        display: block;
    }
}

/* ==========================================
   24. RISK SCORE
   ========================================== */
.risk-meter {
    width: 100%;
    height: 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    overflow: hidden;
    margin: 16px 0;
}

.risk-meter-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 1s ease;
}

/* ==========================================
   25. TABS
   ========================================== */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 24px;
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab {
    padding: 12px 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition-fast);
    flex-shrink: 0;
    white-space: nowrap;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ==========================================
   26. PAGINATION
   ========================================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border-radius: var(--border-radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.pagination a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.pagination .active {
    background: var(--accent-gradient);
    color: white;
}

/* ==========================================
   27. UTILITY CLASSES
   ========================================== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.text-green {
    color: var(--green);
}

.text-red {
    color: var(--red);
}

.text-accent {
    color: var(--accent-secondary);
}

.fw-600 {
    font-weight: 600;
}

.fw-700 {
    font-weight: 700;
}

.fs-sm {
    font-size: 13px;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 8px;
}

.gap-2 {
    gap: 16px;
}

.gap-3 {
    gap: 24px;
}

.w-100 {
    width: 100%;
}

.hidden {
    display: none !important;
}