/* v3.1.1 — Unified Group Buy container (variations form + group buy card + add-to-cart) */
:root {
    --gbc-color-success: #00a32a;
    --gbc-color-warning: #f5b800;
    --gbc-color-danger: #d63638;
    --gbc-color-neutral: #8c8f94;
    --gbc-color-text: #2c3338;
    --gbc-color-text-muted: #646970;
    --gbc-color-bg: #ffffff;
    --gbc-color-bg-alt: #f6f7f7;
    --gbc-color-border: #e5e7eb;
    --gbc-color-accent: #2271b1;
    --gbc-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --gbc-radius: 10px;
}

/* === Unified wrapper === */
.gbc-info-wrapper {
    margin: 20px 0;
    background: var(--gbc-color-bg);
    border: 1px solid var(--gbc-color-border);
    border-radius: var(--gbc-radius);
    padding: 20px;
    box-shadow: var(--gbc-shadow);
}
.gbc-info-wrapper[hidden] { display: none !important; }

/* === Variations form embedded === */
.gbc-info-wrapper form.variations_form {
    margin: 0 0 16px;
}
.gbc-info-wrapper table.variations {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    margin: 0 0 16px;
}
.gbc-info-wrapper table.variations th,
.gbc-info-wrapper table.variations td {
    background: transparent;
    border: none;
    padding: 8px 0;
    vertical-align: middle;
}
.gbc-info-wrapper table.variations label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gbc-color-text);
    margin: 0;
}
.gbc-info-wrapper table.variations select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gbc-color-border);
    border-radius: 6px;
    font-size: 14px;
    background: var(--gbc-color-bg);
    color: var(--gbc-color-text);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%232c3338' stroke-width='2'%3e%3cpath d='M1 1l5 5 5-5'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px;
    padding-right: 38px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.gbc-info-wrapper table.variations select:focus {
    outline: none;
    border-color: var(--gbc-color-accent);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}
.gbc-info-wrapper .reset_variations {
    font-size: 12px;
    color: var(--gbc-color-accent);
    margin-left: 8px;
}

/* Variant description (single_variation_wrap) */
.gbc-info-wrapper .single_variation_wrap {
    margin: 0;
}
.gbc-info-wrapper .woocommerce-variation-description {
    font-size: 14px;
    color: var(--gbc-color-text);
    margin: 0 0 12px;
    line-height: 1.5;
}
.gbc-info-wrapper .woocommerce-variation-price {
    margin: 0 0 12px;
}
.gbc-info-wrapper .woocommerce-variation-price .price {
    font-size: 18px;
    font-weight: 700;
    color: var(--gbc-color-danger);
}
.gbc-info-wrapper .woocommerce-variation-availability {
    font-size: 13px;
    color: var(--gbc-color-text-muted);
    margin: 0 0 12px;
}

/* Quantity + add-to-cart row */
.gbc-info-wrapper .woocommerce-variation-add-to-cart {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin: 12px 0 0;
}
.gbc-info-wrapper .quantity {
    flex: 0 0 auto;
}
.gbc-info-wrapper .quantity input.qty {
    width: 70px;
    height: 46px;
    padding: 0 10px;
    border: 1.5px solid var(--gbc-color-border);
    border-radius: 6px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
}
.gbc-info-wrapper .single_add_to_cart_button,
.gbc-info-wrapper button.single_add_to_cart_button {
    flex: 1 1 auto;
    min-height: 46px;
    padding: 0 24px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0.2px;
    transition: filter 0.2s ease;
}
.gbc-info-wrapper button.single_add_to_cart_button:hover {
    filter: brightness(0.92);
}
.gbc-info-wrapper button.single_add_to_cart_button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Simple mode — ẩn quantity, group buy card, follow row */
.gbc-info-wrapper.gbc-mode-simple .quantity { display: none !important; }
.gbc-info-wrapper.gbc-mode-simple #gbc-variant-info { display: none !important; }

/* Group Buy mode — đảm bảo hiển thị */
.gbc-info-wrapper.gbc-mode-group-buy #gbc-variant-info { display: block; }

/* === Group Buy card (inner) === */
#gbc-variant-info { margin: 0 0 16px; }

.gbc-card {
    background: var(--gbc-color-bg-alt);
    border: 2px solid var(--gbc-color-neutral);
    border-radius: var(--gbc-radius);
    padding: 16px 20px;
    transition: border-color 0.3s ease;
}

.gbc-card--available  { border-color: var(--gbc-color-success); }
.gbc-card--additional { border-color: var(--gbc-color-warning); }
.gbc-card--sold-out   { border-color: var(--gbc-color-danger); }
.gbc-card--ended      { border-color: var(--gbc-color-neutral); opacity: 0.85; }

.gbc-card__head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.gbc-card__icon { font-size: 20px; }
.gbc-card__title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--gbc-color-text);
}

