/* ==========================================================================
   G2 Rifle Builder - Frontend Styles
   ========================================================================== */

/* ---------- CSS Custom Properties ---------- */
:root {
    --g2rb-bg: #f4f2ed;
    --g2rb-card-bg: #ffffff;
    --g2rb-text: #1f1913;
    --g2rb-text-muted: #7b7773;
    --g2rb-border: #e0ddd8;
    --g2rb-accent: #d70000;
    --g2rb-accent-hover: #b50000;
    --g2rb-success: #2d7d3a;
    --g2rb-price: #1f1913;
    --g2rb-strike: #999;
    --g2rb-save: #2d7d3a;
    --g2rb-gear-bg: #ffffff;
    --g2rb-gear-border: #e8e6e2;
    --g2rb-step-bg: #f0ede8;
    --g2rb-step-active-bg: #d70000;
    --g2rb-step-active-text: #ffffff;
    --g2rb-step-done-bg: #9B4450;
    --g2rb-step-done-border: #C49A5C;
    --g2rb-shadow: 0 2px 8px rgba(0,0,0,0.08);
    --g2rb-shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --g2rb-radius: 8px;
    --g2rb-radius-sm: 4px;
    --g2rb-font: inherit;
}

.g2rb-dark {
    --g2rb-bg: #18120b;
    --g2rb-card-bg: #261e15;
    --g2rb-text: #f4f2ed;
    --g2rb-text-muted: #8e8b87;
    --g2rb-border: #3a3228;
    --g2rb-accent: #d70000;
    --g2rb-accent-hover: #ff1a1a;
    --g2rb-success: #4caf50;
    --g2rb-price: #f4f2ed;
    --g2rb-strike: #8e8b87;
    --g2rb-save: #4caf50;
    --g2rb-gear-bg: #1f1913;
    --g2rb-gear-border: #3a3228;
    --g2rb-step-bg: #2a2118;
    --g2rb-step-active-bg: #d70000;
    --g2rb-step-active-text: #ffffff;
    --g2rb-step-done-bg: #9B4450;
    --g2rb-step-done-border: #C49A5C;
    --g2rb-shadow: 0 2px 8px rgba(0,0,0,0.3);
    --g2rb-shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
}

/* ---------- Builder Container ---------- */
.g2rb-builder {
    font-family: var(--g2rb-font);
    color: var(--g2rb-text);
    background: var(--g2rb-bg);
    padding: 24px;
    border-radius: var(--g2rb-radius);
    max-width: 1440px;
    margin: 0 auto;
    line-height: 1.5;
}

.g2rb-builder *,
.g2rb-builder *::before,
.g2rb-builder *::after {
    box-sizing: border-box;
}

/* ---------- Layout ---------- */
.g2rb-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
    align-items: start;
}

.g2rb-build-panel {
    position: sticky;
    top: 24px;
}

/* ---------- Step Navigation ---------- */
.g2rb-step-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
    padding: 0;
}

.g2rb-step-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: 2px solid var(--g2rb-border);
    border-radius: var(--g2rb-radius);
    background: var(--g2rb-step-bg);
    color: var(--g2rb-text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}

.g2rb-step-tab:hover {
    border-color: var(--g2rb-accent);
    background: var(--g2rb-card-bg);
}

.g2rb-step-tab.g2rb-active {
    background: var(--g2rb-step-active-bg);
    color: var(--g2rb-step-active-text);
    border-color: var(--g2rb-step-active-bg);
}

/* Completed step: rose fill with golden border ring */
.g2rb-step-tab.g2rb-step-done {
    background: var(--g2rb-step-done-bg);
    color: #ffffff;
    border-color: var(--g2rb-step-done-border);
}

.g2rb-step-tab.g2rb-step-done .g2rb-step-check {
    color: #ffffff;
}

.g2rb-step-tab.g2rb-step-done .g2rb-step-number {
    background: rgba(255,255,255,0.25);
}

.g2rb-step-tab.g2rb-step-done .g2rb-step-required {
    color: #ffffff;
}

/* Active + done: red overrides green */
.g2rb-step-tab.g2rb-active.g2rb-step-done {
    background: var(--g2rb-step-active-bg);
    color: var(--g2rb-step-active-text);
    border-color: var(--g2rb-step-active-bg);
}

.g2rb-step-tab.g2rb-active.g2rb-step-done .g2rb-step-check {
    color: var(--g2rb-step-active-text);
}

.g2rb-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0,0,0,0.1);
    font-size: 11px;
    font-weight: 700;
}

