/* Product Filter Frontend */

.askagento-filter {
    font-size: 14px;
    line-height: 1.5;
    position: relative;
}

/* Total Count */
.askagento-total {
    padding: 10px 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    color: #666;
}

.askagento-total strong {
    color: #333;
}

/* Field */
.askagento-field {
    margin-bottom: 20px;
}

.askagento-field-label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.askagento-field-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Checkbox & Radio */
.askagento-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 4px 0;
    transition: opacity 0.2s;
}

.askagento-option input {
    margin: 0 8px 0 0;
    cursor: pointer;
}

.askagento-option-label {
    flex: 1;
}

.askagento-count {
    color: #888;
    font-size: 12px;
}

/* Empty options */
.askagento-option.askagento-empty {
    opacity: 0.5;
}

.askagento-option.askagento-empty input {
    cursor: not-allowed;
}

/* Dropdown */
.askagento-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
}

.askagento-select:focus {
    outline: none;
    border-color: #0073aa;
}

.askagento-select option:disabled {
    color: #ccc;
}

/* Range */
.askagento-range-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.askagento-range-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.askagento-range-min,
.askagento-range-max {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
}

.askagento-range-min:focus,
.askagento-range-max:focus {
    outline: none;
    border-color: #0073aa;
}

.askagento-range-sep {
    color: #888;
}

.askagento-range-hint {
    font-size: 12px;
    color: #888;
}

/* Submit */
.askagento-submit {
    margin-top: 20px;
}

.askagento-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.askagento-btn:hover {
    background: #005a87;
}

/* Reset */
.askagento-reset {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.askagento-reset-link {
    color: #666;
    font-size: 13px;
    text-decoration: none;
}

.askagento-reset-link:hover {
    color: #0073aa;
    text-decoration: underline;
}

/* Loading state */
.askagento-filter.askagento-loading {
    opacity: 0.6;
    pointer-events: none;
}

.askagento-filter.askagento-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #0073aa;
    border-top-color: transparent;
    border-radius: 50%;
    animation: askagento-spin 0.8s linear infinite;
}

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

/* Active filter indicator */
.askagento-option input:checked + .askagento-option-label {
    font-weight: 600;
    color: #0073aa;
}

/* AI text discovery */
.askagento-ai-text-search-root {
    margin-bottom: 20px;
}

.askagento-ai-text-search-root > .askagento-ai-text-search {
    margin-bottom: 0;
}

.askagento-ai-text-search {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.askagento-ai-text-search-heading {
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.askagento-ai-text-search-hint {
    margin: -4px 0 12px;
    padding: 0;
    font-size: 13px;
    color: #646970;
    line-height: 1.45;
}

.askagento-ai-text-search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.askagento-ai-text-search-input {
    flex: 1 1 180px;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.askagento-ai-text-search-submit.askagento-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.askagento-ai-text-search-status {
    min-height: 1.25em;
    margin-top: 10px;
    font-size: 13px;
    color: #666;
}

.askagento-ai-text-tiles.askagento-ai-text-search-results {
    list-style: none;
    margin: 16px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 440px;
    width: 100%;
}

.askagento-ai-text-search-results--empty {
    margin-top: 0;
    gap: 0;
}

.askagento-ai-text-tile {
    margin: 0;
    padding: 0;
    list-style: none;
}

.askagento-ai-text-tile-link {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 14px;
    border: 1px solid #eaeaea;
    border-radius: 10px;
    text-decoration: none;
    color: #1d2327;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    box-sizing: border-box;
}

.askagento-ai-text-tile-link:hover,
.askagento-ai-text-tile-link:focus {
    border-color: #0073aa;
    box-shadow: 0 2px 8px rgb(0 115 170 / 0.12);
}

.askagento-ai-text-tile-media {
    aspect-ratio: 1;
    border-radius: 8px;
    background: #f6f7f7;
    border: 1px solid #eeeff0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.askagento-ai-text-tile-media--placeholder {
    min-height: 96px;
}

.askagento-ai-text-tile-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    vertical-align: middle;
}

.askagento-ai-text-tile-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
}

.askagento-ai-text-tile-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    margin: 0;
}

.askagento-ai-text-tile-price {
    font-size: 14px;
    line-height: 1.3;
}

.askagento-ai-text-tile-price .woocommerce-Price-amount,
.askagento-ai-text-tile-price .amount {
    font-weight: 600;
}

.askagento-ai-text-search-loading {
    opacity: 0.72;
}

.askagento-ai-text-search-loading .askagento-ai-text-search-submit {
    opacity: 0.7;
    cursor: wait;
}

/* AI image search (shortcode) */
.askagento-ai-image-search-root {
    margin-bottom: 20px;
}

