/**
 * Melt Value Calculator — Design System
 * Fonts: Montserrat 700/900 (labels · tabs · buttons · headings)
 *        Roboto 400/700 (body · values · inputs)
 *
 * Color tokens
 *   #0A0A0A  background dark / results panel
 *   #1A1A1A  surface / dividers
 *   #D4AF37  gold primary (melt value · active buttons)
 *   #C9A227  gold dark
 *   #C0C0C0  silver text / focus ring
 *   #A8A8A8  muted text (result labels)
 */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@700;900&family=Roboto:wght@400;700&display=swap');

/* ── Outer block wrapper — hard horizontal boundary ─────────── */
.wp-block-metal-calculator-melt-calculator {
    overflow-x: hidden;
    max-width: 100%;
}

/* ── Card Shell ─────────────────────────────────────────────── */
.melt-calculator-wrapper {
    max-width: 800px;
    margin: 30px auto;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(192, 192, 192, 0.2);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    font-family: Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
    transition: min-height 0.35s ease;
}

/* ── Live Price Strip ───────────────────────────────────────── */
.live-price-strip {
    background-color: #0A0A0A;
    background-image: linear-gradient(90deg, transparent 0%, transparent 40%, rgba(212, 175, 55, 0.06) 50%, transparent 60%, transparent 100%);
    background-size: 400% 100%;
    background-position: 100% 0;
    animation: mvc-price-shine 4s ease-in-out infinite;
    padding: 18px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(192, 192, 192, 0.1);
    position: relative;
    overflow: hidden;
}

@keyframes mvc-price-shine {
    0%, 100% { background-position: 100% 0; }
    50%       { background-position: 0% 0; }
}

.live-price-strip .price-label {
    font-family: Montserrat, sans-serif;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #A8A8A8;
    margin-bottom: 6px;
}

.live-price-strip .price-value {
    font-family: Montserrat, sans-serif;
    font-size: 28px;
    font-weight: 900;
    color: #D4AF37;
    margin-bottom: 4px;
}

.live-price-strip .price-timestamp {
    font-family: Roboto, sans-serif;
    font-size: 11px;
    color: #A8A8A8;
}