.g2rb-step-tab.g2rb-active .g2rb-step-number {
    background: rgba(255,255,255,0.25);
}

.g2rb-step-check {
    font-size: 14px;
    font-weight: 700;
}

.g2rb-step-required {
    color: var(--g2rb-accent);
    font-weight: 700;
    font-size: 16px;
    line-height: 1;
}

.g2rb-step-tab.g2rb-active .g2rb-step-required {
    color: var(--g2rb-step-active-text);
}

/* ---------- Search Bar ---------- */
.g2rb-search-bar {
    margin-bottom: 16px;
}

.g2rb-search-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--g2rb-border);
    border-radius: var(--g2rb-radius);
    background: var(--g2rb-card-bg);
    color: var(--g2rb-text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

/* Dark theme: off-white background, brighter border */
.g2rb-dark .g2rb-search-input {
    background: #332a20;
    border-color: rgba(255,255,255,0.3);
}

.g2rb-search-input:focus {
    outline: none;
    border-color: var(--g2rb-accent);
}

.g2rb-search-input::placeholder {
    color: var(--g2rb-text-muted);
}

/* ---------- Product Grid ---------- */
.g2rb-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    min-height: 200px;
}

.g2rb-loading,
.g2rb-no-products,
.g2rb-error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--g2rb-text-muted);
    font-size: 14px;
}

/* ---------- Product Card ---------- */
.g2rb-product-card {
    background: var(--g2rb-card-bg);
    border: 2px solid var(--g2rb-border);
    border-radius: var(--g2rb-radius);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.g2rb-product-card:hover {
    border-color: var(--g2rb-accent);
    box-shadow: var(--g2rb-shadow);
    transform: translateY(-2px);
}

.g2rb-product-card.g2rb-selected {
    border-color: var(--g2rb-accent);
    box-shadow: 0 0 0 3px rgba(215, 0, 0, 0.15);
}

/* Included item card: green accent border */
.g2rb-product-card.g2rb-included-item {
    border-color: var(--g2rb-success);
    box-shadow: 0 0 0 3px rgba(45, 125, 58, 0.15);
}

/* Default included product card: subtle highlight */
.g2rb-product-card.g2rb-is-default-included {
    position: relative;
}

.g2rb-product-image {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Product info button (opens WooCommerce product page) */
.g2rb-product-info-btn {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 5;
    width: 24px;
    height: 24px;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.15s;
    line-height: 0;
    display: block;
}

.g2rb-product-info-btn:hover {
    opacity: 1;
    transform: scale(1.15);
}

.g2rb-product-info-btn img {
    width: 24px;
    height: 24px;
    display: block;
    mix-blend-mode: normal !important;
    padding: 0 !important;
    object-fit: contain;
}

.g2rb-product-image > img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}

/* "Included with rifle" overlay badge on product image */
.g2rb-included-default-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(45, 125, 58, 0.92);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    padding: 4px 8px;
}

.g2rb-product-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.g2rb-product-name {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 6px;
    line-height: 1.3;
    color: var(--g2rb-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.g2rb-product-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--g2rb-accent);
    margin: 0 0 10px;
}

/* Upgrade price display: "+$300" styling */
.g2rb-upgrade-price {
    color: var(--g2rb-accent);
    font-weight: 700;
    font-size: 15px;
}

.g2rb-variation-select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--g2rb-border);
    border-radius: var(--g2rb-radius-sm);
    background: var(--g2rb-card-bg);
    color: var(--g2rb-text);
    font-size: 12px;
    font-family: inherit;
    margin-bottom: 8px;
}

.g2rb-variation-select.g2rb-flash {
    animation: g2rb-flash 0.6s ease;
}

@keyframes g2rb-flash {
    0%, 100% { border-color: var(--g2rb-border); }
    50% { border-color: var(--g2rb-accent); box-shadow: 0 0 0 2px rgba(215, 0, 0, 0.2); }
}

/* ---------- Add to Build Button ---------- */
.g2rb-btn-add {
    margin-top: auto;
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--g2rb-accent);
    border-radius: var(--g2rb-radius-sm);
    background: transparent;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s;
}

.g2rb-btn-add:hover:not(:disabled) {
    background: var(--g2rb-accent);
    color: #fff;
}

.g2rb-btn-add:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Selected state: solid red fill */
.g2rb-product-card.g2rb-selected .g2rb-btn-add,
.g2rb-btn-add.g2rb-btn-remove {
    background: var(--g2rb-accent);
    color: #fff;
}

