/* ═══════════════════════════════════════════════
 * Nexbuy YMMP Search — Frontend Styles
 * ═══════════════════════════════════════════════ */

/* ─── Reset & Base ─── */
.nexbuy-ymmp-search,
.nexbuy-ymmp-search * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.nexbuy-ymmp-search {
    --nexbuy-primary: #2563eb;
    --nexbuy-primary-hover: color-mix(in srgb, var(--nexbuy-primary) 85%, black);
    --nexbuy-bg: #ffffff;
    --nexbuy-surface: #f8fafc;
    --nexbuy-border: #e2e8f0;
    --nexbuy-text: #1e293b;
    --nexbuy-text-muted: #94a3b8;
    --nexbuy-radius: 10px;
    --nexbuy-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --nexbuy-transition: 180ms ease;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: var(--nexbuy-bg);
    border: 1px solid var(--nexbuy-border);
    border-radius: var(--nexbuy-radius);
    padding: 24px;
    box-shadow: var(--nexbuy-shadow);
    width: 100%;
    max-width: 1000px;
}

/* ─── Dark theme ─── */
.nexbuy-theme-dark {
    --nexbuy-bg: #0f172a;
    --nexbuy-surface: #1e293b;
    --nexbuy-border: #334155;
    --nexbuy-text: #f1f5f9;
    --nexbuy-text-muted: #64748b;
}

/* ─── Field grid ─── */
.nexbuy-fields {
    display: grid;
    gap: 16px;
}

.nexbuy-layout-horizontal .nexbuy-fields {
    grid-template-columns: repeat(4, 1fr);
}

.nexbuy-layout-vertical .nexbuy-fields {
    grid-template-columns: 1fr;
}

.nexbuy-layout-inline .nexbuy-fields {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

@media (max-width: 768px) {
    .nexbuy-layout-horizontal .nexbuy-fields,
    .nexbuy-layout-inline .nexbuy-fields {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .nexbuy-layout-horizontal .nexbuy-fields,
    .nexbuy-layout-inline .nexbuy-fields {
        grid-template-columns: 1fr;
    }
}

/* ─── Labels ─── */
.nexbuy-field {
    position: relative;
}

.nexbuy-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--nexbuy-text);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

/* ─── Selects ─── */
.nexbuy-field select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    padding: 10px 36px 10px 14px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--nexbuy-text);
    background-color: var(--nexbuy-surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M4.427 6.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 6H4.604a.25.25 0 00-.177.427z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    border: 1px solid var(--nexbuy-border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color var(--nexbuy-transition), box-shadow var(--nexbuy-transition);
}

.nexbuy-field select:focus {
    outline: none;
    border-color: var(--nexbuy-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--nexbuy-primary) 20%, transparent);
}

.nexbuy-field select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--nexbuy-surface);
}

.nexbuy-field select.nexbuy-loading {
    color: var(--nexbuy-text-muted);
}

/* ─── Spinner ─── */
.nexbuy-spinner {
    display: none;
    position: absolute;
    right: 12px;
    bottom: 13px;
    width: 16px;
    height: 16px;
    border: 2px solid var(--nexbuy-border);
    border-top-color: var(--nexbuy-primary);
    border-radius: 50%;
    animation: nexbuy-spin 600ms linear infinite;
}

.nexbuy-field.is-loading .nexbuy-spinner {
    display: block;
}

.nexbuy-field.is-loading select {
    background-image: none;
}

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

/* ─── Submit button ─── */
.nexbuy-actions {
    margin-top: 20px;
}

#nexbuy-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    background: var(--nexbuy-primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background var(--nexbuy-transition), opacity var(--nexbuy-transition), transform 80ms ease;
}

#nexbuy-submit:hover:not(:disabled) {
    background: var(--nexbuy-primary-hover);
}

#nexbuy-submit:active:not(:disabled) {
    transform: scale(0.98);
}

#nexbuy-submit:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.nexbuy-btn-icon {
    flex-shrink: 0;
    transition: transform var(--nexbuy-transition);
}

#nexbuy-submit:hover:not(:disabled) .nexbuy-btn-icon {
    transform: translateX(3px);
}