/* ── Card Body — Brushed Silver ─────────────────────────────── */
.melt-calculator-form {
    background: linear-gradient(
        160deg,
        #E2E2E0 0%,
        #D0D0CE 18%,
        #DCDCDA 34%,
        #C8C8C6 50%,
        #D8D8D6 66%,
        #CACAC8 82%,
        #E0E0DE 100%
    );
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.calculator-heading {
    font-family: Montserrat, sans-serif;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #1A1A1A;
    text-align: center;
    margin: 20px 0 0;
    padding: 0 20px;
}

/* ── Tab Navigation ─────────────────────────────────────────── */
.calc-tabs {
    display: flex;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 0;
}

.calc-tabs::-webkit-scrollbar {
    display: none;
}

.calc-tab-btn {
    flex: 1;
    padding: 10px 4px;
    background: none;
    border: none;
    font-family: Montserrat, sans-serif;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #888888;
    cursor: pointer;
    white-space: nowrap;
}

.calc-tab-btn:hover {
    color: #888888;
}

.calc-tab-btn.active,
.calc-tab-btn.active:hover {
    color: #1A1A1A;
}

/* ── Tab Panels ─────────────────────────────────────────────── */
.calc-tab-panel {
    padding: 20px 20px 20px;
    /* display: none / block toggled via JS */
}

/* ── Form Grid ──────────────────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

/* ── Field Labels ───────────────────────────────────────────── */
.form-group label {
    font-family: Montserrat, sans-serif;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #1A1A1A;
    margin-bottom: 6px;
    display: block;
}

/* ── Form Inputs & Selects ──────────────────────────────────── */
.form-input,
.form-select {
    background: #ffffff;
    color: #0A0A0A;
    border: 2px solid rgba(0, 0, 0, 0.14);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: Roboto, sans-serif;
    width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    box-shadow: 0 0 0 1px #C0C0C0;
    border-color: #C0C0C0;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231A1A1A' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-select optgroup {
    font-weight: 700;
    font-style: normal;
    color: #1A1A1A;
}

/* ── Custom Purity Group ────────────────────────────────────── */
.custom-purity-group {
    grid-column: span 2;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding-top: 14px;
    margin-top: 4px;
}

.purity-hint {
    display: block;
    font-size: 11px;
    color: #555555;
    font-family: Roboto, sans-serif;
    margin-top: 5px;
}

/* ── Quick Preset Buttons — Weight tab (light, pill style) ──── */
.quick-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.quick-btn,
.quick-face-btn,
.quick-coin-face-btn {
    background: #FFF9F0;
    color: #0A0A0A;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 999px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 700;
    font-family: Montserrat, sans-serif;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.quick-btn:hover,
.quick-face-btn:hover,
.quick-coin-face-btn:hover {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.18);
}

.quick-btn:active,
.quick-face-btn:active,
.quick-coin-face-btn:active {
    background: #0A0A0A;
    color: #D4AF37;
    border-color: #0A0A0A;
}

/* ── Advanced Mode Toggle ───────────────────────────────────── */
.advanced-mode-wrap {
    text-align: center;
    margin: 0 0 14px;
}

.advanced-mode-wrap + .quick-buttons {
    padding-top: 14px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.advanced-toggle-btn {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: #555555;
    font-family: Montserrat, sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 5px 16px;
    border-radius: 999px;
    transition: background 0.2s ease, color 0.2s ease;
}

.advanced-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #1A1A1A;
}

/* ── Results Panel — Dark ───────────────────────────────────── */
.results-section {
    background: #0A0A0A;
    border-radius: 8px;
    overflow: hidden;
    padding: 0;
    border: none;
    margin-top: 4px;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
}

.result-row + .result-row {
    border-top: 1px solid #1E1E1E;
}

.result-label {
    color: #A8A8A8;
    font-size: 12px;
    font-weight: 400;
    font-family: Roboto, sans-serif;
}

.result-value {
    color: #E0E0E0;
    font-size: 14px;
    font-weight: 700;
    font-family: Roboto, sans-serif;
}

/* Melt Value — primary row */
.result-row.primary-result {
    padding: 16px;
    border-top: 1px solid #1E1E1E;
    margin-top: 0;
}

.primary-result .result-label {
    color: #A8A8A8;
    font-size: 14px;
    font-weight: 700;
    font-family: Roboto, sans-serif;
}

.primary-result .result-value {
    color: #D4AF37;
    font-size: 24px;
    font-weight: 900;
    font-family: Montserrat, sans-serif;
}

.result-value.updated {
    animation: mvc-pulse 0.3s ease;
}

@keyframes mvc-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

/* ── Disclaimer / Info Note ─────────────────────────────────── */
.disclaimer,
.info-note {
    margin: 12px 20px 20px;
    border-radius: 8px;
    padding: 12px 16px;
    background: rgba(212, 175, 55, 0.07);
    border: 1px solid rgba(212, 175, 55, 0.22);
    font-size: 11px;
    line-height: 1.6;
    color: #9A8040;
    font-family: Roboto, sans-serif;
}

.info-note strong {
    color: #9A8040;
    font-weight: 700;
}

/* ── Copy Results Button ────────────────────────────────────── */
.copy-results-wrap {
    text-align: center;
    padding: 14px 20px 20px;
}

.copy-results-btn {
    background: #ffffff;
    color: #1E1E1E;
    border: none;
    border-radius: 999px;
    font-family: Montserrat, sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 7px 22px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.copy-results-btn:hover,
.copy-results-btn:active,
.copy-results-btn--copied {
    background: #1A1A1A;
    color: #D4AF37;
}

/* ── Mobile — 768px ─────────────────────────────────────────── */
@media (max-width: 768px) {
    .melt-calculator-wrapper {
        margin: 16px 10px;
    }

    /* Prevent iOS auto-zoom on input focus (triggers when font-size < 16px) */
    .melt-calculator-wrapper input,
    .melt-calculator-wrapper select,
    .form-input,
    .form-select {
        font-size: 16px !important;
    }

    .live-price-strip .price-value {
        font-size: 22px;
    }

    .calc-tab-btn {
        font-size: 8px;
        padding: 10px 3px;
        letter-spacing: 0.05em;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .custom-purity-group {
        grid-column: span 1;
    }

    .quick-buttons {
        gap: 6px;
    }

    .quick-btn,
    .quick-face-btn,
    .quick-coin-face-btn {
        flex: 1 1 calc(50% - 3px);
        min-width: 80px;
        text-align: center;
    }

    .result-row {
        padding: 10px 14px;
    }

    .primary-result .result-value {
        font-size: 20px;
    }
}

/* ── Mobile — 480px ─────────────────────────────────────────── */
@media (max-width: 480px) {
    .calc-tab-btn {
        font-size: 7px;
        letter-spacing: 0.04em;
    }

    .calc-tab-panel {
        padding: 16px 14px 16px;
    }

    .melt-calculator-wrapper input,
    .melt-calculator-wrapper select,
    .form-input,
    .form-select {
        padding: 9px 10px;
        font-size: 16px !important;
    }

    .result-label {
        font-size: 11px;
    }

    .result-value {
        font-size: 13px;
    }

    .primary-result .result-label {
        font-size: 12px;
    }

    .primary-result .result-value {
        font-size: 18px;
    }
}
