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

:root {
    --bg: #0a0a0a;
    --bg-elevated: #111111;
    --bg-card: #141414;
    --bg-input: #1a1a1a;
    --border: #222222;
    --border-light: #2a2a2a;
    --text: #ededed;
    --text-secondary: #888888;
    --text-muted: #555555;
    --accent: #ffffff;
    --green: #00d672;
    --red: #ff4444;
    --radius: 12px;
    --radius-sm: 8px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Navigation ===== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.01em;
    color: var(--text);
}

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

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

.nav-link:hover {
    color: var(--text);
    background: var(--bg-input);
}

.nav-link.active {
    color: var(--text);
    background: var(--bg-input);
}

/* ===== Main ===== */
.main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== Hero ===== */
.hero {
    padding-top: 140px;
    padding-bottom: 60px;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

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

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

.hero-title {
    font-size: clamp(40px, 7vw, 64px);
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.1;
    margin-bottom: 20px;
}

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

.hero-sub {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 420px;
    margin: 0 auto;
}

/* ===== Converter Card ===== */
.converter-section {
    display: flex;
    justify-content: center;
    padding-bottom: 100px;
}

.converter-card {
    width: 100%;
    max-width: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    animation: fadeUp 0.5s ease;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.convert-row {
    margin-bottom: 4px;
}

.convert-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.input-group {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.convert-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s ease;
    min-width: 0;
}

.convert-input:focus {
    border-color: #444;
}

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

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

.convert-input[type=number] {
    -moz-appearance: textfield;
}

.result-input {
    color: var(--green);
}

.select-wrapper {
    position: relative;
}

.convert-select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 36px 14px 16px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease;
    min-width: 100px;
    height: 100%;
}

.convert-select:focus {
    border-color: #444;
}

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--text-secondary);
    pointer-events: none;
}

/* ===== Swap Button ===== */
.swap-row {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 48px;
}

.swap-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: var(--border);
}

.swap-btn {
    position: relative;
    z-index: 2;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.swap-btn:hover {
    background: var(--bg-input);
    color: var(--text);
    border-color: #444;
    transform: rotate(180deg);
}

/* ===== Rate Info ===== */
.rate-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.rate-text {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

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

/* ===== Rates Table ===== */
.rates-section {
    padding-bottom: 100px;
}

.section-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

.section-sub {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.rates-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.rates-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.rates-table thead {
    background: var(--bg-elevated);
}

.rates-table th {
    padding: 12px 20px;
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.th-left { text-align: left; }
.th-right { text-align: right; }

.rates-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.rates-table tbody tr:last-child td {
    border-bottom: none;
}

.rates-table tbody tr {
    transition: background 0.1s ease;
}

.rates-table tbody tr:hover {
    background: var(--bg-elevated);
}

.td-right { text-align: right; }
.td-left { text-align: left; }

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

.pair-base {
    color: var(--text-muted);
    font-weight: 400;
}

.price-cell {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.change-positive {
    color: var(--green);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.change-negative {
    color: var(--red);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.volume-cell {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.loading-cell {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px !important;
}

.rank-cell {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* ===== Footer ===== */
.footer {
    padding: 32px 0;
    border-top: 1px solid var(--border);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

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

.footer-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .hero {
        padding-top: 110px;
        padding-bottom: 40px;
    }

    .hero-title {
        font-size: 36px;
    }

    .hero-sub {
        font-size: 14px;
    }

    .converter-card {
        padding: 20px;
    }

    .convert-input {
        font-size: 18px;
        padding: 12px 14px;
    }

    .convert-select {
        min-width: 85px;
        padding: 12px 30px 12px 12px;
        font-size: 14px;
    }

    .rates-table th,
    .rates-table td {
        padding: 10px 14px;
    }

    .nav-links {
        display: none;
    }

    .section-title {
        font-size: 22px;
    }

    .footer-inner {
        flex-direction: column;
        gap: 4px;
    }

    .footer-dot {
        display: none;
    }
}
