/**
 * Crypto Converter v2 — Professional dark gold theme
 * Responsive: mobile-first, works on all displays
 * @since 5.9.2
 *
 * v5.9.7 — Defensive specificity rewrite.
 * ---------------------------------------
 * Every .cc-* selector is now prefixed with .ffe-converter (the root
 * wrapper element). This bumps selector specificity from (0,1,0) to
 * (0,2,0), which beats any parent-level universal reset like
 *
 *     .some-wrapper * { margin:0; padding:0 }
 *
 * …that page editors often drop around a shortcode. At equal
 * specificity the later rule wins, and inline <style> blocks always
 * load after plugin CSS — so without the prefix bump, such resets
 * silently crushed the converter's padding, margins, gaps, and
 * hover states (reported by a user who wrapped the shortcode in a
 * <div class="ac"> with `.ac * { margin:0; padding:0 }`).
 *
 * In addition, this file now declares element-level defaults inside
 * .ffe-converter for `p`, `a`, `table`, `td`, `th`, `ul`, `ol`, `li`,
 * `button`, `input`, `strong`, and `label`. Those match the selectors
 * page themes typically style (`.ac p`, `.ac a`, etc.) and restore
 * the converter's own values — otherwise page-wide element styling
 * would leak through the gaps.
 */

/* Root wrapper — defensive defaults so parent resets can't leak in */
.ffe-converter {
    max-width: 860px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #fff;
    font-size: 16px;
    line-height: 1.5;
    text-align: left;
}
.ffe-converter * {
    box-sizing: border-box;
}

/* Reset element styles that page themes commonly touch.
   These rules are scoped to .ffe-converter so they only affect the
   converter — they do NOT leak out into the rest of the page. */
.ffe-converter p {
    margin: 0;
    padding: 0;
    color: inherit;
    font-size: inherit;
    line-height: inherit;
}
.ffe-converter a {
    color: inherit;
    text-decoration: none;
    border-bottom: none;
}
.ffe-converter a:hover {
    border-bottom: none;
}
.ffe-converter strong {
    color: inherit;
    font-weight: 700;
}
.ffe-converter ul,
.ffe-converter ol {
    margin: 0;
    padding: 0;
    list-style: none;
}
.ffe-converter li {
    margin: 0;
    padding: 0;
}
.ffe-converter button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
}
.ffe-converter input {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    outline: none;
}
.ffe-converter label {
    display: inline-block;
    font-family: inherit;
}
.ffe-converter h3 {
    font-family: inherit;
    line-height: 1.3;
}

/* Widget card — all inner selectors now prefixed with .ffe-converter
   so they beat any `.parent * { ... }` reset on the host page. */
.ffe-converter .cc-widget {
    background: #1a1a1a;
    border: 1px solid rgba(255, 215, 0, 0.15);
    border-radius: 16px;
    padding: 32px;
    margin: 0;
}
.ffe-converter .cc-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin: 0;
    padding: 0;
}
.ffe-converter .cc-side {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0;
}
.ffe-converter .cc-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    margin: 0 0 8px 0;
    padding: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Amount inputs — LARGE and readable */
.ffe-converter .cc-input-group {
    margin: 0 0 8px 0;
    padding: 0;
}
.ffe-converter .cc-amount-input,
.ffe-converter .cc-result-input {
    width: 100%;
    padding: 16px 18px;
    margin: 0;
    background: #0a0a0a;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #FFD700;
    font-size: 28px;
    font-weight: 800;
    font-family: 'SF Mono', Monaco, monospace;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    min-height: 64px;
    line-height: 1.2;
}
.ffe-converter .cc-amount-input:focus {
    border-color: #FFD700;
}
.ffe-converter .cc-result-input {
    color: #fff;
    cursor: default;
}

/* Currency selector button — with logo, code, name */
.ffe-converter .cc-currency-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 14px;
    margin: 0;
    background: #0a0a0a;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    min-height: 52px;
    line-height: 1.2;
}
.ffe-converter .cc-currency-btn:hover {
    border-color: rgba(255, 215, 0, 0.4);
    background: #111;
}
.ffe-converter .cc-logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}
.ffe-converter .cc-flag {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
    display: inline-block;
}
.ffe-converter .cc-currency-code {
    font-size: 16px;
    font-weight: 800;
    color: #FFD700;
}
.ffe-converter .cc-currency-name {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ffe-converter .cc-chevron {
    color: rgba(255, 215, 0, 0.6);
    font-size: 12px;
    font-weight: 600;
    margin-left: auto;
    white-space: nowrap;
}
.ffe-converter .cc-unit-price {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin: 6px 0 0 0;
    padding: 0;
}

/* Swap button — centered circle */
.ffe-converter .cc-swap-btn {
    align-self: center;
    margin: 40px 0 0 0;
    padding: 0;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid rgba(255, 215, 0, 0.3);
    background: rgba(255, 215, 0, 0.08);
    color: #FFD700;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ffe-converter .cc-swap-btn:hover {
    background: rgba(255, 215, 0, 0.2);
    transform: rotate(180deg);
}

/* Rate bar */
.ffe-converter .cc-rate-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 14px 0 0 0;
    margin: 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    flex-wrap: wrap;
}
.ffe-converter .cc-change {
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
}
.ffe-converter .cc-change--up {
    color: #00C853;
    background: rgba(0, 200, 83, 0.12);
}
.ffe-converter .cc-change--down {
    color: #FF5252;
    background: rgba(255, 82, 82, 0.12);
}