/* Included item button: green fill */
.g2rb-product-card.g2rb-included-item .g2rb-btn-add {
    background: var(--g2rb-success);
    border-color: var(--g2rb-success);
    color: #fff;
}

/* Light theme: dark text on transparent button */
:root .g2rb-btn-add {
    color: var(--g2rb-accent);
}
:root .g2rb-btn-add:hover:not(:disabled) {
    color: #fff;
}

/* Dark theme: white text on transparent button */
.g2rb-dark .g2rb-btn-add {
    color: #ffffff;
}
.g2rb-dark .g2rb-btn-add:hover:not(:disabled) {
    color: #fff;
}

/* ---------- Quantity Controls (multi-item steps) ---------- */
.g2rb-qty-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 8px;
    border: 2px solid var(--g2rb-border);
    border-radius: var(--g2rb-radius-sm);
    overflow: hidden;
}

.g2rb-qty-btn {
    width: 36px;
    height: 32px;
    border: none;
    background: var(--g2rb-step-bg);
    color: var(--g2rb-text);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.g2rb-qty-btn:hover:not(:disabled) {
    background: var(--g2rb-accent);
    color: #fff;
}

.g2rb-qty-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.g2rb-qty-value {
    min-width: 36px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--g2rb-text);
    padding: 0 4px;
}

/* ---------- Included / No-Cost Preference Items ---------- */
.g2rb-included-badge {
    display: inline-block;
    background: var(--g2rb-success);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.g2rb-product-card.g2rb-no-cost .g2rb-product-price {
    color: var(--g2rb-success);
}

.g2rb-included-label {
    color: var(--g2rb-accent);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Upgrade label in summary: "+$300" */
.g2rb-upgrade-label {
    color: var(--g2rb-accent);
    font-weight: 700;
    font-size: 13px;
}

.g2rb-summary-item.g2rb-summary-included {
    opacity: 0.8;
}

.g2rb-summary-item.g2rb-summary-upgrade .g2rb-summary-item-step::after {
    content: ' (upgrade)';
    font-weight: 400;
    text-transform: none;
}

/* ---------- Pagination ---------- */
.g2rb-pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 16px;
}

.g2rb-page-btn {
    width: 36px;
    height: 36px;
    border: 2px solid var(--g2rb-border);
    border-radius: var(--g2rb-radius-sm);
    background: var(--g2rb-card-bg);
    color: var(--g2rb-text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.g2rb-page-btn:hover {
    border-color: var(--g2rb-accent);
}

.g2rb-page-btn.g2rb-page-active {
    background: var(--g2rb-accent);
    color: #fff;
    border-color: var(--g2rb-accent);
}

/* ==========================================================================
   Gear Layout - Flat-Lay / Knolling Style
   ========================================================================== */
.g2rb-gear-layout {
    background: var(--g2rb-card-bg);
    border: 2px solid var(--g2rb-gear-border);
    border-radius: var(--g2rb-radius);
    overflow: hidden;
    margin-bottom: 16px;
}

.g2rb-gear-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    padding: 12px 16px;
    border-bottom: 1px solid var(--g2rb-gear-border);
    color: var(--g2rb-text-muted);
}

.g2rb-gear-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    padding: 16px;
    min-height: 240px;
    background: #ffffff;
}

.g2rb-dark .g2rb-gear-grid {
    background: #1f1913;
}

.g2rb-gear-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    color: var(--g2rb-text-muted);
}

.g2rb-gear-icon {
    opacity: 0.3;
    margin-bottom: 12px;
}

.g2rb-gear-empty p {
    margin: 0 0 4px;
    font-size: 14px;
}

.g2rb-gear-hint {
    font-size: 12px !important;
    opacity: 0.7;
}

/* Gear Items - Knolling positions (borderless for clean flat-lay) */
.g2rb-gear-item {
    position: relative;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    animation: g2rb-fadeIn 0.3s ease;
    transition: opacity 0.2s;
}

@keyframes g2rb-fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.g2rb-dark .g2rb-gear-item {
    background: transparent;
}

.g2rb-gear-item:hover {
    opacity: 0.85;
}

/* Base rifle takes full width (centerpiece of the flat-lay) */
.g2rb-gear-item[data-step="base-rifle"] {
    grid-column: 1 / -1;
}

/* Optic spans 2 columns */
.g2rb-gear-item[data-step="optic"] {
    grid-column: span 2;
}

/* Responsive gear images - scale with viewport, sit directly on background */
.g2rb-gear-item img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    mix-blend-mode: multiply;
}

