/* =============================================
   WC Product Enquiry Pro — Public Styles
   ============================================= */

:root {
    --wcpe-primary:       #667eea;
    --wcpe-primary-dark:  #5a6fd6;
    --wcpe-accent:        #764ba2;
    --wcpe-wa-green:      #25d366;
    --wcpe-wa-dark:       #1ebe5a;
    --wcpe-text:          #1a202c;
    --wcpe-text-muted:    #718096;
    --wcpe-border:        #e2e8f0;
    --wcpe-bg:            #f7f8fc;
    --wcpe-white:         #ffffff;
    --wcpe-radius:        10px;
    --wcpe-shadow:        0 4px 20px rgba(0,0,0,.08);
    --wcpe-sidebar-w:     260px;
    --wcpe-transition:    .2s ease;
}

/* ── Layout ────────────────────────────────── */

.wcpe-wrapper {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--wcpe-text);
    max-width: 1200px;
    margin: 0 auto;
}

/* ── Sidebar ───────────────────────────────── */

.wcpe-sidebar {
    width: var(--wcpe-sidebar-w);
    flex-shrink: 0;
    position: sticky;
    top: 24px;
}

.wcpe-search-wrap {
    position: relative;
    margin-bottom: 16px;
}

.wcpe-search {
    width: 100%;
    padding: 10px 36px 10px 14px;
    border: 1.5px solid var(--wcpe-border);
    border-radius: var(--wcpe-radius);
    font-size: 13.5px;
    background: var(--wcpe-white);
    box-sizing: border-box;
    transition: border-color var(--wcpe-transition), box-shadow var(--wcpe-transition);
    outline: none;
}

.wcpe-search:focus {
    border-color: var(--wcpe-primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,.15);
}

.wcpe-search-icon {
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--wcpe-text-muted);
    pointer-events: none;
    display: flex;
}

.wcpe-categories {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--wcpe-white);
    border: 1px solid var(--wcpe-border);
    border-radius: var(--wcpe-radius);
    padding: 8px;
    max-height: 65vh;
    overflow-y: auto;
}

.wcpe-cat-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    border: none;
    background: transparent;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13.5px;
    color: var(--wcpe-text);
    text-align: left;
    transition: background var(--wcpe-transition), color var(--wcpe-transition);
    font-family: inherit;
}

.wcpe-cat-btn:hover {
    background: var(--wcpe-bg);
    color: var(--wcpe-primary);
}

.wcpe-cat-btn.active {
    background: linear-gradient(135deg, #eff2ff 0%, #f5eeff 100%);
    color: var(--wcpe-primary);
    font-weight: 600;
}

.wcpe-cat-thumb {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.wcpe-cat-icon {
    font-size: 16px;
    flex-shrink: 0;
    line-height: 1;
}

.wcpe-cat-btn span:nth-child(2) {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wcpe-cat-count {
    font-size: 11px;
    color: var(--wcpe-text-muted);
    background: var(--wcpe-bg);
    padding: 1px 6px;
    border-radius: 20px;
    flex-shrink: 0;
}

.wcpe-subcat {
    padding-left: 24px !important;
    font-size: 13px !important;
}

/* ── Main Panel ────────────────────────────── */

.wcpe-main {
    flex: 1;
    min-width: 0;
}

.wcpe-main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.wcpe-active-cat-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--wcpe-text);
}

.wcpe-results-count {
    font-size: 13px;
    color: var(--wcpe-text-muted);
    background: var(--wcpe-bg);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--wcpe-border);
}

/* ── Product Grid ──────────────────────────── */

.wcpe-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
}

.wcpe-wrapper[data-columns="2"] .wcpe-products-grid { grid-template-columns: repeat(2, 1fr); }
.wcpe-wrapper[data-columns="3"] .wcpe-products-grid { grid-template-columns: repeat(3, 1fr); }
.wcpe-wrapper[data-columns="4"] .wcpe-products-grid { grid-template-columns: repeat(4, 1fr); }

