/* ============================================================
   CryptoVision — Real-Time Crypto Dashboard
   Premium Dark Theme Design v2.0
   ============================================================ */

:root {
    --bg-primary: #0b0e17;
    --bg-secondary: #111827;
    --bg-card: #1a1f35;
    --bg-card-hover: #1f2642;
    --bg-input: #151a2e;

    --text-primary: #e8ecf4;
    --text-secondary: #8b95ab;
    --text-tertiary: #5a6478;

    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-yellow: #f59e0b;
    --accent-cyan: #06b6d4;

    --gradient-brand: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --gradient-green: linear-gradient(135deg, #10b981, #059669);
    --gradient-red: linear-gradient(135deg, #ef4444, #dc2626);

    --border-color: rgba(255, 255, 255, 0.06);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

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

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

/* ============================================================
   BACKGROUND AMBIENT EFFECTS
   ============================================================ */
.bg-ambient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
}

.bg-glow-1 {
    width: 500px;
    height: 500px;
    background: var(--accent-blue);
    top: -100px;
    right: -100px;
    animation: ambientFloat 20s ease-in-out infinite;
}

.bg-glow-2 {
    width: 400px;
    height: 400px;
    background: var(--accent-purple);
    bottom: -50px;
    left: -100px;
    animation: ambientFloat 25s ease-in-out infinite reverse;
}

.bg-glow-3 {
    width: 300px;
    height: 300px;
    background: var(--accent-cyan);
    top: 40%;
    left: 50%;
    animation: ambientFloat 30s ease-in-out infinite 5s;
}

@keyframes ambientFloat {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -20px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 30px) scale(0.9);
    }
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(11, 14, 23, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 800;
}

.logo-icon {
    font-size: 1.5rem;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.market-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--accent-green);
    font-weight: 600;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    50% {
        opacity: 0.7;
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
}

.last-updated {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* ============================================================
   DASHBOARD MAIN
   ============================================================ */
.dashboard {
    position: relative;
    z-index: 1;
}

/* ============================================================
   MARKET OVERVIEW
   ============================================================ */
.market-overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin: 28px 0;
}

.overview-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    animation: cardEntrance 0.5s ease forwards;
}

.overview-card:nth-child(1) {
    animation-delay: 0.1s;
}

.overview-card:nth-child(2) {
    animation-delay: 0.2s;
}

.overview-card:nth-child(3) {
    animation-delay: 0.3s;
}

.overview-card:nth-child(4) {
    animation-delay: 0.4s;
}

@keyframes cardEntrance {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card glow accents */
.overview-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    border-radius: var(--radius) var(--radius) 0 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.overview-card:hover::before {
    opacity: 1;
}

.overview-card.total-mcap::before {
    background: var(--gradient-brand);
}

.overview-card.total-vol::before {
    background: var(--gradient-green);
}

.overview-card.btc-dom::before {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
}

.overview-card.active-coins::before {
    background: linear-gradient(135deg, var(--accent-yellow), var(--accent-red));
}

/* Card hover glow */
.overview-card.total-mcap:hover {
    border-color: rgba(59, 130, 246, 0.2);
    box-shadow: 0 4px 30px rgba(59, 130, 246, 0.08);
}

.overview-card.total-vol:hover {
    border-color: rgba(16, 185, 129, 0.2);
    box-shadow: 0 4px 30px rgba(16, 185, 129, 0.08);
}

.overview-card.btc-dom:hover {
    border-color: rgba(139, 92, 246, 0.2);
    box-shadow: 0 4px 30px rgba(139, 92, 246, 0.08);
}

.overview-card.active-coins:hover {
    border-color: rgba(245, 158, 11, 0.2);
    box-shadow: 0 4px 30px rgba(245, 158, 11, 0.08);
}

.overview-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.overview-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-bottom: 12px;
}

.total-mcap .overview-card-icon {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-blue);
}

.total-vol .overview-card-icon {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-green);
}

.btc-dom .overview-card-icon {
    background: rgba(139, 92, 246, 0.12);
    color: var(--accent-purple);
}

.active-coins .overview-card-icon {
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-yellow);
}

.overview-label {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.overview-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.overview-change {
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.overview-change.up {
    color: var(--accent-green);
}

.overview-change.down {
    color: var(--accent-red);
}

.overview-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: var(--gradient-brand);
    border-radius: 3px;
    transition: width 1s ease;
}

/* ============================================================
   CONTENT GRID
   ============================================================ */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

/* ============================================================
   CHART SECTION
   ============================================================ */
.chart-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    animation: cardEntrance 0.6s ease 0.3s forwards;
}

