/**
 * WooCommerce Smart Bargain - Frontend Styles
 */

:root {
    --wsb-btn-bg: #2271b1;
    --wsb-btn-text: #ffffff;
    --wsb-btn-hover: #135e96;
    --wsb-btn-radius: 4px;
}

/* Single Product Bargain Button */
.wsb-bargain-button-wrapper {
    margin: 12px 0 !important;
    display: inline-block !important;
}

.wsb-bargain-btn {
    background-color: var(--wsb-btn-bg) !important;
    color: var(--wsb-btn-text) !important;
    border-radius: var(--wsb-btn-radius) !important;
    border: none !important;
    padding: 12px 22px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12) !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    text-decoration: none !important;
    line-height: 1.4 !important;
}

.wsb-bargain-btn:hover,
.wsb-bargain-btn:focus {
    background-color: var(--wsb-btn-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18) !important;
}

.wsb-bargain-btn:active {
    transform: translateY(0);
}

.wsb-bargain-btn .wsb-btn-icon {
    font-size: 16px;
    line-height: 1;
}

/* Prevent Background Scrolling When Modal Is Open */
body.wsb-modal-open {
    overflow: hidden !important;
}

/* Modal Popup Overlay */
.wsb-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 15px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: opacity 0.25s ease-out;
}

.wsb-modal.is-active {
    opacity: 1;
    pointer-events: auto;
}

.wsb-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1;
}

/* Modal Dialog Box */
.wsb-modal-dialog {
    position: relative;
    width: 100%;
    max-width: 540px;
    max-height: calc(100vh - 40px);
    margin: auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2;
    box-sizing: border-box;
}

.wsb-modal.is-active .wsb-modal-dialog {
    transform: scale(1);
}

.wsb-modal-content {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 40px);
    overflow: hidden;
}

/* Modal Header */
.wsb-modal-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 24px 16px 24px;
    border-bottom: 1px solid #f1f5f9;
    background: #fafafa;
}

.wsb-modal-title {
    margin: 0 !important;
    font-size: 19px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    line-height: 1.3 !important;
}

.wsb-modal-title .wsb-icon {
    font-size: 20px;
}

.wsb-modal-desc {
    margin: 4px 0 0 0 !important;
    font-size: 13px !important;
    color: #64748b !important;
    line-height: 1.4 !important;
}

.wsb-modal-close {
    background: transparent !important;
    border: none !important;
    font-size: 26px !important;
    line-height: 1 !important;
    color: #94a3b8 !important;
    cursor: pointer !important;
    padding: 4px 8px !important;
    border-radius: 6px !important;
    transition: all 0.15s ease !important;
    margin: 0 !important;
}

.wsb-modal-close:hover {
    color: #0f172a !important;
    background: #f1f5f9 !important;
}

/* Modal Body - Scrollable */
.wsb-modal-body {
    flex: 1 1 auto;
    padding: 20px 24px 24px 24px;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    max-height: calc(100vh - 150px);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: #334155;
    box-sizing: border-box;
}

/* Custom Scrollbar for Modal Body */
.wsb-modal-body::-webkit-scrollbar {
    width: 6px;
}
.wsb-modal-body::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}
.wsb-modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.wsb-modal-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Product Snippet Inside Modal */
.wsb-modal-product-summary {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 18px;
}

.wsb-prod-thumb {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    flex-shrink: 0;
}

.wsb-prod-meta {
    flex: 1;
    min-width: 0;
}

.wsb-prod-name {
    margin: 0 0 3px 0 !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wsb-prod-pricing .wsb-label {
    font-size: 12px;
    color: #64748b;
    margin-right: 4px;
}

.wsb-prod-price {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

/* Alerts */
.wsb-alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 18px;
    font-size: 13px;
    font-weight: 500;
}

.wsb-alert.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.wsb-alert.success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

/* Form Controls */
.wsb-field-group {
    margin-bottom: 16px;
}

.wsb-field-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}

