/**
 * AI Room Visualizer Styles — Trove Theme
 * Navy/Gold palette with Tailwind-inspired components
 */

/* Full Page Layout */
.ai-visualize-section {
    padding: 1rem 0 1.5rem;
    min-height: calc(100vh - 80px);
    max-height: calc(100vh - 80px);
    background: linear-gradient(135deg, #f7f7f9 0%, #fff 100%);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ai-visualize-section .container-wide {
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 0 1.5rem;
    box-sizing: border-box;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Page Header */
.ai-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.ai-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ai-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #545454;
    font-size: 1.3125rem; /* 50% larger */
    text-decoration: none;
    transition: color 0.2s;
}

.ai-back-link:hover {
    color: #000000;
}

.ai-page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #000000;
    margin: 0;
}

.ai-project-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    background: #f7f7f9;
    border-radius: 20px;
    font-size: 0.8125rem;
    color: #000000;
    margin: 0;
    width: fit-content;
}

.ai-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

@media (max-width: 1200px) {
    .ai-page-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .ai-header-left {
        flex-wrap: wrap;
    }

    .ai-header-right {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 1024px) {
    .ai-visualize-section {
        max-height: none;
        overflow: visible;
    }

    .ai-visualize-section .container-wide {
        overflow: visible;
    }
}

@media (max-width: 768px) {
    .ai-page-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .ai-header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .ai-header-right {
        width: 100%;
        justify-content: flex-start;
    }

    .ai-page-title {
        font-size: 1.25rem;
    }

    .ai-visualize-section .container-wide {
        padding: 0 1rem;
    }

    .ai-credit-display {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }

    .credit-dot {
        width: 8px;
        height: 8px;
    }
}

/* Credit Display */
.ai-credit-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: #f7f7f9;
    border-radius: 24px;
    font-size: 0.875rem;
}

.credit-label {
    color: #545454;
    font-weight: 500;
}

.credit-dots {
    display: flex;
    gap: 4px;
}

.credit-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e5e7eb;
    transition: background 0.2s;
}

.credit-dot-filled {
    background: #000000;
}

.credit-count {
    color: #000000;
    font-weight: 600;
}

/* Main Container - Three Panel Layout */
.ai-visualize-container {
    display: grid;
    grid-template-columns: 120px 1fr 320px;
    gap: 1.25rem;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Left Sidebar: Gallery Thumbnails (vertical scroll) */
.ai-gallery-sidebar {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 100%;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f1f1f1;
}

.ai-gallery-sidebar::-webkit-scrollbar {
    width: 5px;
}

.ai-gallery-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.ai-gallery-sidebar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

@media (max-width: 1200px) {
    .ai-visualize-container {
        grid-template-columns: 100px 1fr 280px;
        gap: 1rem;
    }
}

@media (max-width: 1024px) {
    .ai-visualize-container {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .ai-gallery-sidebar {
        order: 2;
        overflow-y: visible;
        overflow-x: auto;
        max-height: none;
    }
}

/* Left Panel: Display */
.ai-display-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
    max-width: 100%;
    min-height: 0;
    overflow: hidden;
}

/* Hero Image Wrapper */
.ai-hero-wrapper {
    position: relative;
    background: #f7f7f9;
    border: 1px solid #f3f4f6;
    border-radius: 12px;
    overflow: hidden;
    flex: 1;
    min-height: 300px;
    max-height: 100%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Empty State */
.ai-empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
    color: #545454;
}

.ai-empty-icon {
    margin-bottom: 1rem;
    opacity: 0.4;
}

.ai-empty-icon svg {
    stroke: #000000;
    width: 60px;
    height: 60px;
}

.ai-empty-state h3 {
    font-size: 1.875rem; /* 50% larger */
    font-weight: 600;
    color: #000000;
    margin-bottom: 0.375rem;
}

.ai-empty-state p {
    max-width: 320px;
    line-height: 1.5;
    font-size: 1.3125rem; /* 50% larger */
}

/* Hero Image */
.ai-hero-image {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
}

.ai-hero-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    /* Ensure perfect centering */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Hotspots */
.ai-hotspots {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.ai-hotspot {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    z-index: 10;
}

.ai-hotspot-dot {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.9);
    border: 3px solid #000000;
    border-radius: 50%;
    cursor: pointer;
    animation: pulse 2s infinite;
    transition: transform 0.2s;
}

.ai-hotspot:hover .ai-hotspot-dot {
    transform: scale(1.2);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(25, 27, 76, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(25, 27, 76, 0); }
}

/* Hotspot Card */
.ai-hotspot-card {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 20;
}

.ai-hotspot:hover .ai-hotspot-card {
    opacity: 1;
    visibility: visible;
}

.ai-hotspot-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 12px 12px 0 0;
}