.chart-section:hover {
    border-color: rgba(59, 130, 246, 0.15);
    box-shadow: 0 8px 40px rgba(59, 130, 246, 0.05);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.chart-title-area h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.chart-price {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.chart-change {
    font-size: 0.9rem;
    font-weight: 600;
    margin-left: 8px;
}

.chart-change.up {
    color: var(--accent-green);
}

.chart-change.down {
    color: var(--accent-red);
}

.chart-timeframes {
    display: flex;
    gap: 4px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.tf-btn {
    padding: 6px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition);
}

.tf-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.tf-btn.active {
    background: var(--accent-blue);
    color: white;
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.3);
}

.chart-container {
    height: 300px;
    position: relative;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Chart tooltip */
.chart-tooltip {
    position: absolute;
    background: rgba(26, 31, 53, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    padding: 8px 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 10;
    font-size: 0.8rem;
    white-space: nowrap;
}

.chart-tooltip.visible {
    opacity: 1;
}

.chart-tooltip .tooltip-price {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.chart-tooltip .tooltip-date {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    margin-top: 2px;
}

/* ============================================================
   COIN LIST
   ============================================================ */
.coin-list-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    animation: cardEntrance 0.6s ease 0.4s forwards;
}

.coin-list-section:hover {
    border-color: rgba(139, 92, 246, 0.15);
    box-shadow: 0 8px 40px rgba(139, 92, 246, 0.05);
}

.coin-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.coin-list-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-box svg {
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.search-box input {
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.85rem;
    outline: none;
    width: 140px;
}

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

.coin-table-wrapper {
    overflow-x: auto;
    max-height: 420px;
    overflow-y: auto;
}

/* Custom scrollbar */
.coin-table-wrapper::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.coin-table-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.coin-table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

.coin-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

.coin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

.coin-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}

.coin-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.coin-table td {
    padding: 12px;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    white-space: nowrap;
}

.coin-table tbody tr {
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
}

.coin-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

.coin-table tbody tr.active {
    background: rgba(59, 130, 246, 0.08);
    border-left: 2px solid var(--accent-blue);
}

/* Row entrance animation */
.coin-table tbody tr {
    opacity: 0;
    animation: rowEntrance 0.3s ease forwards;
}

@keyframes rowEntrance {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.coin-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.coin-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.coin-name {
    font-weight: 600;
}

.coin-symbol {
    color: var(--text-tertiary);
    font-size: 0.8rem;
    margin-left: 4px;
    text-transform: uppercase;
}

.change-badge {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.change-badge.up {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
}

.change-badge.down {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

.sparkline-canvas {
    width: 80px;
    height: 30px;
}

/* Empty search state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
}

.empty-state-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 0.9rem;
}

/* ============================================================
   CONVERTER
   ============================================================ */
.converter-section {
    margin-bottom: 32px;
    opacity: 0;
    transform: translateY(20px);
    animation: cardEntrance 0.6s ease 0.5s forwards;
}

.converter-section h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.converter-card {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    flex-wrap: wrap;
    position: relative;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.converter-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: var(--radius);
    padding: 1px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.2));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.converter-card:hover::before {
    opacity: 1;
}

.converter-card:hover {
    box-shadow: 0 8px 40px rgba(59, 130, 246, 0.05);
}

.converter-input-group {
    flex: 1;
    min-width: 140px;
}

.converter-input-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.converter-input-group input,
.converter-input-group select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.95rem;
    outline: none;
    transition: border var(--transition), box-shadow var(--transition);
}

.converter-input-group input:focus,
.converter-input-group select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.converter-input-group select option {
    background: var(--bg-secondary);
}

.converter-swap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--accent-blue);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.converter-swap:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    transform: rotate(180deg);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}

.converter-result {
    flex: 1;
    min-width: 140px;
}

.converter-result label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-value {
    padding: 10px 14px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-blue);
    min-height: 42px;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.result-value.updated {
    background: rgba(59, 130, 246, 0.12);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    padding: 32px 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    position: relative;
    z-index: 1;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 1px;
    background: var(--gradient-brand);
}

.footer-inner p {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.footer-inner a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color var(--transition);
}

.footer-inner a:hover {
    color: var(--accent-purple);
    text-decoration: underline;
}

.footer-disclaimer {
    font-size: 0.75rem;
    margin-top: 6px;
    opacity: 0.6;
}

/* ============================================================
   LOADING SKELETON
   ============================================================ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .market-overview {
        grid-template-columns: repeat(2, 1fr);
    }

    .converter-card {
        flex-direction: column;
        align-items: stretch;
    }

    .converter-swap {
        align-self: center;
        transform: rotate(90deg);
    }

    .converter-swap:hover {
        transform: rotate(270deg);
    }

    .bg-glow {
        opacity: 0.08;
    }
}

@media (max-width: 480px) {
    .market-overview {
        grid-template-columns: 1fr;
    }

    .chart-header {
        flex-direction: column;
    }

    .header-info {
        display: none;
    }

    .bg-glow-3 {
        display: none;
    }
}