/* Dark theme: use normal blending since background is dark */
.g2rb-dark .g2rb-gear-item img {
    mix-blend-mode: normal;
}

.g2rb-gear-item[data-step="base-rifle"] img {
    max-height: 28vw;
}

.g2rb-gear-item:not([data-step="base-rifle"]) img {
    max-height: 18vw;
}

/* Absolute caps for large screens */
@media (min-width: 1200px) {
    .g2rb-gear-item[data-step="base-rifle"] img {
        max-height: 120px;
    }
    .g2rb-gear-item:not([data-step="base-rifle"]) img {
        max-height: 90px;
    }
}

.g2rb-gear-label {
    display: block;
    font-size: 9px;
    font-weight: 600;
    text-align: center;
    margin-top: 4px;
    color: var(--g2rb-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* "Included" tag on gear items in flat-lay */
.g2rb-gear-included-tag {
    display: inline-block;
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--g2rb-success);
    margin-top: 1px;
}

/* Included gear items: subtle green tint on label */
.g2rb-gear-item.g2rb-gear-included .g2rb-gear-label {
    color: var(--g2rb-success);
}

.g2rb-gear-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: rgba(215, 0, 0, 0.9);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.g2rb-gear-item:hover .g2rb-gear-remove {
    opacity: 1;
}

/* ==========================================================================
   Build Summary
   ========================================================================== */
.g2rb-summary {
    background: var(--g2rb-card-bg);
    border: 2px solid var(--g2rb-border);
    border-radius: var(--g2rb-radius);
    overflow: hidden;
}

.g2rb-summary-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    padding: 12px 16px;
    border-bottom: 1px solid var(--g2rb-border);
    color: var(--g2rb-text-muted);
}

.g2rb-summary-items {
    padding: 12px 16px;
    max-height: 250px;
    overflow-y: auto;
}

.g2rb-summary-empty {
    text-align: center;
    color: var(--g2rb-text-muted);
    font-size: 13px;
    padding: 12px 0;
    margin: 0;
}

.g2rb-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 6px 0;
    border-bottom: 1px solid var(--g2rb-border);
    gap: 8px;
}

.g2rb-summary-item:last-child {
    border-bottom: none;
}

.g2rb-summary-item-step {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--g2rb-text-muted);
    letter-spacing: 0.5px;
}

.g2rb-summary-item-name {
    font-size: 13px;
    font-weight: 500;
    flex: 1;
    line-height: 1.3;
}

.g2rb-summary-item-price {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

/* Totals */
.g2rb-summary-totals {
    padding: 12px 16px;
    border-top: 2px solid var(--g2rb-border);
    background: var(--g2rb-step-bg);
}

.g2rb-total-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}

.g2rb-total-row.g2rb-total-final {
    padding-top: 8px;
    margin-top: 4px;
    border-top: 1px solid var(--g2rb-border);
    font-size: 18px;
    font-weight: 700;
}

.g2rb-strikethrough {
    text-decoration: line-through;
    color: var(--g2rb-strike);
}

.g2rb-price-save {
    color: var(--g2rb-save);
    font-weight: 600;
}

.g2rb-price-final {
    color: var(--g2rb-accent);
}

/* Action Buttons */
.g2rb-summary-actions {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.g2rb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border: 2px solid transparent;
    border-radius: var(--g2rb-radius-sm);
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    transition: all 0.2s;
    text-decoration: none;
}

.g2rb-btn-primary {
    background: var(--g2rb-accent);
    color: #fff;
    border-color: var(--g2rb-accent);
}

.g2rb-btn-primary:hover:not(:disabled) {
    background: var(--g2rb-accent-hover);
    border-color: var(--g2rb-accent-hover);
}

.g2rb-btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.g2rb-btn-secondary {
    background: transparent;
    color: var(--g2rb-text);
    border-color: var(--g2rb-border);
}

.g2rb-btn-secondary:hover {
    border-color: var(--g2rb-text);
}

.g2rb-btn-full {
    width: 100%;
}

/* ==========================================================================
   Quote Modal
   ========================================================================== */
.g2rb-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.g2rb-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.g2rb-modal-content {
    position: relative;
    background: var(--g2rb-card-bg);
    border-radius: var(--g2rb-radius);
    padding: 32px;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--g2rb-shadow-lg);
}

.g2rb-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--g2rb-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    font-family: inherit;
}

.g2rb-modal-close:hover {
    color: var(--g2rb-text);
}