/* Image block follows auto-injected text search on shop archives */
.askagento-ai-text-search-root + .askagento-ai-image-search-root {
    margin-top: 20px;
}

.askagento-ai-image-search {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

/* Combined text + camera bar (image-search shortcode): the outer image-search
   box wraps an inner text-search box, so only one of them should own the
   spacing/divider to avoid a doubled border. */
.askagento-ai-image-search--inline {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
}

/* Match the camera button height to the Search button / input in the combined
   bar (it keeps a different, icon-sized width). */
.askagento-ai-image-search--inline .askagento-ai-image-search-camera.askagento-btn {
    flex: 0 0 auto;
    min-width: 0;
    min-height: 0;
    padding: 10px 16px;
}

.askagento-ai-image-search--inline .askagento-ai-image-search-camera .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

/* "…or try a sample" tappable photo(s) under the search bar. */
.askagento-ai-image-search-samples {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.askagento-ai-image-search-samples-label {
    font-size: 13px;
    color: #646970;
}

.askagento-ai-image-search-sample {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 6px;
    border: 1px solid #ddd;
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    color: #1d2327;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.askagento-ai-image-search-sample:hover,
.askagento-ai-image-search-sample:focus {
    border-color: #0073aa;
    box-shadow: 0 2px 8px rgb(0 115 170 / 0.12);
}

.askagento-ai-image-search-sample img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #f6f7f7;
    border: 1px solid #eeeff0;
}

.askagento-ai-image-search-sample-label {
    white-space: nowrap;
}

.askagento-ai-image-search-heading {
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.askagento-ai-image-search-hint {
    margin: -4px 0 14px;
    padding: 0;
    font-size: 13px;
    color: #646970;
    line-height: 1.45;
}

.askagento-ai-image-search-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.askagento-ai-image-search-camera.askagento-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
    padding: 10px 12px;
}

.askagento-ai-image-search-camera .dashicons {
    width: 28px;
    height: 28px;
    font-size: 28px;
    line-height: 1;
    margin: 0;
}

.askagento-ai-image-search-status {
    min-height: 1.25em;
    margin-top: 12px;
    font-size: 13px;
    color: #666;
}

.askagento-ai-image-search-loading {
    opacity: 0.72;
}

.askagento-ai-image-search-loading .askagento-ai-image-search-camera {
    opacity: 0.75;
    cursor: wait;
}

.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    width: 1px;
    word-wrap: normal;
}

/* ── AI Chatbot widget ────────────────────────────────────────────────────── */

.askagento-chatbot-root {
    --askagento-chatbot-accent: #0f172a;
}

.askagento-chatbot-root--inline {
    margin-bottom: 24px;
}

/* Inline chatbot fills the available content width (dedicated chat pages have
   plenty of horizontal space). */
.askagento-chatbot-root--inline .askagento-chatbot {
    max-width: 100%;
}

.askagento-chatbot-root--bubble {
    position: fixed;
    right: max(1rem, env(safe-area-inset-right, 0px));
    bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    z-index: 99990;
    font-size: 14px;
    line-height: 1.5;
}

.askagento-chatbot-fab {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: var(--askagento-chatbot-accent);
    color: #fff;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.askagento-chatbot-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.45);
}

.askagento-chatbot-fab__icon {
    display: block;
}

.askagento-chatbot-root--open .askagento-chatbot-fab {
    visibility: hidden;
    pointer-events: none;
}

.askagento-chatbot-panel {
    position: absolute;
    right: 0;
    bottom: 0;
    width: min(380px, calc(100vw - 2rem));
    max-height: min(560px, calc(100vh - 6rem));
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.askagento-chatbot-panel[hidden] {
    display: none !important;
}

.askagento-chatbot-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--askagento-chatbot-accent);
    color: #fff;
}