/* ── Product Card ──────────────────────────── */

.wcpe-product-card {
    background: var(--wcpe-white);
    border: 1px solid var(--wcpe-border);
    border-radius: var(--wcpe-radius);
    overflow: hidden;
    transition: transform var(--wcpe-transition), box-shadow var(--wcpe-transition), border-color var(--wcpe-transition);
    cursor: pointer;
    position: relative;
}

.wcpe-product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(102,126,234,.15);
    border-color: var(--wcpe-primary);
}

.wcpe-product-img-wrap {
    position: relative;
    overflow: hidden;
    background: var(--wcpe-bg);
    aspect-ratio: 1;
}

.wcpe-product-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
}

.wcpe-product-card:hover .wcpe-product-img-wrap img {
    transform: scale(1.06);
}

.wcpe-product-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(102,126,234,.85), rgba(118,75,162,.85));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--wcpe-transition);
}

.wcpe-product-card:hover .wcpe-product-overlay {
    opacity: 1;
}

.wcpe-overlay-btn {
    background: var(--wcpe-white);
    color: var(--wcpe-primary);
    border: none;
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transform: translateY(8px);
    transition: transform var(--wcpe-transition);
}

.wcpe-product-card:hover .wcpe-overlay-btn {
    transform: translateY(0);
}

.wcpe-product-info {
    padding: 12px 14px;
}

.wcpe-product-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--wcpe-text);
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wcpe-product-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.wcpe-product-sku {
    font-size: 11px;
    color: var(--wcpe-text-muted);
    background: var(--wcpe-bg);
    padding: 2px 7px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    border: 1px solid var(--wcpe-border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 55%;
}

.wcpe-product-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--wcpe-primary);
}

.wcpe-enquire-btn {
    display: block;
    width: calc(100% - 28px);
    margin: 0 14px 12px;
    padding: 8px;
    background: linear-gradient(135deg, var(--wcpe-primary), var(--wcpe-accent));
    color: var(--wcpe-white);
    border: none;
    border-radius: 7px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: opacity var(--wcpe-transition), transform var(--wcpe-transition);
    text-align: center;
}

.wcpe-enquire-btn:hover {
    opacity: .9;
    transform: translateY(-1px);
}

/* ── Pagination ────────────────────────────── */

.wcpe-pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 24px;
    flex-wrap: wrap;
}

.wcpe-page-btn {
    padding: 7px 14px;
    border: 1.5px solid var(--wcpe-border);
    background: var(--wcpe-white);
    border-radius: 7px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    color: var(--wcpe-text);
    transition: all var(--wcpe-transition);
}

.wcpe-page-btn:hover,
.wcpe-page-btn.active {
    background: var(--wcpe-primary);
    border-color: var(--wcpe-primary);
    color: var(--wcpe-white);
}

/* ── Loading ───────────────────────────────── */

.wcpe-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 20px;
    color: var(--wcpe-text-muted);
    font-size: 14px;
    gap: 12px;
}

.wcpe-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--wcpe-border);
    border-top-color: var(--wcpe-primary);
    border-radius: 50%;
    animation: wcpe-spin .7s linear infinite;
}

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

.wcpe-no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--wcpe-text-muted);
}

.wcpe-no-products-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
    opacity: .4;
}

/* ── Modal ─────────────────────────────────── */

.wcpe-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}

.wcpe-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.wcpe-modal {
    background: var(--wcpe-white);
    border-radius: 16px;
    padding: 32px;
    max-width: 520px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px) scale(.97);
    transition: transform .25s ease;
}

.wcpe-modal-overlay.open .wcpe-modal {
    transform: translateY(0) scale(1);
}

.wcpe-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--wcpe-bg);
    border: 1px solid var(--wcpe-border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--wcpe-text-muted);
    transition: background var(--wcpe-transition), color var(--wcpe-transition);
    padding: 0;
}

