/* ==========================================================================
   DEVEX PAGE — page-specific styles only
   Relies on /css/style.css for base tokens (colors, fonts, nav, footer, etc.)
   ========================================================================== */

/* ---- Layout ---- */
.devex-section {
    min-height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 8vh 0 6rem;
}

/* ---- Page heading ---- */
.devex-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.devex-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.devex-subtitle {
    font-size: 0.95rem;
    color: var(--fg-muted);
}

/* Language toggle button — sits just below the subtitle */
.lang-btn {
    margin-top: 0.25rem;
    padding: 0.3rem 0.875rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--fg-muted);
    font-size: 0.8rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.lang-btn:hover {
    color: var(--fg);
    border-color: var(--fg-muted);
    background: var(--surface-hover);
}

/* ---- Calculator card ---- */
.calc-card {
    width: min(100%, 480px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ---- Input group (text + dropdown + button in one pill) ---- */
.input-group {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg);
    overflow: hidden;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-group:focus-within {
    border-color: var(--fg-muted);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--fg) 8%, transparent);
}

.calc-input {
    flex: 1;
    min-width: 0;
    padding: 0.875rem 1rem 0.875rem 1.25rem;
    font-size: 1rem;
    font-family: inherit;
    background: transparent;
    border: none;
    outline: none;
    color: var(--fg);
    caret-color: var(--fg);
}

.calc-input::placeholder {
    color: var(--fg-dim);
}

/* Thin separator between input and dropdown */
.input-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    flex-shrink: 0;
}

/*
   Native <select> ignores 'background: transparent' in some browsers.
   Explicit background + color + color-scheme makes it follow the theme.
*/
.unit-select,
.xe-select {
    background-color: var(--bg);
    color: var(--fg);
    color-scheme: dark;
}

[data-theme="light"] .unit-select,
[data-theme="light"] .xe-select {
    color-scheme: light;
}

.unit-select {
    padding: 0.875rem 0.75rem;
    font-size: 0.875rem;
    font-family: inherit;
    font-weight: 500;
    border: none;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23a1a1aa' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    padding-right: 1.75rem;
    transition: color var(--transition-fast);
}

.unit-select:hover,
.unit-select:focus {
    color: var(--fg);
}

/* ---- Arrow between input and output ---- */
.conversion-arrow {
    display: flex;
    justify-content: center;
    color: var(--fg-dim);
    margin: -0.25rem 0;
}

/* ---- Output field ---- */
.output-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 0.875rem 1.25rem;
    background: var(--bg);
    min-height: 52px;
}

.output-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--fg-dim);
    background: var(--surface-hover);
    border-radius: var(--radius-full);
    padding: 0.2rem 0.6rem;
    flex-shrink: 0;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.output-value {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--fg);
    letter-spacing: -0.01em;
    word-break: break-all;
}

/* ---- 18+ US rate toggle ---- */
.rate-toggle {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg);
    transition: border-color var(--transition-fast), background var(--transition-fast), opacity var(--transition-fast);
    user-select: none;
}

.rate-toggle:hover {
    border-color: var(--border-hover);
    background: var(--surface-hover);
}

/* Disabled state — when unit is USD → Robux */
.rate-toggle.is-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.toggle-check-wrapper {
    position: relative;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.toggle-check-wrapper input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    margin: 0;
}

.custom-check {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border-hover);
    border-radius: 5px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), border-color var(--transition-fast);
    pointer-events: none;
}

.custom-check svg {
    opacity: 0;
    transition: opacity var(--transition-fast);
    color: var(--bg);
}

.toggle-check-wrapper input:checked + .custom-check {
    background: var(--fg);
    border-color: var(--fg);
}

.toggle-check-wrapper input:checked + .custom-check svg {
    opacity: 1;
}

.toggle-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.toggle-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--fg);
    line-height: 1.3;
}

.toggle-desc {
    font-size: 0.8rem;
    color: var(--fg-muted);
    line-height: 1.4;
}

/* ---- Currency banner ---- */
.currency-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg);
    font-size: 0.875rem;
}

.banner-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--fg-muted);
    flex: 1;
    min-width: 0;
}

.banner-left svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

@media (min-width: 520px) {
    .banner-left svg {
        width: 22px;
        height: 22px;
    }
}

.banner-right {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-shrink: 0;
}

.xe-select {
    font-size: 0.825rem;
    font-family: inherit;
    font-weight: 500;
    padding: 0.4rem 1.6rem 0.4rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='none' stroke='%23a1a1aa' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.45rem center;
    transition: border-color var(--transition-fast);
}

.xe-select:hover,
.xe-select:focus {
    border-color: var(--fg-muted);
}

.xe-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.875rem;
    border-radius: var(--radius-full);
    font-size: 0.825rem;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid var(--border);
    color: var(--fg-muted);
    background: rgba(128, 128, 128, 0.05);
    white-space: nowrap;
    text-decoration: none;
    flex-shrink: 0;
    transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}

.xe-open-btn:hover {
    color: var(--fg);
    background: rgba(128, 128, 128, 0.1);
    border-color: var(--fg-muted);
}

/* ---- Rate reference notes ---- */
.rate-note {
    font-size: 0.8rem;
    color: var(--fg-dim);
    text-align: center;
    max-width: 480px;
    line-height: 1.6;
}

.rate-note strong {
    color: var(--fg-muted);
    font-weight: 500;
}

.rate-note a {
    color: var(--fg-muted);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color var(--transition-fast);
}

.rate-note a:hover {
    color: var(--fg);
}

/* ---- Mobile adjustments ---- */
@media (max-width: 520px) {
    .calc-card {
        padding: 1.5rem;
    }

    .currency-banner {
        padding: 0.875rem 1rem;
        gap: 0.75rem;
    }

    /* Stack the xe-select and Open button side by side filling the full width */
    .banner-right {
        width: 100%;
    }

    .xe-select {
        flex: 1;
        min-width: 0;
    }

    /* On mobile the Open button shows only the icon to save space */
    .xe-open-btn {
        padding: 0.4rem 0.7rem;
    }

    #xe-open-text {
        display: none;
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .convert-btn:hover,
    .convert-btn:active {
        transform: none;
    }
}
