/* ============================================================
   ValutaX — currency converter
   Design tokens + BEM components, no CSS framework.
   ============================================================ */

:root {
    --color-bg: #0b0f19;
    --color-card: #111827;
    --color-border: #1f2937;
    --color-text: #e5e7eb;
    --color-muted: #9ca3af;
    --color-faint: #6b7280;
    --color-accent: #38b6ff;
    --color-success: #34d399;

    --rainbow: linear-gradient(90deg, #ff5757, #ffbd59, #4cd964, #5ce1e6, #38b6ff, #7851a9);

    --radius-lg: 1.5rem;
    --radius-md: 0.75rem;
    --radius-sm: 0.5rem;

    --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.45);
}

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

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 14px;
    line-height: 1.5;
    background: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--color-border);
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* ------------------------------------------------------------
   Header / footer
   ------------------------------------------------------------ */

.site-header {
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 1.5rem;
}

.site-header__inner,
.site-footer__inner {
    max-width: 72rem;
    margin: 0 auto;
}

.site-header__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: inherit;
    text-decoration: none;
}

.site-header__logo {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-muted);
}

.site-header__logo svg {
    width: 1.25rem;
    height: 1.25rem;
}

.site-header__name {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.site-header__accent {
    font-style: italic;
    background: var(--rainbow);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-faint);
}

.site-footer p {
    margin: 0;
}

/* ------------------------------------------------------------
   Converter layout
   ------------------------------------------------------------ */

.converter {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
}

.converter__container {
    width: 100%;
    max-width: 36rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.converter__hero {
    text-align: center;
}

.converter__title {
    margin: 0 0 0.75rem;
    font-size: 1.875rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

@media (min-width: 768px) {
    .converter__title {
        font-size: 2.25rem;
    }
}

.converter__subtitle {
    margin: 0 auto;
    max-width: 28rem;
    font-size: 0.75rem;
    color: var(--color-muted);
}

@media (min-width: 768px) {
    .converter__subtitle {
        font-size: 0.875rem;
    }
}

.text-gradient {
    background: var(--rainbow);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Gradient ring via inset ::before + XOR mask. Ring stays 1px,
   the rest of the layer is masked out and click-through. */
.converter__card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--color-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.converter__card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 87, 87, 0.35), rgba(60, 225, 230, 0.12), rgba(120, 81, 169, 0.35));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

@media (min-width: 768px) {
    .converter__card {
        padding: 2rem;
    }
}

/* ------------------------------------------------------------
   Amount / result fields
   ------------------------------------------------------------ */

.converter__field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.converter__label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.converter__hint {
    font-size: 0.6875rem;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--color-faint);
}

.converter__control {
    display: grid;
    grid-template-columns: 7fr 5fr;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color 0.2s;
}

.converter__control:focus-within {
    border-color: var(--color-muted);
}

.converter__input {
    min-width: 0;
    padding: 0 0.75rem;
    background: transparent;
    border: 0;
    font: inherit;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
    outline: none;
}

.converter__input::placeholder {
    color: var(--color-faint);
}

@media (min-width: 768px) {
    .converter__input {
        font-size: 1.5rem;
    }
}

.converter__output {
    min-width: 0;
    padding: 0 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    overflow-x: auto;
    white-space: nowrap;
}

@media (min-width: 768px) {
    .converter__output {
        font-size: 1.5rem;
    }
}

/* ------------------------------------------------------------
   Custom select dropdown
   ------------------------------------------------------------ */

.select {
    position: relative;
    min-width: 0;
    display: flex;
    align-items: center;
    align-self: stretch;
    padding-left: 0.5rem;
    border-left: 1px solid var(--color-border);
}

.select__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
    width: 100%;
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.75rem;
    color: var(--color-text);
    cursor: pointer;
}

.select__toggle:hover {
    background: var(--color-card);
}

.select__toggle svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    color: var(--color-muted);
}

.select__value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.select__menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 14rem;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.6);
    z-index: 10;
}

.select__menu[hidden] {
    display: none;
}

.select__options {
    max-height: 12rem;
    overflow-y: auto;
    padding: 0.25rem;
}

.select__options::-webkit-scrollbar {
    width: 5px;
}

.select__options::-webkit-scrollbar-track {
    background: var(--color-bg);
}

.select__options::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.select__options::-webkit-scrollbar-thumb:hover {
    background: var(--color-muted);
}

.select__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.75rem;
    text-align: left;
    color: var(--color-muted);
    cursor: pointer;
}

.select__option:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.select__option--active {
    color: var(--color-text);
    font-weight: 700;
}

.select__option--active::after {
    content: '✓';
    color: var(--color-success);
}

/* ------------------------------------------------------------
   Swap button
   ------------------------------------------------------------ */

.converter__swap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.converter__swap-line {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px solid var(--color-border);
}

.swap-btn {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    padding: 0.625rem;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 9999px;
    color: var(--color-muted);
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}

.swap-btn svg {
    width: 1rem;
    height: 1rem;
}

.swap-btn:hover {
    border-color: var(--color-muted);
    transform: scale(1.05);
}

.swap-btn:active {
    transform: scale(0.95);
}

/* ------------------------------------------------------------
   Conversion details
   ------------------------------------------------------------ */

.converter__details {
    margin: 0;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    background: rgba(11, 15, 25, 0.6);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    color: var(--color-muted);
}

.converter__detail {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.converter__detail dt,
.converter__detail dd {
    margin: 0;
}

.converter__detail dd {
    font-weight: 500;
    color: var(--color-text);
}

/* ------------------------------------------------------------
   Actions
   ------------------------------------------------------------ */

.converter__actions {
    padding-top: 0.5rem;
}

.btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: var(--color-card);
    border: 0;
    border-radius: 9999px;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--color-text);
    cursor: pointer;
    transition: color 0.2s;
}

.btn:hover {
    color: var(--color-muted);
}

.btn svg {
    width: 1rem;
    height: 1rem;
}

.btn--rainbow::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1.5px;
    background: var(--rainbow);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* ------------------------------------------------------------
   Quick stats
   ------------------------------------------------------------ */

.quick-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .quick-stats {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

.stat-card {
    padding: 1rem;
    text-align: center;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.stat-card--wide {
    grid-column: span 2;
}

@media (min-width: 768px) {
    .stat-card--wide {
        grid-column: span 1;
    }
}

.stat-card__label {
    margin: 0 0 0.25rem;
    font-size: 0.625rem;
    font-weight: 500;
    color: var(--color-faint);
}

.stat-card__value {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-text);
}
