/* ============================================
   CryptoFlow — Dark Glassmorphism Theme
   ============================================ */

:root {
    --bg: #07070a;
    --bg-surface: #0e0e12;
    --bg-elevated: #141419;
    --bg-card: rgba(18, 18, 24, 0.7);
    --bg-card-hover: rgba(22, 22, 30, 0.85);
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --text: #e8e8ec;
    --text-secondary: #8b8b9e;
    --text-muted: #5a5a6e;
    --accent: #e0e0e0;
    --accent-dim: rgba(224, 224, 224, 0.08);
    --green: #34d399;
    --green-dim: rgba(52, 211, 153, 0.12);
    --red: #f87171;
    --red-dim: rgba(248, 113, 113, 0.12);
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --font: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

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

/* Ambient Background */
.ambient-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.ambient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.25;
    animation: float 20s ease-in-out infinite;
}

.ambient-orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, #1a1a2e 0%, transparent 70%);
    top: -200px;
    left: -100px;
    animation-delay: 0s;
}

.ambient-orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #161625 0%, transparent 70%);
    top: 50%;
    right: -200px;
    animation-delay: -7s;
}

.ambient-orb-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #121220 0%, transparent 70%);
    bottom: -100px;
    left: 30%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -40px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(7, 7, 10, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 4px;
}

.nav-link {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    color: var(--green);
    background: var(--green-dim);
    border: 1px solid rgba(52, 211, 153, 0.15);
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 2s ease-in-out infinite;
}

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

/* Hero */
.hero {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 80px 24px 40px;
}

.hero-content {
    max-width: 600px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.hero h1 {
    font-size: clamp(40px, 7vw, 64px);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.05;
    margin-bottom: 16px;
}

.hero-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Converter Section */
.converter-section {
    position: relative;
    z-index: 1;
    max-width: 520px;
    margin: 0 auto;
    padding: 20px 24px 60px;
}

.converter-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px;
    backdrop-filter: blur(40px);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.03),
        0 20px 60px rgba(0, 0, 0, 0.4);
}

.converter-row {
    margin-bottom: 0;
}

.converter-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}

.converter-input-group {
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px 4px 4px 18px;
    transition: var(--transition);
}

.converter-input-group:focus-within {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.03);
}

.converter-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-family: var(--font);
    font-size: 28px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
    min-width: 0;
    padding: 12px 0;
}

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

.converter-input::-webkit-outer-spin-button,
.converter-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Currency Selector */
.currency-selector {
    position: relative;
}

.currency-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    transition: var(--transition);
    user-select: none;
    white-space: nowrap;
}

.currency-btn:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--border-hover);
}

.currency-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.currency-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    max-height: 360px;
    overflow-y: auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius);
    padding: 6px;
    z-index: 200;
    display: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
}

.currency-dropdown.open {
    display: block;
    animation: dropIn 0.15s ease;
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.currency-dropdown::-webkit-scrollbar {
    width: 4px;
}

.currency-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.currency-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 4px;
}

.dropdown-search {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    outline: none;
    margin-bottom: 6px;
    transition: var(--transition);
}

.dropdown-search:focus {
    border-color: rgba(255, 255, 255, 0.15);
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.dropdown-item.selected {
    background: rgba(255, 255, 255, 0.06);
}

.dropdown-item img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dropdown-item-info {
    flex: 1;
    min-width: 0;
}

.dropdown-item-symbol {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.dropdown-item-name {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-item-price {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
}

/* Swap Button */
.swap-row {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
    position: relative;
}

.swap-line {
    position: absolute;
    left: 18px;
    right: 18px;
    height: 1px;
    background: var(--border);
    z-index: 0;
}

.swap-btn {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.swap-btn:hover {
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    transform: rotate(180deg);
}

/* Rate Info */
.rate-info {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.rate-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.rate-label {
    font-size: 13px;
    color: var(--text-muted);
}

.rate-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.rate-change {
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.rate-change.positive { color: var(--green); }
.rate-change.negative { color: var(--red); }

/* Rates Section */
.rates-section {
    position: relative;
    z-index: 1;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px 24px 80px;
}

.section-header {
    margin-bottom: 32px;
}

.section-header h2 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

.section-desc {
    font-size: 15px;
    color: var(--text-secondary);
}

.rates-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    backdrop-filter: blur(20px);
}

.rates-table-header {
    display: grid;
    grid-template-columns: 48px 2fr 1.5fr 1fr 1.5fr 48px;
    padding: 14px 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
}

.rates-table-body {
    min-height: 200px;
}

.rate-row {
    display: grid;
    grid-template-columns: 48px 2fr 1.5fr 1fr 1.5fr 48px;
    padding: 16px 20px;
    align-items: center;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

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

.rate-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.col-rank {
    font-size: 13px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.col-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.col-name img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.col-name-text {
    display: flex;
    flex-direction: column;
}

.col-name-symbol {
    font-size: 14px;
    font-weight: 600;
}

.col-name-full {
    font-size: 12px;
    color: var(--text-muted);
}

.col-price {
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.col-change {
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.col-change.positive { color: var(--green); }
.col-change.negative { color: var(--red); }

.col-market {
    font-size: 13px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.col-action {
    display: flex;
    justify-content: center;
}

.chart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.chart-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
}

/* Loading */
.rates-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--text-secondary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay.open {
    display: flex;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    width: 100%;
    max-width: 900px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
}

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

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.modal-body {
    height: 500px;
}

.tradingview-container {
    width: 100%;
    height: 100%;
}

/* Footer */
.footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--border);
    padding: 24px;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.footer-sep {
    color: var(--border-hover);
}

/* Responsive */
@media (max-width: 768px) {
    .header-inner {
        padding: 0 16px;
    }

    .nav-links {
        display: none;
    }

    .hero {
        padding: 60px 16px 30px;
    }

    .converter-section {
        padding: 10px 16px 40px;
    }

    .converter-card {
        padding: 24px 20px;
    }

    .converter-input {
        font-size: 22px;
    }

    .rates-section {
        padding: 10px 16px 60px;
    }

    .rates-table-header {
        grid-template-columns: 36px 2fr 1.5fr 1fr 40px;
        padding: 10px 14px;
    }

    .col-market,
    .rates-table-header span:nth-child(5) {
        display: none;
    }

    .rate-row {
        grid-template-columns: 36px 2fr 1.5fr 1fr 40px;
        padding: 12px 14px;
    }

    .col-market {
        display: none;
    }

    .modal-card {
        max-width: 100%;
    }

    .modal-body {
        height: 350px;
    }
}

@media (max-width: 480px) {
    .converter-input-group {
        flex-direction: column;
        padding: 10px;
        gap: 8px;
    }

    .converter-input {
        width: 100%;
        text-align: center;
        padding: 8px 0;
    }

    .currency-btn {
        width: 100%;
        justify-content: center;
    }

    .currency-dropdown {
        width: calc(100vw - 80px);
        right: -60px;
    }
}
