/* ============================================================
   Games Field Manager — Frontend Styles
   Brand: dark background · lime-green (#a3ff12) accents
   ============================================================ */

/* ── Card wrapper ───────────────────────────────────────── */
.gfm-field-card {
    background: #0d1117;
    border: 1px solid #1e2433;
    border-radius: 14px;
    margin: 24px 0 20px;
    overflow: hidden;
    box-shadow: 0 4px 32px rgba(0, 0, 0, .45),
                0 0 0 1px rgba(163, 255, 18, .06);
    font-family: inherit;
    animation: gfm-slide-in .3s ease;
}

@keyframes gfm-slide-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0);   }
}

/* ── Card header ────────────────────────────────────────── */
.gfm-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #111827 0%, #0d1117 100%);
    border-bottom: 1px solid #1e2433;
    position: relative;
}

/* Animated top border */
.gfm-card-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, #a3ff12, #39ff14, #76ff03, #a3ff12);
    background-size: 200% 100%;
    animation: gfm-shimmer 2.5s linear infinite;
}

@keyframes gfm-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.gfm-card-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.gfm-card-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.gfm-card-game {
    font-size: 15px;
    font-weight: 700;
    color: #f9fafb;
    line-height: 1.2;
}

.gfm-card-subtitle {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.3;
}

.gfm-secure-badge {
    font-size: 11px;
    font-weight: 600;
    color: #a3ff12;
    background: rgba(163, 255, 18, .08);
    border: 1px solid rgba(163, 255, 18, .2);
    padding: 4px 10px;
    border-radius: 20px;
    flex-shrink: 0;
    letter-spacing: .03em;
}

/* ── Fields body ────────────────────────────────────────── */
.gfm-fields-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ── Field row ──────────────────────────────────────────── */
.gfm-field-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gfm-label {
    font-size: 12px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .06em;
    display: flex;
    align-items: center;
    gap: 4px;
}

.gfm-asterisk {
    color: #f87171;
    font-size: 14px;
    line-height: 1;
}

/* ── Input ──────────────────────────────────────────────── */
.gfm-input {
    width: 100%;
    box-sizing: border-box;
    background: #111827 !important;
    border: 1px solid #2a3244 !important;
    border-radius: 8px !important;
    color: #f9fafb !important;
    font-size: 15px !important;
    padding: 12px 16px !important;
    line-height: 1.4 !important;
    outline: none !important;
    transition: border-color .2s, box-shadow .2s;
    -webkit-appearance: none;
    appearance: none;
}

.gfm-input::placeholder {
    color: #4b5563 !important;
}

.gfm-input:focus {
    border-color: #a3ff12 !important;
    box-shadow: 0 0 0 3px rgba(163, 255, 18, .12) !important;
}

.gfm-input.gfm-error-state {
    border-color: #f87171 !important;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, .1) !important;
}

.gfm-input.gfm-ok-state {
    border-color: #a3ff12 !important;
}

/* Select */
.gfm-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    padding-right: 36px !important;
}

.gfm-select option {
    background: #111827;
    color: #f9fafb;
}

/* ── Hint text ──────────────────────────────────────────── */
.gfm-hint {
    font-size: 11px;
    color: #4b5563;
    line-height: 1.5;
}

/* ── Field error ────────────────────────────────────────── */
.gfm-field-error {
    font-size: 12px;
    color: #f87171;
    font-weight: 500;
    min-height: 16px;
    display: block;
    line-height: 1.4;
}

/* ── Status bar ─────────────────────────────────────────── */
.gfm-status-bar {
    padding: 12px 20px;
    background: #111827;
    border-top: 1px solid #1e2433;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gfm-status-bar.gfm-status-error {
    background: rgba(248, 113, 113, .07);
    color: #f87171;
    border-top-color: rgba(248, 113, 113, .2);
}

.gfm-status-bar.gfm-status-success {
    background: rgba(163, 255, 18, .06);
    color: #a3ff12;
    border-top-color: rgba(163, 255, 18, .15);
}

.gfm-status-bar.gfm-status-loading {
    color: #9ca3af;
}

/* ── Spinner ────────────────────────────────────────────── */
.gfm-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(163, 255, 18, .2);
    border-top-color: #a3ff12;
    border-radius: 50%;
    animation: gfm-spin .7s linear infinite;
    flex-shrink: 0;
}

@keyframes gfm-spin {
    to { transform: rotate(360deg); }
}

/* ── MLBB / Magic Chess: hide WC quantity + buttons ────── */
/*
 * Applied when body has class .gfm-liana-native
 * (set by GFM_Frontend::add_game_body_class for mobilelegends / magicchess).
 * Liana's own "Continue to Checkout" button inside the popup is unaffected
 * because it is injected by Liana JS and not a WC form element.
 */
body.gfm-liana-native .quantity,
body.gfm-liana-native .single_add_to_cart_button,
body.gfm-liana-native .wc-block-components-quantity-selector,
body.gfm-liana-native a.buy-now,
body.gfm-liana-native .buy-now,
body.gfm-liana-native [class*="buy-now"],
body.gfm-liana-native [class*="buynow"] {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 480px) {
    .gfm-card-header {
        padding: 14px 16px;
    }

    .gfm-fields-body {
        padding: 16px;
        gap: 16px;
    }

    .gfm-card-icon {
        font-size: 22px;
    }

    .gfm-card-game {
        font-size: 14px;
    }

    .gfm-secure-badge {
        display: none; /* declutter on very small screens */
    }

    .gfm-input {
        font-size: 16px !important; /* prevents iOS zoom */
    }
}

/* ── MLBB / Magic Chess: hide WC cart buttons ───────────── */
/*
 * Applied when body has class .gfm-liana-native (injected by GFM_Frontend).
 * Hides quantity selector, Add to Cart button, and any Buy Now button
 * rendered by the theme or WC. The Liana "Continue to Checkout" popup
 * button is unaffected — it lives inside #liana-verification-popup,
 * not in the WC form area.
 */
body.gfm-liana-native .quantity,
body.gfm-liana-native .single_add_to_cart_button,
body.gfm-liana-native .wc-buy-now,
body.gfm-liana-native .buy-now,
body.gfm-liana-native a.buy-now,
body.gfm-liana-native .woocommerce-buy-now,
body.gfm-liana-native [class*="buy-now"],
body.gfm-liana-native [class*="buynow"] {
    display: none !important;
}