.ai-hotspot-info {
    padding: 1rem;
}

.ai-hotspot-info h5 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #000000;
}

.ai-hotspot-info p {
    font-size: 0.8rem;
    color: #545454;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

/* Loading Overlay */
.ai-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    z-index: 30;
}

.ai-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: #000000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.ai-loading-text {
    font-size: 1rem;
    color: #545454;
}

/* Slideshow Navigation */
.ai-slideshow-nav {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 15;
}

.ai-nav-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-nav-btn:hover {
    background: #000000;
    border-color: #000000;
    color: white;
}

.ai-nav-btn svg {
    stroke: currentColor;
}

.ai-nav-counter {
    font-size: 0.875rem;
    font-weight: 500;
    color: #545454;
    min-width: 50px;
    text-align: center;
}

/* Load Settings Button - shown when browsing images with arrows */
.ai-load-settings-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: #000000;
    z-index: 20;
    transition: all 0.2s ease;
}

.ai-load-settings-btn:hover {
    background: #000000;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.ai-load-settings-btn svg {
    stroke: currentColor;
    flex-shrink: 0;
}

/* Gallery Strip — Vertical */
.ai-gallery-strip {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0;
}

.ai-gallery-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ai-gallery-thumb.active {
    border-color: #000000;
    box-shadow: 0 0 0 2px rgba(25, 27, 76, 0.2);
}

.ai-gallery-thumb:hover {
    border-color: #F4AF2D;
}

.ai-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-thumb-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 50%);
    display: flex;
    align-items: flex-end;
    padding: 0.375rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.ai-gallery-thumb:hover .ai-thumb-overlay {
    opacity: 1;
}

.ai-thumb-overlay span {
    font-size: 0.65rem;
    color: white;
    font-weight: 500;
    line-height: 1.2;
}

/* Mobile: revert gallery to horizontal strip */
@media (max-width: 1024px) {
    .ai-gallery-strip {
        flex-direction: row;
        overflow-x: auto;
        padding: 0.375rem;
        background: #f7f7f9;
        border-radius: 8px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .ai-gallery-thumb {
        flex: 0 0 96px;
        height: 72px;
        aspect-ratio: auto;
        scroll-snap-align: start;
    }
}

/* Right Panel: Controls */
.ai-controls-panel {
    background: white;
    border: 1px solid #f3f4f6;
    border-radius: 12px;
    padding: 1rem;
    max-width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    max-height: 100%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

@media (max-width: 1200px) {
    .ai-controls-panel {
        padding: 0.875rem;
    }
}

.ai-generate-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ai-control-section h4 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #000000;
}

.ai-control-section label {
    display: block;
    font-size: 1.3rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: #545454;
}

.ai-hint {
    font-size: 1.2rem;
    color: #9ca3af;
    margin-top: 0.375rem;
    text-align: center;
}

.ai-no-credits {
    font-size: 0.85rem;
    color: #dc2626;
    margin-top: 0.5rem;
}

/* Product Grid */
.ai-product-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    max-width: 100%;
}