.gbc-badge {
    margin-left: auto;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #fff;
}
.gbc-badge--main       { background: var(--gbc-color-success); }
.gbc-badge--additional { background: var(--gbc-color-warning); color: #2c3338; }
.gbc-badge--sold-out   { background: var(--gbc-color-danger); }
.gbc-badge--ended      { background: var(--gbc-color-neutral); }

.gbc-card__countdown {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 14px;
    color: var(--gbc-color-text-muted);
    font-variant-numeric: tabular-nums;
}
.gbc-countdown__label { font-weight: 500; }
.gbc-countdown__dd,
.gbc-countdown__hh,
.gbc-countdown__mm,
.gbc-countdown__ss {
    font-weight: 600;
    color: var(--gbc-color-text);
}

.gbc-card__progress { margin-bottom: 14px; }

.gbc-progress {
    position: relative;
    background: var(--gbc-color-bg);
    height: 18px;
    border-radius: 9px;
    overflow: hidden;
    border: 1px solid var(--gbc-color-border);
}
.gbc-progress__fill {
    background: linear-gradient(90deg, var(--gbc-color-success) 0%, var(--gbc-color-warning) 70%, var(--gbc-color-danger) 100%);
    height: 100%;
    transition: width 0.4s ease;
}
.gbc-progress__pct {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 700;
    color: var(--gbc-color-text);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}
.gbc-card__slots {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--gbc-color-text-muted);
}

.gbc-card__price {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.gbc-price__current {
    font-size: 22px;
    font-weight: 700;
    color: var(--gbc-color-danger);
}
.gbc-price__after {
    font-size: 14px;
    color: var(--gbc-color-text-muted);
}
.gbc-price__save {
    padding: 2px 8px;
    background: var(--gbc-color-success);
    color: #fff;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.gbc-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--gbc-color-border);
}

.gbc-follow-btn {
    background: transparent;
    border: 1.5px solid var(--gbc-color-accent);
    color: var(--gbc-color-accent);
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.gbc-follow-btn:hover {
    background: var(--gbc-color-accent);
    color: #fff;
}
.gbc-follow-btn[data-following="1"] {
    background: var(--gbc-color-accent);
    color: #fff;
}

.gbc-follow-count {
    font-size: 13px;
    color: var(--gbc-color-text-muted);
}

.gbc-variant-info-placeholder {
    padding: 12px;
    background: var(--gbc-color-bg-alt);
    border-radius: var(--gbc-radius);
}
.gbc-variant-info-placeholder p { margin: 0; color: var(--gbc-color-text-muted); }

@media (max-width: 600px) {
    .gbc-info-wrapper { padding: 14px; }
    .gbc-card { padding: 12px 14px; }
    .gbc-card__countdown { flex-wrap: wrap; }
    .gbc-card__price { flex-direction: column; align-items: flex-start; gap: 4px; }
    .gbc-card__foot { flex-direction: column; align-items: stretch; }
    .gbc-follow-btn { width: 100%; }
    .gbc-info-wrapper .woocommerce-variation-add-to-cart { flex-direction: column; }
    .gbc-info-wrapper .quantity { width: 100%; }
    .gbc-info-wrapper .quantity input.qty { width: 100%; }
}

/* Reset modal */
.gbc-reset-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}
.gbc-reset-modal {
    background: #fff; border-radius: 8px; padding: 24px;
    max-width: 480px; width: 90%;
}
.gbc-reset-modal h2 { margin-top: 0; }
.gbc-reset-modal .gbc-stats { background: #f6f7f7; padding: 12px; border-radius: 6px; margin: 12px 0; }
.gbc-reset-modal label { display: block; margin: 12px 0 4px; font-weight: 500; }
.gbc-reset-modal input { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; }
.gbc-reset-modal .gbc-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* History tab */
.gbc-history-table { width: 100%; border-collapse: collapse; }
.gbc-history-table th, .gbc-history-table td {
    padding: 10px; border-bottom: 1px solid #e5e7eb; text-align: left;
}
.gbc-history-table tr.gbc-row-active { background: #fff7e6; }
.gbc-history-detail {
    background: #f6f7f7; padding: 16px; border-radius: 6px; margin-top: 10px;
}
.gbc-history-empty { color: #646970; font-style: italic; padding: 20px; text-align: center; }

/* v3.1.3: Override GreenShift PriceBox row-reverse trên trang single group_buy.
   GreenShift block "PriceBox" có setting "Change order between prices" — khi BẬT
   sẽ áp dụng flex-direction: row-reverse cho .gspb_price_value, gây ra hiển thị
   range giá ngược thứ tự ($max – $min thay vì $min – $max). CSS file này chỉ
   enqueue khi is_product() + group_buy (xem gbc_enqueue_follow_assets) nên rule
   bên dưới scope tự nhiên về single group_buy page, không leak ra shop / cart. */
.gspb-pricebox .gspb_price_value,
.gspb-pricebox .sale-price {
    flex-direction: row !important;
}