#g2rb-quote-title {
    font-size: 22px;
    margin: 0 0 4px;
}

.g2rb-modal-desc {
    color: var(--g2rb-text-muted);
    margin: 0 0 20px;
    font-size: 14px;
}

.g2rb-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.g2rb-form-field {
    margin-bottom: 14px;
}

.g2rb-form-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--g2rb-text);
}

.g2rb-required {
    color: var(--g2rb-accent);
}

.g2rb-form-field input,
.g2rb-form-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--g2rb-border);
    border-radius: var(--g2rb-radius-sm);
    background: var(--g2rb-bg);
    color: var(--g2rb-text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.g2rb-form-field input:focus,
.g2rb-form-field textarea:focus {
    outline: none;
    border-color: var(--g2rb-accent);
}

.g2rb-form-field textarea {
    resize: vertical;
}

/* Quote Build Summary in Modal */
.g2rb-quote-summary {
    background: var(--g2rb-step-bg);
    border-radius: var(--g2rb-radius-sm);
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 13px;
}

.g2rb-quote-summary h4 {
    margin: 0 0 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--g2rb-text-muted);
}

.g2rb-quote-summary ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.g2rb-quote-summary li {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
}

.g2rb-quote-summary .g2rb-quote-total {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--g2rb-border);
    font-weight: 700;
}

/* Quote Success */
.g2rb-quote-success {
    text-align: center;
    padding: 20px;
}

.g2rb-quote-success svg {
    color: var(--g2rb-success);
    margin-bottom: 12px;
}

.g2rb-quote-success h4 {
    font-size: 20px;
    margin: 0 0 8px;
}

.g2rb-quote-success p {
    color: var(--g2rb-text-muted);
    margin: 0;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Tablet */
@media (max-width: 1024px) {
    .g2rb-layout {
        grid-template-columns: 1fr;
    }

    .g2rb-build-panel {
        position: static;
    }

    .g2rb-gear-grid {
        min-height: 180px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .g2rb-builder {
        padding: 12px;
    }

    .g2rb-step-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }

    .g2rb-step-nav::-webkit-scrollbar {
        display: none;
    }

    .g2rb-step-tab {
        flex-shrink: 0;
        padding: 8px 12px;
        font-size: 12px;
    }

    /* ---- Mobile Product Grid: compact 2x2 boxes ----
       Goal: 4 products fit in the space 1 desktop card takes.
       Cards use horizontal layout (image left, info right) to save vertical space. */
    .g2rb-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .g2rb-product-card {
        border-width: 1px;
        border-radius: 5px;
        flex-direction: row; /* horizontal card layout */
    }

    /* Small fixed-size thumbnail on the left */
    .g2rb-product-image {
        aspect-ratio: 1;
        width: 72px;
        min-width: 72px;
        max-width: 72px;
    }

    .g2rb-product-image > img {
        padding: 4px;
    }

    /* Product info button: tiny on mobile */
    .g2rb-product-info-btn {
        width: 14px;
        height: 14px;
        top: 2px;
        left: 2px;
    }

    .g2rb-product-info-btn img {
        width: 14px;
        height: 14px;
    }

    /* "Included with rifle" badge: tiny */
    .g2rb-included-default-badge {
        font-size: 6px;
        padding: 1px 3px;
        letter-spacing: 0.2px;
    }

    /* Compact info area beside image */
    .g2rb-product-info {
        padding: 6px 6px 6px 0;
        justify-content: center;
    }

    /* 1-line truncated name */
    .g2rb-product-name {
        font-size: 10px;
        margin: 0 0 2px;
        -webkit-line-clamp: 2;
        line-height: 1.2;
    }

    .g2rb-product-price {
        font-size: 10px;
        margin: 0 0 3px;
    }

    .g2rb-upgrade-price {
        font-size: 10px;
    }

    .g2rb-included-badge {
        font-size: 8px;
        padding: 1px 4px;
    }

    /* Variation dropdown: compact */
    .g2rb-variation-select {
        padding: 2px 3px;
        font-size: 8px;
        margin-bottom: 3px;
    }

    /* Compact add/remove button */
    .g2rb-btn-add {
        font-size: 8px;
        padding: 3px 4px;
        letter-spacing: 0.2px;
        border-width: 1px;
    }

    /* Quantity controls: compact */
    .g2rb-qty-controls {
        margin-bottom: 3px;
        border-width: 1px;
    }

    .g2rb-qty-btn {
        width: 20px;
        height: 18px;
        font-size: 11px;
    }

    .g2rb-qty-value {
        min-width: 18px;
        font-size: 10px;
    }

    /* ---- Mobile Load More: hide overflow products ---- */
    .g2rb-product-card.g2rb-mobile-hidden {
        display: none;
    }

    /* ---- Gear layout compact ---- */
    .g2rb-gear-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 8px;
        min-height: 120px;
    }

    .g2rb-gear-item[data-step="optic"] {
        grid-column: span 1;
    }

    .g2rb-gear-label {
        font-size: 7px;
    }

    .g2rb-gear-included-tag {
        font-size: 6px;
    }

    /* ---- Summary compact ---- */
    .g2rb-summary-items {
        max-height: 180px;
    }

    /* ---- Modal compact ---- */
    .g2rb-form-row {
        grid-template-columns: 1fr;
    }

    .g2rb-modal-content {
        padding: 20px;
    }

    /* ---- Search bar compact ---- */
    .g2rb-search-input {
        padding: 8px 10px;
        font-size: 13px;
    }

    /* ---- Pagination: hide on mobile (replaced by Load More) ---- */
    .g2rb-pagination {
        display: none;
    }
}