/* Selected Product Card with Usage Input */
.ai-selected-product-card {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.5rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.ai-selected-product-image {
    position: relative;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
}

.ai-selected-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-selected-product-card .ai-remove-product {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: rgba(220, 38, 38, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.ai-selected-product-card:hover .ai-remove-product {
    opacity: 1;
}

.ai-selected-product-card .ai-remove-product svg {
    stroke: white;
}

.ai-selected-product-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ai-selected-product-name {
    font-size: 1.1rem;
    font-weight: 500;
    color: #000000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-product-usage-input {
    width: 100% !important;
    padding: 0.5rem 1rem !important;
    height: 3rem !important;
    font-size: 1.1rem !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 3px !important;
    background: white !important;
    color: #000000 !important;
    transition: border-color 0.2s;
    box-sizing: border-box !important;
}

.ai-product-usage-input:focus {
    outline: none !important;
    border-color: #F4AF2D !important;
    box-shadow: 0 0 0 3px rgba(226, 158, 37, 0.1) !important;
}

.ai-product-usage-input::placeholder {
    color: #9ca3af;
}

/* Legacy styles for backwards compatibility */
.ai-selected-product {
    position: relative;
    width: 52px;
    height: 52px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.ai-selected-product img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-remove-product {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(220, 38, 38, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.ai-selected-product:hover .ai-remove-product {
    opacity: 1;
}

.ai-remove-product svg {
    stroke: white;
}

.ai-product-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2px 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.6rem;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* Add Product Button */
.ai-add-product-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    width: 100%;
    padding: 0.5rem;
    background: #f7f7f9;
    border: 1.5px dashed #000000;
    border-radius: 6px;
    color: #000000;
    font-weight: 500;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-add-product-btn:hover {
    background: #000000;
    color: white;
    border-style: solid;
}

/* Generate Button */
.ai-generate-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    font-size: 1.3rem;
    font-weight: 600;
    background: #000000;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-generate-btn:hover {
    background: #222222;
}

.ai-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Product Modal */
.modal.ai-product-modal,
.modal.ai-image-modal {
    display: none;
}

.modal.ai-product-modal.active,
.modal.ai-image-modal.active {
    display: flex;
    position: fixed;
    inset: 0;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-container {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.modal-container.modal-lg {
    max-width: 700px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #000000;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #545454;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
}

/* Product Tabs */
.ai-product-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ai-product-tab {
    flex: 1;
    padding: 0.75rem;
    background: #f7f7f9;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #545454;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-product-tab.active {
    background: #000000;
    color: white;
}

.ai-product-tab-content {
    display: none;
}

.ai-product-tab-content.active {
    display: block;
}

/* Room Select */
.ai-room-select {
    margin-bottom: 1rem;
}

.ai-room-select label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Search Input */
.ai-search-input {
    margin-bottom: 1rem;
}

/* Product List */
.ai-room-products,
.ai-search-results {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.ai-product-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: #f9fafb;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-product-item:hover {
    background: #f3f4f6;
}

.ai-product-item.selected {
    border-color: #000000;
    background: #f7f7f9;
}

.ai-product-checkbox {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-product-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    accent-color: #000000;
    appearance: auto;
    -webkit-appearance: auto;
    -moz-appearance: auto;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    cursor: pointer;
    margin: 0;
    padding: 0;
}

.ai-product-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
}

.ai-product-details {
    flex: 1;
    min-width: 0;
}

.ai-product-details h5 {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-product-sku {
    font-size: 0.75rem;
    color: #9ca3af;
}

.ai-loading,
.ai-error {
    text-align: center;
    padding: 2rem;
    color: #545454;
}

.ai-error {
    color: #dc2626;
}

/* History Page */
.ai-history-section {
    padding: 2rem 0 4rem;
    min-height: calc(100vh - 80px);
    background: linear-gradient(135deg, #f7f7f9 0%, #fff 100%);
}

.ai-history-section .container-wide {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    box-sizing: border-box;
}

.ai-empty-history {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
}

.ai-empty-history .ai-empty-icon {
    margin-bottom: 1.5rem;
    color: #9ca3af;
}

.ai-empty-history h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #000000;
}

.ai-empty-history p {
    color: #545454;
    margin-bottom: 1.5rem;
}

.ai-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.ai-history-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.ai-history-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.ai-history-image {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    cursor: pointer;
}

.ai-history-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ai-history-card:hover .ai-history-image img {
    transform: scale(1.05);
}

.ai-history-image .ai-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(220, 38, 38, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    z-index: 5;
}

.ai-history-card:hover .ai-delete-btn {
    opacity: 1;
}

.ai-history-image .ai-delete-btn:hover {
    background: rgba(185, 28, 28, 1);
}

.ai-history-image .ai-delete-btn svg {
    stroke: white;
}

.ai-history-info {
    padding: 1rem;
}

.ai-history-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.ai-history-theme {
    font-weight: 500;
    color: #000000;
}

.ai-history-date {
    font-size: 0.75rem;
    color: #9ca3af;
}

.ai-history-products {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.ai-product-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    background: #f3f4f6;
    border-radius: 4px;
    color: #545454;
}

/* Image Modal */
.ai-image-modal .modal-container {
    max-width: 90vw;
    max-height: 90vh;
    background: transparent;
}

.ai-image-modal .modal-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.ai-image-modal .modal-body img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
}

.ai-image-modal .ai-slideshow-nav {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 0.5rem 1rem;
    border-radius: 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.ai-image-modal .modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
}

/* Responsive */
@media (max-width: 768px) {
    .ai-visualize-container {
        gap: 1rem;
    }

    .ai-controls-panel {
        position: static;
        padding: 1rem;
    }

    .ai-hero-wrapper {
        min-height: 300px;
    }

    .ai-hotspot-card {
        width: 200px;
    }

    .ai-history-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1rem;
    }

    .ai-history-section .container-wide {
        padding: 0 1rem;
    }
}

/* ===========================
   Slideshow Button
   =========================== */
.btn-slideshow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 10px 20px;
    background: #000000;
    color: #FFF;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-slideshow:hover {
    background: #000000;
    transform: scale(1.02);
}

.btn-slideshow svg {
    flex-shrink: 0;
}

/* ===========================
   Fullscreen Slideshow Modal
   =========================== */
.ai-slideshow-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ai-slideshow-modal.active {
    display: block;
    opacity: 1;
}

.ai-slideshow-modal-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

/* Header */
.ai-slideshow-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.ai-slideshow-header h2 {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.ai-slideshow-close {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #FFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.ai-slideshow-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Main Content Area */
.ai-slideshow-main {
    flex: 1;
    display: flex;
    min-height: 0;
}

/* Image Area */
.ai-slideshow-image-area {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ai-slideshow-image-wrapper {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-slideshow-image-wrapper img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 220px);
    object-fit: contain;
    border-radius: 8px;
}

/* Navigation Arrows for Fullscreen Slideshow */
.ai-slideshow-modal .ai-slideshow-nav {
    position: absolute;
    top: 50%;
    bottom: auto;
    left: auto;
    right: auto;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    padding: 0;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    box-shadow: none;
    color: #FFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    transition: background 0.3s ease;
    z-index: 5;
}

.ai-slideshow-modal .ai-slideshow-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ai-slideshow-modal .ai-slideshow-prev {
    left: 20px;
    right: auto;
}

.ai-slideshow-modal .ai-slideshow-next {
    right: 20px;
    left: auto;
}

/* Products Sidebar */
.ai-slideshow-sidebar {
    flex: 0 0 350px;
    width: 350px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-slideshow-sidebar-title {
    color: #FFF;
    font-size: 16px;
    font-weight: 600;
    padding: 20px;
    margin: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-slideshow-products {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ai-no-products {
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    padding: 2rem;
    font-size: 0.875rem;
}

/* Product Card in Slideshow */
.ai-slideshow-product-card {
    background: #FFF;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    transition: box-shadow 0.3s ease;
}

.ai-slideshow-product-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ai-slideshow-product-image {
    flex: 0 0 30%;
    width: 30%;
    aspect-ratio: 1;
    overflow: hidden;
}

.ai-slideshow-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-slideshow-product-info {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ai-slideshow-product-name {
    font-size: 13px;
    font-weight: 600;
    color: #000000;
    margin: 0 0 4px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ai-slideshow-product-usage {
    font-size: 11px;
    color: #545454;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.ai-slideshow-product-actions {
    display: flex;
    gap: 6px;
}

.ai-slideshow-product-actions .btn {
    font-size: 11px;
    padding: 6px 10px;
}

/* Thumbnails Strip */
.ai-slideshow-thumbnails {
    height: 100px;
    min-height: 80px;
    background: rgba(0, 0, 0, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    overflow-x: auto;
}

.ai-slideshow-thumbnails-inner {
    display: flex;
    gap: 10px;
    height: 100%;
    align-items: center;
}

.ai-slideshow-thumbnail {
    flex-shrink: 0;
    width: 100px;
    height: 75px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.ai-slideshow-thumbnail:hover {
    opacity: 0.8;
}

.ai-slideshow-thumbnail.active {
    opacity: 1;
    border-color: #FFF;
}

.ai-slideshow-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Slideshow Mobile Responsive */
@media (max-width: 1024px) and (min-width: 769px) {
    .ai-slideshow-sidebar {
        flex: 0 0 280px;
        width: 280px;
    }

    .ai-slideshow-product-name {
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    .ai-slideshow-sidebar {
        display: none;
    }

    .ai-slideshow-image-area {
        width: 100%;
        padding: 10px;
    }

    .ai-slideshow-modal .ai-slideshow-nav {
        width: 40px;
        height: 40px;
    }

    .ai-slideshow-modal .ai-slideshow-prev {
        left: 10px;
    }

    .ai-slideshow-modal .ai-slideshow-next {
        right: 10px;
    }

    .ai-slideshow-thumbnail {
        width: 70px;
        height: 52px;
    }

    .ai-slideshow-image-wrapper img {
        max-height: calc(100vh - 180px);
    }

    .ai-slideshow-header {
        padding: 10px 15px;
    }

    .ai-slideshow-header h2 {
        font-size: 1rem;
    }
}

/* ===========================
   Toast Notifications
   =========================== */
.ai-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: #000000;
    color: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    z-index: 10000;
    max-width: 400px;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.ai-toast-visible {
    transform: translateX(0);
    opacity: 1;
}

.ai-toast-hiding {
    transform: translateX(120%);
    opacity: 0;
}

.ai-toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-toast-icon svg {
    width: 22px;
    height: 22px;
}

.ai-toast-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

.ai-toast-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-toast-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Toast Types */
.ai-toast-error {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.ai-toast-error .ai-toast-icon svg {
    stroke: white;
}

.ai-toast-success {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.ai-toast-success .ai-toast-icon svg {
    stroke: white;
}

.ai-toast-warning {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.ai-toast-warning .ai-toast-icon svg {
    stroke: white;
}

.ai-toast-info {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.ai-toast-info .ai-toast-icon svg {
    stroke: white;
}

/* Toast Mobile */
@media (max-width: 480px) {
    .ai-toast {
        left: 15px;
        right: 15px;
        max-width: none;
        transform: translateY(-120%);
    }

    .ai-toast-visible {
        transform: translateY(0);
    }

    .ai-toast-hiding {
        transform: translateY(-120%);
    }
}

/* ===========================
   Confirmation Dialog
   =========================== */
.ai-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(4px);
}

.ai-confirm-overlay.ai-confirm-visible {
    opacity: 1;
}

.ai-confirm-dialog {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 420px;
    width: 90%;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.2s ease;
    overflow: hidden;
}

.ai-confirm-visible .ai-confirm-dialog {
    transform: scale(1) translateY(0);
}

.ai-confirm-header {
    padding: 20px 24px 0;
}

.ai-confirm-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #000000;
}

.ai-confirm-body {
    padding: 16px 24px;
    color: #4b5563;
    font-size: 0.95rem;
    line-height: 1.5;
}

.ai-confirm-body p {
    margin: 0 0 12px;
}

.ai-confirm-body strong {
    color: #000000;
}

.ai-confirm-details {
    margin-top: 16px;
}

.ai-confirm-products-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    max-height: 150px;
    overflow-y: auto;
}

.ai-confirm-product {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    background: #f3f4f6;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #000000;
}

.ai-confirm-product img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.ai-confirm-credit-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 8px;
    font-size: 0.875rem;
    color: #92400e;
}

.ai-confirm-credit-info svg {
    flex-shrink: 0;
    stroke: #d97706;
}

.ai-confirm-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px 24px;
    justify-content: flex-end;
}

.ai-confirm-btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.ai-confirm-cancel {
    background: #f3f4f6;
    color: #4b5563;
}

.ai-confirm-cancel:hover {
    background: #e5e7eb;
    color: #000000;
}

.ai-confirm-ok {
    background: #000000;
    color: white;
}

.ai-confirm-ok:hover {
    background: #000000;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(25, 27, 76, 0.3);
}

/* Confirm Dialog Mobile */
@media (max-width: 480px) {
    .ai-confirm-dialog {
        width: 95%;
        max-width: none;
    }

    .ai-confirm-footer {
        flex-direction: column-reverse;
    }

    .ai-confirm-btn {
        width: 100%;
        text-align: center;
    }
}