.wcpe-modal-close:hover {
    background: #fee2e2;
    color: #e53e3e;
    border-color: #fca5a5;
}

/* Modal product banner */

.wcpe-modal-product {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--wcpe-bg);
    border: 1px solid var(--wcpe-border);
    border-radius: var(--wcpe-radius);
    padding: 14px 16px;
    margin-bottom: 20px;
}

.wcpe-modal-product img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--wcpe-border);
    flex-shrink: 0;
}

.wcpe-modal-product-info h4 {
    margin: 0 0 3px;
    font-size: 15px;
    font-weight: 700;
    color: var(--wcpe-text);
}

.wcpe-modal-product-info p {
    margin: 0;
    font-size: 12px;
    color: var(--wcpe-text-muted);
}

.wcpe-modal-product-info a {
    font-size: 12px;
    color: var(--wcpe-primary);
    text-decoration: none;
}

.wcpe-modal h3 {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 700;
    color: var(--wcpe-text);
}

.wcpe-modal-sub {
    margin: 0 0 20px;
    font-size: 13.5px;
    color: var(--wcpe-text-muted);
}

/* Form */

.wcpe-form-row { display: flex; gap: 12px; }
.wcpe-form-row--2 > .wcpe-field { flex: 1; }

.wcpe-field {
    margin-bottom: 14px;
}

.wcpe-field label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--wcpe-text);
    margin-bottom: 5px;
}

.wcpe-field label .req {
    color: #e53e3e;
    margin-left: 2px;
}

.wcpe-field input,
.wcpe-field textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--wcpe-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--wcpe-text);
    background: var(--wcpe-white);
    box-sizing: border-box;
    outline: none;
    transition: border-color var(--wcpe-transition), box-shadow var(--wcpe-transition);
    -webkit-appearance: none;
}

.wcpe-field input:focus,
.wcpe-field textarea:focus {
    border-color: var(--wcpe-primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,.12);
}

.wcpe-field textarea {
    resize: vertical;
    min-height: 90px;
}

/* Form Actions */

.wcpe-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.wcpe-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 22px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--wcpe-transition);
    text-decoration: none;
}

.wcpe-btn--primary {
    background: linear-gradient(135deg, var(--wcpe-primary), var(--wcpe-accent));
    color: var(--wcpe-white);
    flex: 1;
}

.wcpe-btn--primary:hover { opacity: .9; transform: translateY(-1px); }
.wcpe-btn--primary:disabled { opacity: .6; cursor: default; transform: none; }

.wcpe-btn--whatsapp {
    background: var(--wcpe-wa-green);
    color: var(--wcpe-white);
}

.wcpe-btn--whatsapp:hover { background: var(--wcpe-wa-dark); }

/* Form messages */

#wcpe-form-message {
    margin-bottom: 16px;
}

.wcpe-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
}

.wcpe-alert--success {
    background: #f0fff4;
    border: 1px solid #c6f6d5;
    color: #276749;
}

.wcpe-alert--error {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    color: #c53030;
}

/* ── Responsive ────────────────────────────── */

@media (max-width: 768px) {
    .wcpe-wrapper {
        flex-direction: column;
    }

    .wcpe-sidebar {
        width: 100%;
        position: static;
    }

    .wcpe-categories {
        flex-direction: row;
        flex-wrap: wrap;
        max-height: none;
        gap: 6px;
        padding: 10px;
    }

    .wcpe-cat-btn {
        width: auto;
        flex-shrink: 0;
        font-size: 12.5px;
        padding: 7px 10px;
    }

    .wcpe-products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .wcpe-form-row--2 {
        flex-direction: column;
    }

    .wcpe-modal {
        padding: 24px 20px;
    }
}

@media (max-width: 480px) {
    .wcpe-products-grid {
        grid-template-columns: 1fr !important;
    }
}
