/* ========== CSS Variables ========== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #06b6d4;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --bg-body: #0b1121;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #1e293b;
    --border-light: #334155;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --navbar-height: 70px;
}

/* ========== Reset & Base ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--navbar-height);
}

body {
    font-family: var(--font);
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: var(--transition);
}
a:hover { color: var(--primary); }

img { max-width: 100%; display: block; }

::selection {
    background: var(--primary);
    color: white;
}

/* ========== Container ========== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ========== Navbar ========== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
    z-index: 1000;
    transition: var(--transition);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.brand-icon {
    font-size: 1.6rem;
    color: var(--primary);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-highlight {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.1);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-lg { padding: 16px 32px; font-size: 1.05rem; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-color: transparent;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-light);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.1);
}

/* ========== Hero ========== */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: var(--navbar-height);
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 50%, rgba(99, 102, 241, 0.08), transparent 60%),
                radial-gradient(ellipse at 70% 50%, rgba(6, 182, 212, 0.06), transparent 60%);
    animation: heroGlow 10s ease-in-out infinite alternate;
}

@keyframes heroGlow {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-30px, -30px) rotate(3deg); }
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 0;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 50px;
    font-size: 0.85rem;
    color: var(--primary-light);
    margin-bottom: 24px;
}

.hero-badge i {
    font-size: 0.6rem;
    color: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 20px;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
    line-height: 1.8;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.hero-stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.last-update {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.update-badge {
    padding: 4px 12px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 50px;
    font-size: 0.8rem;
    color: var(--primary-light);
}

.hero-particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

/* ========== Sections ========== */
.section {
    padding: 80px 0;
}

.section-dark {
    background: var(--bg-dark);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 32px;
}

.section-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-header h2 i {
    color: var(--primary);
}

.section-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* ========== Search ========== */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.search-box input {
    padding: 10px 16px 10px 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    width: 240px;
    transition: var(--transition);
    outline: none;
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* ========== Sort Select ========== */
.sort-select {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}

.sort-select:focus {
    border-color: var(--primary);
}

.sort-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* ========== Table ========== */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

.crypto-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.crypto-table th {
    background: rgba(15, 23, 42, 0.6);
    padding: 16px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-light);
}

.crypto-table td {
    padding: 14px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
    vertical-align: middle;
}

.crypto-row {
    transition: var(--transition);
}

.crypto-row:hover {
    background: rgba(99, 102, 241, 0.05);
}

.crypto-row:last-child td {
    border-bottom: none;
}

.rank {
    color: var(--text-muted);
    font-weight: 500;
    width: 40px;
}

.coin-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 180px;
}

.coin-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.coin-details {
    display: flex;
    flex-direction: column;
}

.coin-name {
    font-weight: 600;
    color: var(--text-primary);
}

.coin-symbol {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.price {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.change {
    font-weight: 600;
    white-space: nowrap;
}

.change.positive { color: var(--success); }
.change.negative { color: var(--danger); }

.volume,
.market-cap {
    color: var(--text-secondary);
    white-space: nowrap;
}

.sparkline {
    min-width: 100px;
    text-align: center;
}

.sparkline-svg {
    width: 100px;
    height: 30px;
}

.no-data {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.no-data-row {
    text-align: center;
    padding: 60px 20px !important;
    color: var(--text-muted);
}

.no-data-row i {
    font-size: 2rem;
    margin-bottom: 12px;
    display: block;
}

/* ========== Stats Grid ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-light);
}

.stat-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stat-card-icon.purple { background: rgba(99, 102, 241, 0.15); color: var(--primary-light); }
.stat-card-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.stat-card-icon.blue { background: rgba(6, 182, 212, 0.15); color: var(--secondary); }
.stat-card-icon.yellow { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.stat-card-icon.red { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.stat-card-icon.pink { background: rgba(236, 72, 153, 0.15); color: #ec4899; }

.stat-card-title {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stat-card-value {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-card-change {
    font-size: 0.85rem;
    font-weight: 500;
}

.stat-card-change.positive { color: var(--success); }
.stat-card-change.negative { color: var(--danger); }

/* ========== About ========== */
.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.about-content h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.about-content h2 i { color: var(--primary); }

.about-text {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 48px;
}

.about-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.about-feature {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 32px 24px;
    transition: var(--transition);
}

.about-feature:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.about-feature i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 16px;
}

.about-feature h4 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.about-feature p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========== Footer ========== */
.footer {
    background: var(--bg-dark);
    border-top: 1px solid var(--border-color);
    padding: 40px 0;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-brand {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-brand i { color: var(--primary); }

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-links a:hover { color: var(--primary-light); }

.footer-copyright {
    color: var(--text-muted);
    font-size: 0.85rem;
    width: 100%;
    text-align: center;
}

/* ========== Loading Overlay ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 17, 33, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    z-index: 9999;
    backdrop-filter: blur(10px);
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
    .section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .section-controls {
        flex-direction: column;
    }

    .search-box input {
        width: 100%;
    }

    .about-features {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: var(--navbar-height);
        left: 0;
        right: 0;
        background: rgba(15, 23, 42, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 20px;
        gap: 8px;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-toggle {
        display: flex;
    }

    .hero-stats {
        gap: 24px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .about-features {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .hero-stats {
        flex-direction: column;
        gap: 16px;
    }

    .hero-actions {
        flex-direction: column;
    }

    .btn-lg {
        width: 100%;
    }

    .crypto-table {
        font-size: 0.8rem;
    }

    .crypto-table th,
    .crypto-table td {
        padding: 10px 8px;
    }

    .coin-info {
        min-width: 140px;
    }

    .coin-logo {
        width: 24px;
        height: 24px;
    }
}