.wsb-price-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.wsb-currency-symbol {
    position: absolute;
    left: 14px;
    font-weight: 700;
    font-size: 17px;
    color: #475569;
    pointer-events: none;
    z-index: 2;
    line-height: 1;
}

.wsb-price-input-wrapper .wsb-input {
    padding-left: 45px !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    height: 44px !important;
}

.wsb-input,
.wsb-textarea {
    width: 100% !important;
    padding: 10px 14px !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 6px !important;
    background: #ffffff !important;
    font-size: 14px !important;
    font-family: inherit !important;
    box-sizing: border-box !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.wsb-input:focus,
.wsb-textarea:focus {
    outline: none !important;
    border-color: var(--wsb-btn-bg) !important;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15) !important;
}

.wsb-field-hint {
    margin-top: 8px;
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
}

.wsb-field-hint.wsb-hint-warning {
    color: #b91c1c !important;
    background: #fef2f2 !important;
    border: 1px solid #fecaca !important;
    padding: 7px 12px !important;
    border-radius: 6px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-weight: 500 !important;
    font-size: 13px !important;
}

.wsb-modal.theme-dark .wsb-field-hint.wsb-hint-warning {
    color: #fca5a5 !important;
    background: #450a0a !important;
    border-color: #7f1d1d !important;
}

.wsb-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 520px) {
    .wsb-grid-2 {
        grid-template-columns: 1fr;
    }
}

.wsb-section-subtitle {
    margin: 18px 0 2px 0 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #0f172a !important;
}

.wsb-section-hint {
    margin: 0 0 12px 0 !important;
    font-size: 12px !important;
    color: #64748b !important;
}

/* User Badge for Logged-In User */
.wsb-user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 16px;
}

.wsb-badge-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.wsb-badge-info {
    font-size: 13px;
    color: #166534;
}

.wsb-badge-email {
    font-size: 12px;
    color: #15803d;
}

/* Modal Actions - Generous spacing so buttons are never cut off */
.wsb-modal-actions {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin-top: 22px !important;
    padding-top: 18px !important;
    padding-bottom: 10px !important;
    border-top: 1px solid #f1f5f9 !important;
}

.wsb-btn-submit {
    flex: 1 !important;
    background-color: var(--wsb-btn-bg) !important;
    color: var(--wsb-btn-text) !important;
    border-radius: var(--wsb-btn-radius) !important;
    padding: 12px 20px !important;
    font-weight: 600 !important;
    font-size: 15px !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    margin: 0 !important;
    height: auto !important;
    line-height: 1.4 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.wsb-btn-submit:hover {
    background-color: var(--wsb-btn-hover) !important;
}

.wsb-btn-cancel {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #e2e8f0 !important;
    padding: 12px 18px !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    cursor: pointer !important;
    margin: 0 !important;
    height: auto !important;
    line-height: 1.4 !important;
}

.wsb-btn-cancel:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

/* Spinner */
.wsb-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: wsb-spin 0.6s linear infinite;
    display: inline-block;
}

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

/* Success Screen */
.wsb-success-screen {
    text-align: center;
    padding: 20px 10px;
}

.wsb-success-icon {
    width: 56px;
    height: 56px;
    background: #dcfce7;
    color: #16a34a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin: 0 auto 16px auto;
}

.wsb-success-title {
    margin: 0 0 8px 0 !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
}

.wsb-success-msg {
    color: #475569 !important;
    margin: 0 0 18px 0 !important;
    font-size: 14px !important;
}

.wsb-ref-box {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 18px;
}

.wsb-ref-label {
    display: block;
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 600;
}

.wsb-ref-code {
    font-size: 19px;
    color: #2271b1;
    letter-spacing: 0.5px;
}

.wsb-success-notice {
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 22px;
}

.wsb-success-actions {
    display: flex !important;
    gap: 12px !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    margin-top: 24px !important;
}