/* CTA */
.ffe-converter .cc-cta {
    text-align: center;
    padding: 24px 0 16px 0;
    margin: 0;
}
.ffe-converter .cc-cta-btn {
    display: inline-block;
    padding: 16px 44px;
    margin: 0;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    font-size: 18px;
    font-weight: 800;
    border-radius: 12px;
    text-decoration: none;
    border: none;
    border-bottom: none;
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
    line-height: 1.2;
}
.ffe-converter .cc-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.5);
    color: #000;
    text-decoration: none;
    border-bottom: none;
}
.ffe-converter .cc-cta-sub {
    margin: 8px 0 0 0;
    padding: 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* Tables */
.ffe-converter .cc-tables {
    padding: 24px 0;
    margin: 0;
}
.ffe-converter .cc-tables h3 {
    font-size: 18px;
    color: #FFD700;
    margin: 24px 0 12px 0;
    padding: 0;
    border: none;
}
.ffe-converter .cc-table {
    width: 100%;
    border-collapse: collapse;
    background: #1a1a1a;
    border-radius: 10px;
    overflow: hidden;
    font-size: 14px;
    margin: 0 0 16px 0;
}
.ffe-converter .cc-table th {
    background: #0a0a0a;
    color: #FFD700;
    font-weight: 700;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.ffe-converter .cc-table td {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #fff;
    background: transparent;
}
.ffe-converter .cc-table tr:hover td {
    background: rgba(255, 215, 0, 0.04);
}

/* Popular */
.ffe-converter .cc-popular {
    padding: 16px 0;
    margin: 0;
}
.ffe-converter .cc-popular h3 {
    font-size: 18px;
    color: #FFD700;
    margin: 0 0 12px 0;
    padding: 0;
    border: none;
}
.ffe-converter .cc-popular-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
}
.ffe-converter .cc-popular-item {
    padding: 8px 14px;
    margin: 0;
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    line-height: 1.2;
}
.ffe-converter .cc-popular-item:hover {
    border-color: #FFD700;
    background: rgba(255, 215, 0, 0.06);
    color: #FFD700;
}

/* Currency Picker Modal
   NOTE: .cc-picker uses `position:fixed` + full-viewport coordinates,
   so page wrappers cannot affect it visually. However, the inner
   selectors still need the .ffe-converter prefix because the modal
   is rendered inside the wrapper element. */
.ffe-converter .cc-picker {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}
.ffe-converter .cc-picker-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}
.ffe-converter .cc-picker-panel {
    position: relative;
    width: 90%;
    max-width: 480px;
    max-height: 80vh;
    background: #1a1a1a;
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1;
    margin: 0;
    padding: 0;
}
.ffe-converter .cc-picker-header {
    display: flex;
    gap: 8px;
    padding: 16px;
    margin: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.ffe-converter .cc-picker-search {
    flex: 1;
    padding: 12px 16px;
    margin: 0;
    background: #0a0a0a;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 16px;
    outline: none;
}
.ffe-converter .cc-picker-search:focus {
    border-color: #FFD700;
}
.ffe-converter .cc-picker-search::placeholder {
    color: rgba(255, 255, 255, 0.4);
}
.ffe-converter .cc-picker-close {
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    margin: 0;
}
.ffe-converter .cc-picker-close:hover {
    background: rgba(255, 82, 82, 0.3);
}
.ffe-converter .cc-picker-list {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px;
    margin: 0;
    flex: 1;
}
.ffe-converter .cc-picker-section {
    padding: 8px 12px;
    margin: 0;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 215, 0, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.ffe-converter .cc-picker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}
.ffe-converter .cc-picker-item:hover {
    background: rgba(255, 255, 255, 0.06);
}
.ffe-converter .cc-picker-item--active {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
}
.ffe-converter .cc-picker-item .cc-logo,
.ffe-converter .cc-picker-item .cc-flag {
    width: 32px;
    height: 32px;
    font-size: 28px;
}
.ffe-converter .cc-picker-item-code {
    font-weight: 700;
    min-width: 50px;
}
.ffe-converter .cc-picker-item-name {
    color: rgba(255, 255, 255, 0.6);
}

/* Loading
   These BEM children sit inside the root .ffe-converter element,
   which is rendered by class-crypto-converter.php before the JS has
   a chance to replace the innerHTML with the full widget. The
   prefix gives them defensive specificity matching everything else. */
.ffe-converter .ffe-converter__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    margin: 0;
    padding: 0;
}
.ffe-converter .ffe-converter__spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 215, 0, 0.2);
    border-top-color: #FFD700;
    border-radius: 50%;
    animation: cc-spin 0.8s linear infinite;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
@keyframes cc-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive — mobile
   The .ffe-converter prefix also applies inside media queries. */
@media (max-width: 640px) {
    .ffe-converter .cc-widget {
        padding: 20px;
    }
    .ffe-converter .cc-row {
        flex-direction: column;
        gap: 12px;
    }
    .ffe-converter .cc-swap-btn {
        margin: 0 auto;
        transform: rotate(90deg);
        align-self: center;
    }
    .ffe-converter .cc-swap-btn:hover {
        transform: rotate(270deg);
    }
    .ffe-converter .cc-amount-input,
    .ffe-converter .cc-result-input {
        font-size: 22px;
        padding: 14px;
        min-height: 56px;
    }
    .ffe-converter .cc-cta-btn {
        padding: 14px 28px;
        font-size: 16px;
    }
    .ffe-converter .cc-picker-panel {
        width: 95%;
        max-height: 85vh;
    }
}