.askagento-chatbot-panel__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.askagento-chatbot-panel__logo {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    color: var(--askagento-chatbot-accent);
    font-weight: 700;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.askagento-chatbot-panel__title {
    font-weight: 600;
    font-size: 1rem;
}

.askagento-chatbot-panel__close {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.85;
}

.askagento-chatbot-panel__close:hover {
    opacity: 1;
}

.askagento-chatbot-root--bubble .askagento-chatbot-messages {
    min-height: 220px;
    max-height: 360px;
}

.askagento-chatbot-panel__footer {
    margin: 0;
    padding: 8px 14px 12px;
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
    background: #fff;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.askagento-chatbot-panel__footer a {
    color: #64748b;
    font-weight: 500;
    text-decoration: none;
}

.askagento-chatbot-panel__footer a:hover {
    color: var(--askagento-chatbot-accent, #2563eb);
    text-decoration: underline;
}

.askagento-chatbot {
    display: flex;
    flex-direction: column;
    border: 1px solid #ddd;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    max-width: 560px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Message list */
.askagento-chatbot-messages {
    min-height: 180px;
    max-height: 420px;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Individual message rows */
.askagento-chatbot-msg {
    display: flex;
}

.askagento-chatbot-msg--user {
    justify-content: flex-end;
}

.askagento-chatbot-msg--assistant {
    justify-content: flex-start;
}

/* Bubbles */
.askagento-chatbot-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 18px;
    word-break: break-word;
    line-height: 1.55;
}

.askagento-chatbot-msg--user .askagento-chatbot-bubble {
    background: var(--askagento-chatbot-accent, #0073aa);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.askagento-chatbot-msg--assistant .askagento-chatbot-bubble {
    background: #f0f0f1;
    color: #1d2327;
    border-bottom-left-radius: 4px;
}

.askagento-chatbot-msg--assistant .askagento-chatbot-bubble--rich {
    max-width: 94%;
    background: #fff;
    color: #1d2327;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

.askagento-chatbot-reply__prose {
    margin: 0 0 0.75rem;
    font-size: 14px;
    line-height: 1.55;
}

.askagento-chatbot-reply__prose:last-child {
    margin-bottom: 0;
}

.askagento-chatbot-product {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.65rem;
    margin-bottom: 0.5rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.askagento-chatbot-product:last-child {
    margin-bottom: 0;
}

.askagento-chatbot-product:hover {
    border-color: #93c5fd;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.08);
}

.askagento-chatbot-product__img {
    flex-shrink: 0;
    display: block;
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
}

.askagento-chatbot-product__img--empty {
    background: #f0f0f1;
}

.askagento-chatbot-product__body {
    flex: 1;
    min-width: 0;
}

.askagento-chatbot-product__title {
    margin: 0 0 0.2rem;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.askagento-chatbot-product__title a {
    color: #1d2327;
    text-decoration: none;
}

.askagento-chatbot-product__title a:hover {
    color: #0073aa;
}

.askagento-chatbot-product__price {
    display: inline-block;
    margin-bottom: 0.3rem;
    padding: 0.1rem 0.45rem;
    font-size: 12px;
    font-weight: 700;
    color: #065f46;
    background: #d1fae5;
    border-radius: 999px;
}

.askagento-chatbot-product__desc {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: #475569;
}

/* Typing indicator */
.askagento-chatbot-dots {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    padding: 2px 2px;
}

.askagento-chatbot-dots span {
    display: block;
    width: 7px;
    height: 7px;
    background: #aaa;
    border-radius: 50%;
    animation: askagento-chatbot-bounce 1.2s infinite;
}

.askagento-chatbot-dots span:nth-child(2) { animation-delay: 0.2s; }
.askagento-chatbot-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes askagento-chatbot-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40%           { transform: translateY(-5px); }
}

/* Input row */
.askagento-chatbot-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    background: #fafafa;
}

.askagento-chatbot-input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 40px;
    max-height: 140px;
    padding: 9px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    resize: none;
    overflow-y: auto;
    line-height: 1.5;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.askagento-chatbot-input:focus {
    outline: none;
    border-color: var(--askagento-chatbot-accent, #0073aa);
}

.askagento-chatbot-send.askagento-btn {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
}

/* Status / error line */
.askagento-chatbot-status {
    padding: 0 14px 8px;
    min-height: 0;
    font-size: 12px;
    color: #d63638;
}

/* Loading state */
.askagento-chatbot-loading .askagento-chatbot-input,
.askagento-chatbot-loading .askagento-chatbot-send {
    opacity: 0.55;
    cursor: wait;
}

@media (max-width: 480px) {
    .askagento-chatbot-panel {
        width: calc(100vw - 1.5rem);
        max-height: min(70vh, 480px);
    }

    .askagento-chatbot-product {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* ---------------------------------------------------------------------------
   Filtered results grid.
   WooCommerce's classic product list (ul.products) is float-based and relies on
   theme CSS for column widths. On block themes those widths often do not apply,
   so cards collapse to content width and wrap unevenly (e.g. 3, 1, 3, 1 per row).
   Enforce a self-contained responsive grid, scoped to our results region only,
   so rows are even and fill the available width on any theme. auto-fill +
   minmax keeps the column count in step with the container width and ignores
   the markup's .columns-N class.
   -------------------------------------------------------------------------- */
.askagento-filter-products-region ul.products {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 28px 24px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Neutralise the float/clearfix layout WooCommerce applies to the classic grid. */
.askagento-filter-products-region ul.products::before,
.askagento-filter-products-region ul.products::after {
    content: none !important;
    display: none !important;
}

.askagento-filter-products-region ul.products li.product {
    width: auto !important;
    margin: 0 !important;
    float: none !important;
    clear: none !important;
}

.askagento-filter-products-region ul.products li.product img {
    width: 100%;
    height: auto;
}