.wsb-success-actions .wsb-btn-view-offers,
.wsb-success-actions .wsb-modal-close-done {
    text-decoration: none !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    border-radius: var(--wsb-btn-radius, 6px) !important;
    padding: 11px 22px !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    line-height: 1.4 !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
    outline: none !important;
    margin: 0 !important;
    height: auto !important;
}

.wsb-success-actions .wsb-btn-view-offers {
    background-color: var(--wsb-btn-bg, #2271b1) !important;
    color: var(--wsb-btn-text, #ffffff) !important;
    border: none !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12) !important;
}

.wsb-success-actions .wsb-btn-view-offers:hover {
    background-color: var(--wsb-btn-hover, #135e96) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18) !important;
    transform: translateY(-1px);
}

.wsb-success-actions .wsb-modal-close-done {
    background: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.wsb-success-actions .wsb-modal-close-done:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

/* Dark Theme */
.wsb-modal.theme-dark .wsb-modal-dialog {
    background: #1e293b;
    color: #f8fafc;
}

.wsb-modal.theme-dark .wsb-modal-header {
    background: #0f172a;
    border-bottom-color: #334155;
}

.wsb-modal.theme-dark .wsb-modal-title {
    color: #f8fafc !important;
}

.wsb-modal.theme-dark .wsb-modal-desc {
    color: #94a3b8 !important;
}

.wsb-modal.theme-dark .wsb-modal-product-summary {
    background: #0f172a;
    border-color: #334155;
}

.wsb-modal.theme-dark .wsb-prod-name,
.wsb-modal.theme-dark .wsb-prod-price,
.wsb-modal.theme-dark .wsb-field-label,
.wsb-modal.theme-dark .wsb-section-subtitle {
    color: #f8fafc !important;
}

.wsb-modal.theme-dark .wsb-input,
.wsb-modal.theme-dark .wsb-textarea {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

.wsb-modal.theme-dark .wsb-success-title {
    color: #f8fafc !important;
}

.wsb-modal.theme-dark .wsb-success-msg,
.wsb-modal.theme-dark .wsb-success-notice {
    color: #94a3b8 !important;
}

.wsb-modal.theme-dark .wsb-ref-box {
    background: #0f172a !important;
    border-color: #334155 !important;
}

.wsb-modal.theme-dark .wsb-modal-close-done {
    background: #334155 !important;
    color: #f8fafc !important;
    border-color: #475569 !important;
}

.wsb-modal.theme-dark .wsb-modal-close-done:hover {
    background: #475569 !important;
}

/* Status Badges - Unified for Frontend & Customer My Account */
.wsb-status-pill {
    display: inline-block !important;
    padding: 5px 14px !important;
    border-radius: 20px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-transform: capitalize !important;
    letter-spacing: 0.3px !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
}

.status-approved { background: #dcfce7 !important; color: #15803d !important; border: 1px solid #bbf7d0 !important; }
.status-pending { background: #fef3c7 !important; color: #b45309 !important; border: 1px solid #fde68a !important; }
.status-counter_offered { background: #f3e8ff !important; color: #7e22ce !important; border: 1px solid #e9d5ff !important; }
.status-purchased { background: #e0f2fe !important; color: #0369a1 !important; border: 1px solid #bae6fd !important; }
.status-declined_by_customer { background: #fee2e2 !important; color: #b91c1c !important; border: 1px solid #fecaca !important; }
.status-rejected { background: #fee2e2 !important; color: #b91c1c !important; border: 1px solid #fecaca !important; }
.status-expired { background: #f1f5f9 !important; color: #64748b !important; border: 1px solid #e2e8f0 !important; }
.status-revised_requested { background: #eff6ff !important; color: #1d4ed8 !important; border: 1px solid #bfdbfe !important; }

/* Customer My Account Offers Styles */
.wsb-account-offers-wrap {
    margin-top: 15px;
}

.wsb-account-header {
    margin-bottom: 25px;
}

.wsb-account-header h2 {
    margin-bottom: 6px !important;
}

.wsb-account-header p {
    color: #64748b;
    font-size: 14px;
}

.wsb-offers-cards-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.wsb-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.wsb-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.wsb-card-header {
    background: #f8fafc;
    padding: 14px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wsb-card-ref .ref-label {
    font-size: 12px;
    color: #64748b;
    margin-right: 4px;
}

.wsb-card-ref .ref-val {
    color: #0f172a;
    font-size: 14px;
}

.wsb-card-body {
    padding: 20px;
}

.wsb-card-prod {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.wsb-card-thumb {
    width: 65px;
    height: 65px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.wsb-card-details .prod-title {
    margin: 0 0 4px 0 !important;
    font-size: 16px !important;
}

.wsb-card-details .prod-title a {
    text-decoration: none;
    color: #0f172a;
}

.wsb-card-details .prod-title a:hover {
    color: #2271b1;
}

.wsb-card-details .submitted-date {
    font-size: 12px;
    color: #64748b;
}

.wsb-card-prices {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    background: #f8fafc;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 14px;
    border: 1px solid #f1f5f9;
}

.wsb-card-prices .price-col {
    flex: 1;
    min-width: 100px;
    text-align: center;
    border-right: 1px solid #e2e8f0;
}

.wsb-card-prices .price-col:last-child {
    border-right: none;
}

.wsb-card-prices .lbl {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: 0.3px;
}

.wsb-card-prices .val {
    font-size: 17px;
    font-weight: 700;
}

.wsb-card-prices .val.old {
    text-decoration: line-through;
    color: #94a3b8;
}

.wsb-card-prices .val.offered {
    color: #2271b1;
}

.wsb-card-prices .val.counter {
    color: #8c3ed6;
}

.wsb-card-prices .val.agreed {
    color: #15803d;
}

.wsb-admin-message-box {
    background: #fffbeb !important;
    border: 1px solid #fef3c7 !important;
    border-left: 4px solid #f59e0b !important;
    padding: 12px 16px !important;
    border-radius: 6px !important;
    margin: 14px 0 !important;
    font-size: 13px !important;
}

.wsb-admin-message-box strong {
    color: #92400e !important;
    display: block !important;
    margin-bottom: 4px !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.wsb-admin-message-box p {
    margin: 0 !important;
    color: #78350f !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
}

.wsb-expiry-note {
    font-size: 13px;
    color: #b45309;
    font-weight: 500;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* My Account Card Actions with Proper Padding and Margins */
.wsb-card-actions {
    background: #f8fafc !important;
    padding: 16px 22px !important;
    border-top: 1px solid #e2e8f0 !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 12px !important;
    box-sizing: border-box !important;
    flex-wrap: wrap !important;
}

.wsb-inline-form {
    margin: 0 !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
}

.wsb-counter-actions {
    display: flex !important;
    gap: 10px !important;
    align-items: center !important;
}

/* Action Buttons */
.wsb-btn-buy,
.wsb-btn-accept,
.wsb-btn-decline {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 10px 22px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    text-decoration: none !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08) !important;
    transition: all 0.2s ease !important;
}

.wsb-btn-buy {
    background: #1d4ed8 !important;
    color: #ffffff !important;
    border: 1px solid #1e40af !important;
}

.wsb-btn-buy:hover {
    background: #1e40af !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(29, 78, 216, 0.25) !important;
}

.wsb-btn-accept {
    background: #16a34a !important;
    color: #ffffff !important;
    border: 1px solid #15803d !important;
}

.wsb-btn-accept:hover {
    background: #15803d !important;
    transform: translateY(-1px);
}

.wsb-btn-decline {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #cbd5e1 !important;
}

.wsb-btn-decline:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

.wsb-pending-badge,
.wsb-expired-badge,
.wsb-rejected-badge {
    font-size: 13px;
    font-weight: 600;
    padding: 4px 8px;
}

.wsb-pending-badge { color: #d97706; }
.wsb-expired-badge { color: #64748b; }
.wsb-rejected-badge { color: #dc2626; }
