:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --border-color: #e2e8f0;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08);
    --sidebar-width: 260px;
    --sidebar-collapsed: 80px;
    --header-height: 72px;
}

html.dark {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2035;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --border-color: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(17, 24, 39, 0.85);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 10px;
}

[data-aos] {
    opacity: 1;
}

.crypto-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.crypto-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
    border-color: rgba(59, 130, 246, 0.2);
}

.sidebar {
    width: var(--sidebar-width);
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 60;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .sidebar-badge,
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .sidebar-pro-card {
    display: none;
}

.sidebar.collapsed .sidebar-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    position: relative;
    margin: 2px 0;
    gap: 12px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.sidebar-item:hover {
    background: rgba(59, 130, 246, 0.08);
    color: var(--text-primary);
}

.sidebar-item.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.1));
    color: #3b82f6;
    font-weight: 600;
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: linear-gradient(180deg, #3b82f6, #8b5cf6);
    border-radius: 0 4px 4px 0;
}

@media (max-width: 1023px) {
    .sidebar {
        width: 280px !important;
        transform: translateX(-100%);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        width: 280px !important;
    }

    .sidebar.collapsed .sidebar-label,
    .sidebar.collapsed .sidebar-logo-text,
    .sidebar.collapsed .sidebar-badge,
    .sidebar.collapsed .sidebar-section-title,
    .sidebar.collapsed .sidebar-pro-card {
        display: block;
    }

    .sidebar.collapsed .sidebar-item {
        justify-content: flex-start;
        padding-left: 16px;
        padding-right: 16px;
    }

    .main-content {
        margin-left: 0 !important;
    }
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 55;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

.main-header {
    height: var(--header-height);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    z-index: 40;
    position: sticky;
    top: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.45);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-green {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-red {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.badge-green {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.badge-red {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.badge-blue {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
}

.badge-yellow {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.badge-purple {
    background: rgba(139, 92, 246, 0.12);
    color: #8b5cf6;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.2s ease;
    z-index: 100;
    padding: 8px;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.notification-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    max-width: 100vw;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 200;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.notification-panel.open {
    right: 0;
}

.notification-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.notification-overlay.show {
    opacity: 1;
    visibility: visible;
}

.search-modal,
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-backdrop {
    align-items: center;
    padding: 16px;
    z-index: 250;
}

.search-modal.show,
.modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.search-modal-overlay,
.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

.search-modal-content,
.modal-content {
    position: relative;
    width: 90%;
    max-width: 640px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    transform: translateY(-20px) scale(0.95);
    transition: all 0.3s ease;
    overflow: hidden;
}

.modal-content {
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.search-modal.show .search-modal-content,
.modal-backdrop.show .modal-content {
    transform: translateY(0) scale(1);
}

.tab-btn {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    white-space: nowrap;
}

.tab-btn.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.tab-btn:not(.active):hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-tertiary);
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    text-align: left;
    white-space: nowrap;
    z-index: 5;
}

.data-table thead th:first-child {
    border-radius: 12px 0 0 12px;
}

.data-table thead th:last-child {
    border-radius: 0 12px 12px 0;
}

.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.data-table tbody td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.progress-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s ease;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.theme-switch {
    width: 52px;
    height: 28px;
    border-radius: 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.theme-switch-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

html.dark .theme-switch-thumb {
    left: 26px;
}

.ticker-bar {
    overflow: hidden;
    white-space: nowrap;
}

.ticker-content {
    display: inline-flex;
    animation: ticker 40s linear infinite;
}

@keyframes ticker {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}

@media (max-width: 768px) {
    .notification-panel {
        width: 100vw;
        right: -100vw;
    }

    :root {
        --header-height: 64px;
    }
}

@media (max-width: 480px) {
    .crypto-card {
        border-radius: 12px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

body.no-scroll {
    overflow: hidden;
}

html.dark .apexcharts-tooltip {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #f1f5f9 !important;
}

html.dark .apexcharts-tooltip .apexcharts-tooltip-title {
    background: #0f172a !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.crypto-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: contain;
    background: white;
    padding: 2px;
    flex-shrink: 0;
}

html.dark .crypto-logo {
    background: rgba(255, 255, 255, 0.9);
}

.crypto-logo-sm {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    object-fit: contain;
    flex-shrink: 0;
}

.crypto-logo-lg {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: contain;
    background: white;
    padding: 3px;
    flex-shrink: 0;
}

html.dark .crypto-logo-lg {
    background: rgba(255, 255, 255, 0.9);
}

/* Portfolio specific styles */
.asset-row {
    transition: all 0.2s ease;
    cursor: pointer;
}

.asset-row:hover {
    background: var(--bg-tertiary);
}

.hero-portfolio {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.08) 50%, rgba(236, 72, 153, 0.05) 100%);
    border: 1px solid rgba(59, 130, 246, 0.15);
    position: relative;
    overflow: hidden;
}

.hero-portfolio::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.allocation-bar {
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    gap: 2px;
}

.allocation-segment {
    height: 100%;
    transition: all 0.3s ease;
}

.allocation-segment:hover {
    filter: brightness(1.2);
    transform: scaleY(1.4);
}

.performance-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    gap: 4px;
}

.filter-chip {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid transparent;
    white-space: nowrap;
}

.filter-chip.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border-color: transparent;
}

.filter-chip:not(.active):hover {
    border-color: var(--border-color);
    color: var(--text-primary);
}

.glow-blue {
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.2);
}

.wallet-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

.wallet-card:hover {
    transform: translateY(-4px);
}

.search-input-wrapper {
    position: relative;
}

.search-input-wrapper input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease;
}

.search-input-wrapper input:focus {
    border-color: #3b82f6;
}

.search-input-wrapper svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

.main-content {
    flex: 1;
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

.main-wrapper {
    display: flex;
    width: 100%;
    min-width: 0;
}

@media (min-width:1024px) {
    .main-content {
        margin-left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
    }
}