/* ---- Load More Button ---- */
.g2rb-load-more-wrap {
    display: none; /* shown via JS on mobile */
    text-align: center;
    margin-top: 6px;
    grid-column: 1 / -1;
}

.g2rb-load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    border: 1px solid var(--g2rb-accent);
    border-radius: var(--g2rb-radius-sm);
    background: transparent;
    color: var(--g2rb-accent);
    font-size: 10px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: all 0.2s;
}

.g2rb-dark .g2rb-load-more-btn {
    color: #ffffff;
}

.g2rb-load-more-btn:hover {
    background: var(--g2rb-accent);
    color: #fff;
}

.g2rb-load-more-count {
    font-size: 9px;
    font-weight: 400;
    opacity: 0.7;
}

@media (max-width: 768px) {
    .g2rb-load-more-wrap {
        display: block;
    }
}

/* Small Mobile (under 480px): tighter horizontal cards */
@media (max-width: 480px) {
    .g2rb-product-grid {
        gap: 4px;
    }

    .g2rb-product-image {
        width: 60px;
        min-width: 60px;
        max-width: 60px;
    }

    .g2rb-product-image > img {
        padding: 3px;
    }

    .g2rb-product-info {
        padding: 4px 4px 4px 0;
    }

    .g2rb-product-name {
        font-size: 9px;
    }

    .g2rb-product-price {
        font-size: 9px;
        margin: 0 0 2px;
    }

    .g2rb-btn-add {
        font-size: 7px;
        padding: 3px 3px;
    }

    .g2rb-qty-btn {
        width: 18px;
        height: 16px;
        font-size: 10px;
    }

    .g2rb-qty-value {
        min-width: 16px;
        font-size: 9px;
    }
}

/* ==========================================================================
   WooCommerce Cart Bundle Styling
   ========================================================================== */
.g2rb-bundle-item {
    background: rgba(215, 0, 0, 0.02);
}

.g2rb-bundle-included {
    background: rgba(45, 125, 58, 0.04);
}

/* Loading spinner */
.g2rb-loading::after {
    content: '';
    display: block;
    width: 24px;
    height: 24px;
    margin: 8px auto 0;
    border: 3px solid var(--g2rb-border);
    border-top-color: var(--g2rb-accent);
    border-radius: 50%;
    animation: g2rb-spin 0.8s linear infinite;
}

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

/* ==========================================================================
   V3: Price Lock / Hidden Pricing
   ========================================================================== */

/* Price lock notice */
.g2rb-price-lock-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    margin: 16px 0;
    background: rgba(215, 0, 0, 0.08);
    border: 1px solid rgba(215, 0, 0, 0.2);
    border-radius: var(--g2rb-radius);
    color: var(--g2rb-text);
    font-size: 14px;
}

.g2rb-price-lock-notice svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.g2rb-progress-pending {
    color: var(--g2rb-text-muted);
}

.g2rb-progress-complete {
    color: var(--g2rb-success);
    font-weight: 600;
}

/* Hidden price dots in summary */
.g2rb-price-hidden {
    color: var(--g2rb-text-muted);
    letter-spacing: 2px;
}

/* Dark mode adjustments */
.g2rb-dark .g2rb-price-lock-notice {
    background: rgba(215, 0, 0, 0.12);
    border-color: rgba(215, 0, 0, 0.3);
}
