/* Import Google Font for Logo */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background: transparent;
}

:root {
    --primary-color: #DB4033;
    --primary-hover: #c23529;
    --secondary-color: #000000;
    --border-color: #dfe1e5;
    --hover-border: #dadce0;
    --background: #ffffff;
    --text-primary: #202124;
    --text-secondary: #000000;
    --shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
    --shadow-hover: 0 2px 8px rgba(32, 33, 36, 0.35);
    --success-color: #DB4033;
    --error-color: #DB4033;
    --warning-color: #DB4033;
    --transition: all 0.3s ease;
    --transition-fast: all 0.15s ease;
    --transition-slow: all 0.5s ease;

    /* Default theme: Red */
    --theme-bg: transparent;
    --theme-accent: #DB4033;
    --theme-text: #000000;
}

/* Theme: Red */
html[data-theme="red"] {
    --primary-color: #DB4033;
    --primary-hover: #c23529;
    --secondary-color: #000000;
    --text-secondary: #000000;
    --success-color: #DB4033;
    --error-color: #DB4033;
    --warning-color: #DB4033;
    --theme-bg: transparent;
    --theme-accent: #DB4033;
    --theme-text: #000000;
}

/* Theme: Blue */
html[data-theme="blue"] {
    --primary-color: #413F8D;
    --primary-hover: #342f70;
    --secondary-color: #000000;
    --text-secondary: #000000;
    --success-color: #413F8D;
    --error-color: #413F8D;
    --warning-color: #413F8D;
    --theme-bg: transparent;
    --theme-accent: #413F8D;
    --theme-text: #000000;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: transparent;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* Overlaid gradient images with cloud-like animation */
body::before {
    content: '';
    position: fixed;
    top: -15%;
    left: -15%;
    width: 130%;
    height: 130%;
    z-index: -3;
    background-image: url('/ch/images/gradient_top.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    will-change: transform;
    animation: cloudFloat1 45s ease-in-out infinite;
}

/* Second gradient layer */
body::after {
    content: '';
    position: fixed;
    top: -15%;
    left: -15%;
    width: 130%;
    height: 130%;
    z-index: -2;
    background-image: url('/ch/images/gradient_middle.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    mix-blend-mode: multiply;
    will-change: transform;
    animation: cloudFloat2 60s ease-in-out infinite;
}

/* Third gradient layer using html element */
html::before {
    content: '';
    position: fixed;
    top: 0%;
    left: -15%;
    width: 130%;
    height: 130%;
    z-index: -1;
    background-image: url('/ch/images/gradient_bottom.png');
    background-size: cover;
    background-position: top left;
    background-repeat: no-repeat;
    mix-blend-mode: multiply;
    pointer-events: none;
    will-change: transform;
    animation: cloudFloat3 75s ease-in-out infinite;
}

/* Cloud-like floating animations for gradient layers */
@keyframes cloudFloat1 {
    0% {
        transform: translate(0%, 0%) scale(1);
    }
    25% {
        transform: translate(8%, 5%) scale(1.05);
    }
    50% {
        transform: translate(-6%, 10%) scale(0.95);
    }
    75% {
        transform: translate(10%, -8%) scale(1.03);
    }
    100% {
        transform: translate(0%, 0%) scale(1);
    }
}

@keyframes cloudFloat2 {
    0% {
        transform: translate(0%, 0%) scale(1) rotate(0deg);
    }
    20% {
        transform: translate(-7%, 8%) scale(1.06) rotate(2deg);
    }
    40% {
        transform: translate(5%, -5%) scale(0.94) rotate(-3deg);
    }
    60% {
        transform: translate(-10%, 3%) scale(1.04) rotate(1deg);
    }
    80% {
        transform: translate(7%, -10%) scale(0.96) rotate(-2deg);
    }
    100% {
        transform: translate(0%, 0%) scale(1) rotate(0deg);
    }
}

@keyframes cloudFloat3 {
    0% {
        transform: translate(0%, 0%) scale(1) rotate(0deg);
    }
    16.66% {
        transform: translate(6%, -8%) scale(1.02) rotate(-1deg);
    }
    33.33% {
        transform: translate(-8%, 6%) scale(0.97) rotate(2deg);
    }
    50% {
        transform: translate(10%, 9%) scale(1.07) rotate(-3deg);
    }
    66.66% {
        transform: translate(-5%, -6%) scale(0.96) rotate(1deg);
    }
    83.33% {
        transform: translate(8%, 10%) scale(1.04) rotate(-2deg);
    }
    100% {
        transform: translate(0%, 0%) scale(1) rotate(0deg);
    }
}

/* Compact Header - Hidden by default, only shown on results page */
.compact-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10001;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 12px 20px;
    display: none;
    transition: transform 0.3s ease;
}

.compact-header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
}

.compact-logo-section {
    flex-shrink: 0;
}

.compact-logo-link {
    display: block;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.compact-logo-link:hover {
    opacity: 0.8;
}

.compact-logo-image {
    height: 32px;
    width: auto;
    display: block;
}

.compact-logo-subtitle {
    font-size: 0.75rem;
    font-weight: 400;
    color: #5f6368;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

/* Compact Type Selector */
.compact-type-selector {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.compact-type-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 2px solid color-mix(in srgb, var(--theme-accent) 20%, transparent);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.compact-type-btn .icon {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
    color: var(--theme-text);
}

.compact-type-btn:hover {
    border-color: var(--theme-accent);
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.05);
}

.compact-type-btn.active {
    background: var(--theme-accent);
    border-color: var(--theme-accent);
}

.compact-type-btn.active .icon {
    color: white;
}

/* Compact Search Box */
.compact-search-box {
    flex: 1;
    display: flex;
    align-items: center;
    border: 2px solid color-mix(in srgb, var(--theme-accent) 15%, transparent);
    border-radius: 24px;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    transition: var(--transition);
}

.compact-search-box:focus-within {
    border-color: var(--theme-accent);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--theme-accent) 20%, transparent);
}

.compact-search-box .search-icon {
    width: 20px;
    height: 20px;
    color: var(--theme-accent);
    stroke-width: 2.5;
    flex-shrink: 0;
}

.compact-search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 14px;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: transparent;
    font-weight: 500;
}

.compact-search-input::placeholder {
    color: color-mix(in srgb, var(--theme-text) 60%, transparent);
    font-weight: 400;
}

.compact-search-btn {
    padding: 10px 24px;
    flex-shrink: 0;
    font-size: 0.9rem;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.compact-btn-icon {
    display: none;
    width: 18px;
    height: 18px;
}

.compact-btn-text {
    display: inline;
}

/* Compact AI Toggle Button */
.compact-ai-toggle {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid color-mix(in srgb, var(--theme-accent) 20%, transparent);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    color: var(--theme-accent);
}

.compact-ai-toggle svg {
    width: 20px;
    height: 20px;
}

.compact-ai-toggle:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--theme-accent);
    transform: scale(1.05);
}

.compact-ai-toggle:active {
    transform: scale(0.95);
}

/* Active state when AI Assistant is open */
body:has(.ai-assistant.show) .compact-ai-toggle {
    background: var(--theme-accent);
    border-color: var(--theme-accent);
    color: white;
}

/* Container */
.container {
    flex: 1 0 auto;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 60px 20px;
    width: 100%;
    position: relative;
    transition: padding 0.3s ease;
}

/* Header */
.header {
    text-align: left;
    margin: 20px 0 50px;
    position: relative;
    padding: 30px 40px;
    background: transparent;
    transition: all 0.3s ease;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.header-text {
    flex: 1;
    transition: opacity 0.3s ease, transform 0.3s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-container {
    background: #ffffff;
    padding: 30px;
    border-radius: 0 0 16px 16px;
    display: inline-block;
    position: relative;
    box-shadow:
        -4px 0 8px 0 rgba(0, 0, 0, 0.08),
        4px 0 8px 0 rgba(0, 0, 0, 0.08),
        0 6px 8px 0 rgba(0, 0, 0, 0.08),
        0 12px 24px -8px rgba(0, 0, 0, 0.35);
    clip-path: inset(-100px -100px -50px -100px);
}

.logo-container::before {
    content: '';
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 100px;
    background: #ffffff;
    border-radius: 0;
}

.header-actions {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.search-type-selector {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.logo {
    font-size: 3.2rem;
    font-weight: 700;
    color: #2C2C2C;
    letter-spacing: -1px;
    margin-bottom: 8px;
    position: relative;
    display: block;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.logo-image {
    height: 58.5px;
    width: auto;
    display: block;
    margin: 0 auto;
}

/* Removed logo underline */

.subtitle {
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 8px;
    letter-spacing: 0.5px;
    line-height: 1.6;
    text-align: center;
}

.subtitle-brand {
    color: #DB4033;
    font-size: 0.9rem;
    font-weight: 600;
    margin-right: 8px;
}

.subtitle-tagline {
    color: #413F8D;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Header Actions */
.header-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 10002;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: transparent;
    backdrop-filter: blur(8px);
    border: 2px solid #000000;
    border-radius: 24px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: #000000;
    transition: var(--transition);
    box-shadow: none;
    white-space: nowrap;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.7);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: var(--primary-color);
    transform: translateY(-2px);
}

/* Footer Icon Buttons (Theme and Delete History) */
.footer-icon-btn {
    padding: 8px;
    background: transparent !important;
    border: none !important;
    backdrop-filter: none;
    box-shadow: none !important;
}

.footer-icon-btn:hover {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--primary-color);
    transform: translateY(-2px);
}

.footer-icon-btn svg {
    width: 20px;
    height: 20px;
}

.action-icon {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.palette-icon {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

/* Archive badge for archived conversations button */
.archive-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--theme-accent);
    color: white;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 4px;
}

.theme-dropdown {
    position: absolute;
    bottom: calc(100% + 10px); /* Changed from top to bottom - dropdown appears above button */
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 12px;
    min-width: 220px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.8);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px); /* Changed direction - animates upward */
    transition: var(--transition);
    z-index: 10001;
}

.theme-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 6px;
}

.theme-option:last-child {
    margin-bottom: 0;
}

.theme-option:hover {
    background: color-mix(in srgb, var(--theme-accent) 10%, transparent);
    border-color: color-mix(in srgb, var(--theme-accent) 20%, transparent);
}

.theme-option.active {
    background: color-mix(in srgb, var(--theme-accent) 15%, transparent);
    border-color: var(--theme-accent);
}

.theme-preview {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.red-preview {
    background: linear-gradient(135deg, #ffffff 0%, #ffffff 50%, #DB4033 50%, #DB4033 100%);
}

.blue-preview {
    background: linear-gradient(135deg, #ffffff 0%, #ffffff 50%, #413F8D 50%, #413F8D 100%);
}

.theme-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Template Dropdown */
.template-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 12px;
    min-width: 220px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.8);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 10001;
}

.template-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.template-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 6px;
}

.template-option:last-child {
    margin-bottom: 0;
}

.template-option:hover {
    background: color-mix(in srgb, var(--theme-accent) 10%, transparent);
    border-color: color-mix(in srgb, var(--theme-accent) 20%, transparent);
}

.template-option.active {
    background: color-mix(in srgb, var(--theme-accent) 15%, transparent);
    border-color: color-mix(in srgb, var(--theme-accent) 30%, transparent);
}

.template-toggle {
    position: relative;
}

/* Search Type Selector */
.search-type-selector {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 35px;
    position: relative;
    z-index: 1;
}

.type-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    border: 2px solid transparent;
    background: #ffffff;
    backdrop-filter: blur(8px);
    border-radius: 28px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #000000;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.type-btn.active {
    background: var(--primary-color);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.type-btn .icon {
    width: 22px;
    height: 22px;
    stroke-width: 2.5;
}

/* Search Container */
.search-container {
    max-width: 900px;
    margin: 0 auto;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    border: 2px solid color-mix(in srgb, var(--theme-accent) 15%, transparent);
    border-radius: 30px;
    padding: 0 24px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    transition: var(--transition);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--theme-accent) 12%, transparent);
    z-index: 1;
}


.search-box:hover {
    box-shadow: 0 12px 32px color-mix(in srgb, var(--theme-accent) 20%, transparent);
    border-color: color-mix(in srgb, var(--theme-accent) 30%, transparent);
    background: rgba(255, 255, 255, 0.85);
}

.search-box:focus-within {
    box-shadow: 0 16px 40px color-mix(in srgb, var(--theme-accent) 25%, transparent);
    border-color: var(--theme-accent);
    background: rgba(255, 255, 255, 0.9);
}

.search-icon {
    width: 24px;
    height: 24px;
    color: var(--theme-accent);
    stroke-width: 2.5;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 20px 18px;
    font-size: 1.1rem;
    color: var(--text-primary);
    background: transparent;
    font-weight: 500;
    resize: none;
    overflow: hidden;
    font-family: inherit;
    line-height: 1.4;
    min-height: 24px;
    max-height: 120px;
}

.search-input::placeholder {
    color: color-mix(in srgb, var(--theme-text) 60%, transparent);
    font-weight: 400;
}

.clear-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-color);
    transition: var(--transition);
}

.clear-btn:hover {
    color: var(--text-primary);
}

.clear-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

/* Search Buttons */
.search-buttons {
    display: flex;
    justify-content: flex-start;
    gap: 18px;
    margin-top: 30px;
}

.btn {
    padding: 14px 32px;
    border: none;
    border-radius: 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--theme-accent) 20%, transparent);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: 2px solid transparent;
}

.btn-primary:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
    background: var(--primary-hover);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.7);
    color: var(--theme-accent);
    border: 2px solid color-mix(in srgb, var(--theme-accent) 30%, transparent);
    backdrop-filter: blur(8px);
}

.btn-secondary:hover {
    box-shadow: 0 6px 20px color-mix(in srgb, var(--theme-accent) 25%, transparent);
    border-color: var(--theme-accent);
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
}

/* Inline Search Button */
/* Search button outside box - desktop */
.search-btn-external {
    margin-top: 16px;
    padding: 14px 48px;
    font-size: 1rem;
    align-self: center;
}

/* Loading Indicator */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 40px 60px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 500;
}

/* Results Container */
.results-container {
    max-width: 1200px;
    margin: 40px auto 0;
    margin-left: calc((100vw - 1400px) / 2 - 20px);
    padding: 0 20px;
    transition: max-width 0.3s ease, margin-left 0.3s ease;
}

/* Adjust results container when AI Assistant is open - reduce width */
body:has(.ai-assistant.show) .results-container {
    max-width: calc(1200px - 100px);
}

/* Grid view uses same max-width as list view */
.results-container:has(.results-list.grid-view) {
    max-width: 1200px;
}

/* Adjust grid view when AI Assistant is open */
body:has(.ai-assistant.show) .results-container:has(.results-list.grid-view) {
    max-width: calc(1200px - 100px);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 15px;
    margin-bottom: 20px;
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 4px;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.view-btn .icon {
    width: 18px;
    height: 18px;
}

.view-btn:hover {
    background: rgba(26, 115, 232, 0.08);
    color: var(--primary-color);
}

.view-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.results-count {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Result Item */
.result-item {
    padding: 15px;
    background: #FFFFFF;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: var(--transition);
}

.result-item:hover {
    border-color: var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.result-url {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.result-favicon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #f8f9fa;
}

.result-link {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    max-width: 600px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-link-small {
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 600px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.contact-icons {
    display: inline-flex;
    gap: 6px;
    margin-left: 8px;
    align-items: center;
}

.contact-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 4px;
    border-radius: 50%;
    background: #f1f3f4;
    color: #5f6368;
    text-decoration: none;
    transition: all 0.2s ease;
}

.contact-icon:hover {
    background: var(--theme-accent);
    color: white;
    transform: scale(1.1);
}

.contact-icon svg {
    width: 14px;
    height: 14px;
}

.result-title {
    margin: 4px 0;
}

.result-title a {
    color: #1a73e8;
    font-size: 1.4rem;
    font-weight: 400;
    text-decoration: none;
    line-height: 1.3;
}

.result-title a:hover {
    text-decoration: underline;
}

.result-title a:visited {
    color: #609;
}

.result-snippet {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-top: 4px;
}

.result-full-url {
    margin-top: 6px;
    font-size: 0.95rem;
}

.result-full-url a {
    color: #1a73e8;
    text-decoration: none;
    word-break: break-all;
    font-size: 0.95rem;
}

.result-full-url a:hover {
    text-decoration: underline;
}

.result-meta {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.result-url-meta {
    font-size: 0.8rem;
    color: #1a73e8;
    word-break: break-all;
}

.result-score {
    background: #e8f0fe;
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.8rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.result-date {
    color: #5f6368;
    font-size: 13px;
    font-weight: 400;
}

/* Product Result */
.product-item {
    display: flex;
    gap: 20px;
    padding: 15px;
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: var(--transition);
    overflow: hidden;
}

.product-item:hover {
    box-shadow: var(--shadow);
}

.product-image-container {
    width: 310px;
    min-width: 310px;
    height: 310px;
    min-height: 310px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    padding-bottom: 45px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

/* List view carousel wrapper */
.list-images-wrapper {
    position: absolute;
    top: 20px;
    bottom: 45px;
    left: 20px;
    right: 20px;
    display: flex;
    overflow: visible;
    width: 100%;
}

.list-images-wrapper .product-image {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #ffffff !important;
    padding: 10px;
    box-sizing: border-box;
}

/* Dots for list view */
.list-image-dots {
    position: absolute;
    bottom: 8px;
    left: 20px;
    right: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    z-index: 2;
}

.list-image-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.list-image-dots .dot:hover {
    background: var(--theme-accent);
    opacity: 0.7;
    transform: scale(1.15);
}

.list-image-dots .dot.active {
    background: var(--theme-accent);
    border-color: var(--theme-accent);
    transform: scale(1.2);
}

.product-image {
    max-width: 100%;
    max-height: 300px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    background-color: #ffffff !important;
}

.product-image-placeholder {
    width: 300px;
    height: 300px;
    background: #f8f9fa;
    border-radius: 4px;
}

.product-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.product-info .result-header {
    margin-bottom: 4px;
}

.product-title {
    font-size: 1.3rem;
    font-weight: 500;
    color: #1a73e8;
    text-decoration: none;
    margin-bottom: 8px;
    display: block;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.product-title:hover {
    text-decoration: underline;
}

.product-title:visited {
    color: #609;
}

.product-price {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2C2C2C;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.product-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 8px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.original-price {
    text-decoration: line-through;
    color: #999;
    font-size: 0.95rem;
    font-weight: 400;
    opacity: 0.8;
}

.current-price {
    color: #2C2C2C;
    font-weight: 700;
    font-size: 1.3rem;
}

.product-url {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #1a73e8;
    font-size: 0.95rem;
    text-decoration: none;
    margin-top: 8px;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: break-all;
}

.product-url .result-favicon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.product-url:hover {
    text-decoration: underline;
    color: #1557b0;
}

/* Grid View (TikTok-style feed) */
.results-list.grid-view {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 1200px;
}

.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    overflow: hidden;
}

.card-link:hover .card-title {
    text-decoration: underline;
}

.card-image-container {
    width: 100%;
    padding-top: 100%; /* 1:1 Aspect Ratio */
    position: relative;
    background: #ffffff;
    overflow: hidden;
}

.card-images-wrapper {
    position: absolute;
    top: 20px;
    bottom: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    overflow: visible;
    width: 100%;
}

.card-image {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #ffffff !important;
    padding: 10px;
    box-sizing: border-box;
}

.product-card:hover .card-image {
    transform: scale(1.05);
}

/* Image carousel dots */
.image-dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 12px 0 8px 0;
}

.image-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.image-dots .dot:hover {
    background: var(--theme-accent);
    opacity: 0.7;
    transform: scale(1.15);
}

.image-dots .dot.active {
    background: var(--theme-accent);
    border-color: var(--theme-accent);
    transform: scale(1.2);
}

.card-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    color: #999;
    font-size: 0.85rem;
}

.card-content {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1a73e8;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.grid-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2C2C2C;
    margin-top: auto;
}

.grid-price .original-price {
    display: block;
    font-size: 0.85rem;
    text-decoration: line-through;
    color: #999;
    font-weight: 400;
    margin-bottom: 4px;
    opacity: 0.8;
}

.grid-price .current-price {
    color: #2C2C2C;
    font-size: 1.2rem;
}

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

.card-score {
    font-size: 0.75rem;
    color: var(--theme-accent);
    background: color-mix(in srgb, var(--theme-accent) 10%, transparent);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.card-url {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    color: #1a73e8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 4px;
    opacity: 0.9;
    word-break: break-all;
}

.card-favicon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Product Colors */
.product-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0;
}

.color-badge {
    display: inline-block;
    padding: 4px 10px;
    background-color: #f0f0f0;
    color: #333;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
    border: 1px solid #e0e0e0;
    transition: all 0.2s ease;
}

.color-badge:hover {
    background-color: #e5e5e5;
    border-color: #d0d0d0;
}

.color-badge-active {
    background-color: var(--theme-accent);
    color: white;
    border-color: var(--theme-accent);
    font-weight: 600;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--theme-accent) 35%, transparent);
}

.color-badge-active:hover {
    background-color: color-mix(in srgb, var(--theme-accent) 85%, black);
    border-color: color-mix(in srgb, var(--theme-accent) 85%, black);
}

/* Color source indicator (options, title, or images) */
.color-source-indicator {
    display: inline-block;
    margin-left: 8px;
    padding: 3px 8px;
    background-color: #6c757d;
    color: white;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    vertical-align: middle;
    opacity: 0.75;
    text-transform: lowercase;
}

/* Responsive Grid */
/* Tablet: 2 columns */
@media (max-width: 1024px) {
    .results-list.grid-view {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .results-container {
        margin-left: 20px;
        max-width: calc(100% - 40px);
    }

    .results-container:has(.results-list.grid-view) {
        max-width: calc(100% - 40px);
    }

    /* With AI Assistant open on tablet: keep 2 columns but narrower */
    body:has(.ai-assistant.show) .results-container:has(.results-list.grid-view) {
        max-width: calc(100% - 120px);
    }
}

/* Mobile: 1 column + Full-screen AI Assistant */
@media (max-width: 640px) {
    .results-list.grid-view {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .results-container:has(.results-list.grid-view) {
        max-width: 100%;
        padding: 0 12px;
    }

    /* List view also full width on mobile */
    .results-container {
        max-width: 100%;
        padding: 0 12px;
        margin: 20px 0 0 12px;
    }

    /* AI Assistant: Full-screen overlay on mobile */
    .ai-assistant {
        width: 100vw;
        max-width: 100vw;
        box-shadow: none;
    }

    /* When AI Assistant is open on mobile, hide results container */
    body:has(.ai-assistant.show) .results-container {
        max-width: 100%;  /* No width reduction on mobile */
    }

    .view-toggle {
        flex-direction: column;
        gap: 4px;
    }

    .view-btn {
        width: 100%;
        justify-content: center;
    }
}

/* No Results */
.no-results {
    text-align: center;
    margin: 60px 0;
}

.no-results-icon {
    width: 80px;
    height: 80px;
    color: var(--border-color);
    stroke-width: 1.5;
    margin-bottom: 20px;
}

.no-results h2 {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.no-results p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Error Message */
.error-message {
    text-align: center;
    margin: 60px 0;
}

.error-icon {
    width: 80px;
    height: 80px;
    color: var(--error-color);
    stroke-width: 1.5;
    margin-bottom: 20px;
}

.error-message h2 {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--error-color);
    margin-bottom: 10px;
}

.error-message p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    padding: 24px;
    color: #6B6B6B;
    font-size: 0.9rem;
    margin-top: auto;
    opacity: 1;
    border-top: 1px solid rgba(255, 140, 100, 0.15);
    font-weight: 500;
    flex-shrink: 0;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-left {
    flex: 1;
    text-align: left;
}

.footer-copyright {
    font-size: 0.75rem;
    margin: 0;
}

.version-info {
    display: inline-block;
    font-size: 0.85rem;
    opacity: 0.8;
}

.frontend-version,
.backend-version,
.model-info {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
}

.backend-version {
    margin-left: 4px;
}

.model-info {
    margin-left: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.info-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.info-icon-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

.info-icon-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

/* Database Statistics Modal */
.stats-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.stats-modal {
    background: var(--card-bg, #ffffff);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    min-width: 320px;
    max-width: 90vw;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stats-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.stats-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
}

.stats-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary, #666);
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease;
}

.stats-modal-close:hover {
    color: var(--text-primary, #1a1a1a);
}

.stats-modal-body {
    padding: 20px;
}

.stats-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.stats-item:last-child {
    border-bottom: none;
}

.stats-label {
    font-size: 0.95rem;
    color: var(--text-secondary, #666);
}

.stats-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
    font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Manifest Button & Terms Button */
/* Hamburger Menu Container */
.hamburger-menu-container {
    position: relative;
    display: none;
}

/* Hamburger Menu Button - Hidden on Desktop */
.hamburger-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    border: 2px solid color-mix(in srgb, var(--theme-accent) 40%, transparent);
    border-radius: 12px;
    color: var(--theme-accent);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hamburger-menu-btn:hover {
    background: var(--theme-accent);
    color: white;
    border-color: var(--theme-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.hamburger-icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.hamburger-text {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
}

/* Hamburger Dropdown Menu */
.hamburger-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 8px;
    min-width: 220px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    border: 2px solid color-mix(in srgb, var(--theme-accent) 20%, transparent);
    z-index: 1000;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.hamburger-dropdown.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.hamburger-menu-item {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--theme-text);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hamburger-menu-item:hover {
    background: color-mix(in srgb, var(--theme-accent) 15%, transparent);
    color: var(--theme-accent);
    transform: translateX(4px);
}

.manifest-btn,
.terms-btn {
    padding: 8px 20px;
    background: transparent;
    border: 2px solid #000000;
    border-radius: 12px;
    color: #000000;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.manifest-btn:hover,
.terms-btn:hover {
    background: rgba(255, 255, 255, 0.7);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.manifest-btn:active,
.terms-btn:active {
    transform: translateY(0);
}


/* ===== ANIMATIONS ===== */

/* Page Load Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Staggered Results Entry */
@keyframes resultSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Skeleton Loading */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Progress Bar */
@keyframes progressBar {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Ripple Effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.6;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Notification Animations */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideOutUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-100%);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes checkmark {
    0% {
        stroke-dashoffset: 100;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

/* Image Loading Effects */
@keyframes blurIn {
    from {
        filter: blur(10px);
        opacity: 0.5;
    }
    to {
        filter: blur(0);
        opacity: 1;
    }
}

/* Floating Animation for Back to Top */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Apply page load animations */
.header {
    opacity: 0;
    animation: slideDown 0.6s ease 0.1s forwards;
}

.search-type-selector {
    opacity: 0;
    animation: fadeIn 0.6s ease 0.3s forwards;
}

.search-container {
    opacity: 0;
    animation: scaleIn 0.6s ease 0.4s forwards;
}

/* Hide gradients and apply static background when results are shown */
body:has(#resultsContainer:not([style*="display: none"])) {
    background: #E4E7ED !important;
}

body:has(#resultsContainer:not([style*="display: none"]))::before,
body:has(#resultsContainer:not([style*="display: none"]))::after {
    display: none !important;
}

html:has(#resultsContainer:not([style*="display: none"]))::before {
    display: none !important;
}

/* Hide home section when results are displayed */
body:has(#resultsContainer:not([style*="display: none"])) .container {
    display: none !important;
}

/* Always show compact header when results are displayed */
body:has(#resultsContainer:not([style*="display: none"])) .compact-header {
    display: block !important;
    transform: translateY(0) !important;
}

/* Add padding to results container to make room for fixed compact header */
body:has(#resultsContainer:not([style*="display: none"])) #resultsContainer {
    padding-top: 80px !important;
}

/* Ensure body has scrolled class when results are shown */
body:has(#resultsContainer:not([style*="display: none"])) {
    padding-top: 0 !important;
}

/* Progress Bar Styles */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    z-index: 9999;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color), var(--primary-color));
    background-size: 200% 100%;
    animation: progressBar 1.5s ease-in-out infinite;
}

/* Skeleton Loading Styles */
.skeleton-container {
    max-width: 750px;
    margin: 40px auto 0;
    padding: 0 20px;
}

.skeleton-item {
    margin-bottom: 30px;
    animation: fadeIn 0.3s ease;
}

.skeleton-line {
    height: 16px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
    border-radius: 4px;
    margin-bottom: 10px;
}

.skeleton-title {
    height: 24px;
    width: 70%;
    margin-bottom: 12px;
}

.skeleton-url {
    height: 14px;
    width: 40%;
    margin-bottom: 8px;
}

.skeleton-snippet {
    height: 16px;
    width: 100%;
}

.skeleton-snippet:last-child {
    width: 85%;
}

.skeleton-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-card-image {
    width: 100%;
    padding-top: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

.skeleton-card-content {
    padding: 16px;
}

/* Notification System */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.notification {
    background: white;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInDown 0.3s ease;
    border-left: 4px solid var(--primary-color);
}

.notification.success {
    border-left-color: var(--success-color);
}

.notification.error {
    border-left-color: var(--error-color);
    animation: slideInDown 0.3s ease, shake 0.5s ease 0.3s;
}

.notification.warning {
    border-left-color: var(--warning-color);
}

.notification.hiding {
    animation: slideOutUp 0.3s ease forwards;
}

.notification-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.notification-icon.success {
    color: var(--success-color);
}

.notification-icon.error {
    color: var(--error-color);
}

.notification-icon.warning {
    color: var(--warning-color);
}

.notification-content {
    flex: 1;
}

.notification-message {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

.notification-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-secondary);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
}

.notification-close:hover {
    color: var(--text-primary);
}

.notification-close svg {
    width: 18px;
    height: 18px;
}

/* Floating Action Buttons Container */
.floating-buttons {
    position: fixed;
    bottom: 100px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
}

/* Common Floating Button Styles */
.floating-btn {
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.4);
    transition: var(--transition);
}

.floating-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(26, 115, 232, 0.5);
}

.floating-btn svg {
    width: 24px;
    height: 24px;
}

/* AI Assistant Floating Button - Hidden on homepage, shown on results page */
.ai-assistant-btn {
    display: none;
    animation: float 3s ease-in-out infinite;
}

/* Show AI Assistant button on results page */
body:has(#resultsContainer:not([style*="display: none"])) .ai-assistant-btn {
    display: flex;
}

.ai-assistant-btn.active {
    background: var(--primary-hover);
    box-shadow: 0 6px 16px rgba(26, 115, 232, 0.6);
}

/* Back to Top Button */
.back-to-top {
    display: none;
    animation: float 3s ease-in-out infinite;
}

.back-to-top.show {
    display: flex;
    animation: scaleIn 0.3s ease, float 3s ease-in-out infinite 0.3s;
}

/* Staggered Results Animation */
.result-item, .product-item, .product-card {
    opacity: 0;
    animation: resultSlideIn 0.4s ease forwards;
}

/* View Mode Transition */
.results-list {
    transition: var(--transition-slow);
}

.results-list.transitioning {
    opacity: 0.5;
}

/* Search Box Enhancements */
.search-box {
    transition: var(--transition), transform 0.2s ease;
}

.search-box.focused {
    transform: scale(1.02);
}

.search-input {
    transition: var(--transition);
}

.clear-btn {
    opacity: 0;
    transform: scale(0.8);
    transition: var(--transition-fast);
}

.clear-btn.show {
    opacity: 1;
    transform: scale(1);
}

/* Button Ripple Effect */
.btn, .type-btn, .view-btn {
    position: relative;
    overflow: hidden;
}

.btn::after, .type-btn::after, .view-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::after, .type-btn:active::after, .view-btn:active::after {
    width: 300px;
    height: 300px;
}

/* Image Loading Effects */
.card-image, .product-image {
    opacity: 0;
    transition: var(--transition);
}

.card-image.loaded, .product-image.loaded {
    opacity: 1;
    animation: blurIn 0.5s ease;
}

.image-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* 3D Tilt Effect for Product Cards */
.product-card {
    perspective: 1000px;
    transform-style: preserve-3d;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    transform: translateY(-8px) rotateX(2deg);
}

.product-item {
    perspective: 1000px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-item:hover {
    transform: translateY(-2px);
}

/* Magnetic Button Effect */
.btn-primary, .btn-secondary {
    transition: var(--transition), transform 0.1s ease;
}

.search-buttons .btn:hover {
    transform: translateY(-2px);
}

/* Enhanced Type Button Animation */
.type-btn {
    transition: var(--transition), transform 0.2s ease;
}

.type-btn:hover {
    transform: translateY(-2px);
}

.type-btn.active {
    animation: scaleIn 0.3s ease;
}

/* Loading Spinner Enhancement */
.spinner {
    animation: spin 1s linear infinite, pulse 2s ease-in-out infinite;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
}

.typing-indicator.show {
    display: flex;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: pulse 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Show hamburger menu, hide desktop buttons on mobile/tablet */
    .hamburger-menu-container {
        display: block;
    }

    .desktop-only {
        display: none !important;
    }

    /* Compact Header Responsive */
    .compact-header {
        padding: 10px 15px;
    }

    .compact-header-content {
        gap: 12px;
    }

    .compact-logo-image {
        height: 28px;
    }

    .compact-type-selector {
        gap: 6px;
    }

    .compact-type-btn {
        width: 36px;
        height: 36px;
    }

    .compact-type-btn .icon {
        width: 18px;
        height: 18px;
    }

    .compact-search-box {
        padding: 0 12px;
    }

    .compact-search-input {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .compact-search-btn {
        padding: 0 !important;
        width: 44px !important;
        height: 44px;
        min-width: 44px;
        border-radius: 12px;
        justify-content: center;
        align-items: center;
        flex-shrink: 0;
        position: relative;
        overflow: visible;
    }

    .compact-btn-icon {
        display: block !important;
        width: 20px !important;
        height: 20px !important;
        margin: 0;
        stroke: white !important;
        color: white !important;
        fill: none !important;
        position: relative;
        z-index: 10;
        pointer-events: none;
    }

    .compact-btn-text {
        display: none;
    }

    .compact-ai-toggle {
        width: 40px;
        height: 40px;
    }

    .compact-ai-toggle svg {
        width: 18px;
        height: 18px;
    }

    .container {
        padding: 20px 30px;
    }

    .header {
        margin: 15px 0 35px;
        padding: 25px 30px;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-left {
        text-align: center;
        order: 2;
    }

    .footer-right {
        order: 1;
    }

    /* Hide version info on mobile */
    .version-info {
        display: none !important;
    }

    .header-actions {
        width: 100%;
    }

    .action-btn {
        width: 100%;
        justify-content: center;
    }

    .theme-dropdown {
        left: 0;
        right: auto;
        width: 100%;
    }

    .logo {
        font-size: 2.8rem;
    }

    .logo-image {
        height: 48.75px;
    }

    .subtitle {
        font-size: 0.675rem;
    }

    .subtitle-brand {
        font-size: 0.7875rem;
    }

    .subtitle-tagline {
        font-size: 0.675rem;
    }

    .search-type-selector {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        padding-left: 0;
        gap: 8px;
    }

    .type-btn {
        padding: 12px;
        min-width: auto;
    }

    /* Hide text on mobile, show only icons */
    .type-btn span:not(.icon) {
        display: none;
    }

    .type-btn .icon {
        margin: 0;
    }

    .search-container {
        margin: 0;
        max-width: 100%;
        position: relative;
    }

    .search-box {
        padding: 0 18px;
        position: relative;
    }

    .search-box {
        min-height: 60px;
        align-items: flex-start;
    }

    /* Hide search icon on mobile */
    .search-icon {
        display: none;
    }

    .search-input {
        font-size: 1rem;
        padding: 18px 15px;
        line-height: 1.5;
        min-height: 24px;
        overflow-y: auto;
        max-height: 150px;
    }

    /* Reposition typing indicator on mobile */
    .typing-indicator {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        margin-left: auto;
        padding: 8px;
    }

    /* Search button outside box - mobile (smaller and centered) */
    .search-btn-external {
        margin-top: 16px;
        width: auto;
        min-width: 140px;
        max-width: 180px;
        padding: 12px 32px;
        font-size: 0.95rem;
        align-self: center;
    }

    .btn {
        width: 100%;
        padding: 16px 28px;
    }

    .product-item {
        flex-direction: column;
    }

    .product-image {
        width: 100%;
        height: 200px;
    }

    .results-container {
        padding: 0 15px;
    }

    /* Adjust compact logo for mobile */
    .compact-logo {
        font-size: 0.95rem;
        margin-right: 12px;
        padding-right: 12px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px 20px;
    }

    .header {
        padding: 20px 25px;
    }

    .logo {
        font-size: 2.2rem;
    }

    .logo-image {
        height: 39px;
    }

    .subtitle {
        font-size: 0.6375rem;
    }

    .subtitle-brand {
        font-size: 0.75rem;
    }

    .subtitle-tagline {
        font-size: 0.6375rem;
    }

    .search-box {
        padding: 0 15px;
    }

    .search-icon {
        width: 20px;
        height: 20px;
    }

    .search-input {
        font-size: 0.95rem;
        padding: 16px 12px;
    }

    .type-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    .btn {
        font-size: 0.95rem;
        padding: 14px 24px;
    }

    .result-title a {
        font-size: 1.2rem;
    }

    .product-title {
        font-size: 1.15rem;
    }

    .card-title {
        font-size: 0.95rem;
    }

    /* Smaller compact logo for small mobile */
    .compact-logo {
        font-size: 0.85rem;
        margin-right: 8px;
        padding-right: 8px;
    }
}

/* ===== AI ASSISTANT PANEL ===== */
.ai-assistant {
    position: fixed;
    right: 0;
    top: 0;
    width: 320px;
    max-width: 320px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease, padding-top 0.3s ease, width 0.3s ease;
}

/* Adjust AI Assistant position when scrolled (to show below compact header) */
body.scrolled .ai-assistant {
    padding-top: 68px;
}

.ai-assistant.show {
    transform: translateX(0);
}

/* Mobile: Full-screen AI Assistant */
@media (max-width: 640px) {
    .ai-assistant {
        width: 100vw;
        max-width: 100vw;
        background: white;  /* Solid background on mobile */
        box-shadow: none;
        z-index: 20000;  /* Higher z-index to overlay everything */
    }

    /* On mobile when scrolled, no padding-top (full screen) */
    body.scrolled .ai-assistant {
        padding-top: 0;
    }

    /* Add a backdrop overlay on mobile when AI is open */
    body:has(.ai-assistant.show)::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 19999;
        pointer-events: none;
    }
}

/* Push main content left when AI panel is open (desktop only) */
@media (min-width: 769px) {
    body.ai-panel-open .container {
        margin-right: 400px;
        transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Smooth transition for content */
    .container {
        transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Keep header text centered by adding left margin to compensate */
    body.ai-panel-open .header-text {
        margin-left: 200px;
        transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .header-text {
        transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* Animate AI icon in the panel header when panel is open */
.ai-assistant.show .ai-icon {
    animation: aiIconPulse 2s ease-in-out infinite;
    transform-origin: center;
}

@keyframes aiIconPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

.ai-assistant-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid color-mix(in srgb, var(--theme-accent) 20%, transparent);
    background: linear-gradient(135deg, color-mix(in srgb, var(--theme-accent) 10%, transparent), transparent);
}

.ai-assistant-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--theme-text);
}

.ai-icon {
    width: 28px;
    height: 28px;
    stroke-width: 2.5;
    color: var(--theme-accent);
}

.ai-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-secondary);
    transition: var(--transition);
    border-radius: 8px;
}

.ai-close-btn:hover {
    background: color-mix(in srgb, var(--theme-accent) 15%, transparent);
    color: var(--theme-accent);
}

.ai-close-btn svg {
    width: 20px;
    height: 20px;
}

.ai-assistant-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
}

.ai-section {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid color-mix(in srgb, var(--theme-accent) 15%, transparent);
    animation: fadeInUp 0.4s ease;
}

.ai-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--theme-text);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-section-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--theme-accent);
    border-radius: 2px;
}

/* Collapsible AI Sections */
.ai-section-collapsible .ai-section-toggle {
    cursor: pointer;
    user-select: none;
    justify-content: space-between;
    margin-bottom: 0;
    transition: margin-bottom 0.3s ease;
}

.ai-section-collapsible:not(.collapsed) .ai-section-toggle {
    margin-bottom: 12px;
}

.ai-section-toggle:hover {
    opacity: 0.8;
}

.ai-toggle-icon {
    width: 18px;
    height: 18px;
    min-width: 18px;
    color: var(--theme-accent);
    transition: transform 0.3s ease;
}

.ai-section-collapsible.collapsed .ai-toggle-icon {
    transform: rotate(-90deg);
}

.ai-section-content {
    overflow: hidden;
    max-height: 1000px;
    opacity: 1;
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
}

.ai-section-collapsible.collapsed .ai-section-content {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.ai-query-display {
    background: color-mix(in srgb, var(--theme-accent) 8%, transparent);
    padding: 12px;
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-primary);
    border-left: 3px solid var(--theme-accent);
}

.ai-criteria-list,
.ai-learning-list,
.ai-search-analysis {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-criterion,
.ai-learning-item,
.ai-analysis-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    background: white;
    border-radius: 8px;
    font-size: 0.85rem;
    border: 1px solid color-mix(in srgb, var(--theme-accent) 20%, transparent);
    transition: var(--transition);
}

.ai-criterion:hover {
    box-shadow: 0 2px 8px color-mix(in srgb, var(--theme-accent) 15%, transparent);
    transform: translateX(-2px);
}

.ai-criterion-label,
.ai-analysis-label {
    font-weight: 600;
    color: var(--theme-text);
    min-width: 80px;
}

.ai-criterion-value,
.ai-analysis-value {
    flex: 1;
    color: var(--text-primary);
    background: color-mix(in srgb, var(--theme-accent) 10%, transparent);
    padding: 4px 10px;
    border-radius: 6px;
    text-align: center;
}

.ai-criterion-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-secondary);
    transition: var(--transition);
    border-radius: 4px;
}

.ai-criterion-remove:hover {
    background: rgba(234, 67, 53, 0.1);
    color: var(--error-color);
}

.ai-criterion-remove svg {
    width: 16px;
    height: 16px;
}

/* AI Attributes Styling */
.ai-analysis-attributes {
    padding: 10px 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--theme-accent) 20%, transparent);
}

.ai-analysis-attributes .ai-analysis-label {
    margin-bottom: 8px;
    display: block;
}

.ai-attributes-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-attribute-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.ai-attribute-type {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ai-attribute-type.visual {
    background: #e3f2fd;
    color: #1976d2;
}

.ai-attribute-type.text {
    background: #f3e5f5;
    color: #7b1fa2;
}

.ai-attribute-type.both {
    background: #e8f5e9;
    color: #388e3c;
}

.ai-attribute-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.ai-attribute-badge.visual {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

.ai-attribute-badge.text {
    background: #f3e5f5;
    color: #6a1b9a;
    border: 1px solid #ce93d8;
}

.ai-attribute-badge.both {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

/* Exclusion badges - red/warning style */
.ai-attribute-badge.exclude {
    background: #ffebee !important;
    color: #c62828 !important;
    border: 1px solid #ef9a9a !important;
}

.ai-attribute-badge.include {
    /* Keep original colors but slightly enhanced */
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

/* Gender filter badges */
.ai-attribute-type.gender {
    background: #fff3e0;
    color: #e65100;
}

.ai-attribute-badge.gender-include {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
}

.ai-attribute-badge.gender-exclude {
    background: #fce4ec;
    color: #c2185b;
    border: 1px solid #f48fb1;
}

.ai-attribute-group.gender-filters {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dashed #e0e0e0;
}

/* Product Card Attribute Match Styling */
.attribute-match {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
}

.attribute-match.high {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.attribute-match.medium {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.attribute-match.low {
    background: rgba(158, 158, 158, 0.1);
    border: 1px solid rgba(158, 158, 158, 0.3);
}

.attr-score {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.attribute-match.high .attr-score {
    color: #388e3c;
}

.attribute-match.medium .attr-score {
    color: #f57c00;
}

.attribute-match.low .attr-score {
    color: #757575;
}

.attr-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.attr-tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.attr-tag.include {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.attr-tag.exclude-avoided {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.attr-tag.exclude-found {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
    font-weight: 600;
}

.attr-tag.visual {
    background: #e3f2fd;
    color: #1565c0;
}

.attr-tag.text {
    background: #f3e5f5;
    color: #6a1b9a;
}

.attr-tag.both {
    background: #e8f5e9;
    color: #2e7d32;
}

.attr-tag.gender-match {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

.attr-tag.gender-avoided {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.attr-tag.gender-found {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
    font-weight: 600;
}

.attr-tag.learned-color {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
}

.attr-tag.learned-price {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #ce93d8;
}

.learned-match {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    padding: 4px 0;
}

.learned-score {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #e65100;
    font-size: 0.75rem;
}

.learned-score svg {
    color: #e65100;
}

.ai-decision-tree {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-plan-intro {
    font-size: 0.9rem;
    color: var(--theme-accent);
    font-weight: 600;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: color-mix(in srgb, var(--theme-accent) 10%, transparent);
    border-radius: 6px;
    border-left: 3px solid var(--theme-accent);
}

.ai-decision-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    position: relative;
}

.ai-decision-step::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 100%;
    width: 2px;
    height: 12px;
    background: color-mix(in srgb, var(--theme-accent) 30%, transparent);
}

.ai-decision-step:last-child::before {
    display: none;
}

.ai-decision-checkbox {
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--theme-accent);
}

.ai-decision-checkbox:disabled {
    cursor: default;
    opacity: 0.6;
}

.ai-decision-text {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.ai-learning-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-learning-icon {
    width: 20px;
    height: 20px;
    min-width: 20px;
    color: var(--theme-accent);
}

.ai-learning-text {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.ai-learning-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-secondary);
    transition: var(--transition);
    border-radius: 4px;
    opacity: 0.6;
}

.ai-learning-remove:hover {
    background: rgba(234, 67, 53, 0.1);
    color: var(--error-color);
    opacity: 1;
}

.ai-learning-remove svg {
    width: 16px;
    height: 16px;
}

.ai-learning-item:hover .ai-learning-remove {
    opacity: 1;
}

/* ===== AI CONVERSATION CHAT STYLES ===== */
.ai-conversation-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 0;
    max-height: 100%;
}

.ai-chat-message {
    display: flex;
    animation: fadeInUp 0.3s ease;
}

.ai-chat-user {
    justify-content: flex-end;
}

.ai-chat-assistant {
    justify-content: flex-start;
}

.ai-chat-bubble {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 90%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.85rem;
    line-height: 1.5;
}

.ai-chat-user .ai-chat-bubble {
    background: var(--theme-accent);
    color: white;
    border-bottom-right-radius: 4px;
    flex-direction: row-reverse;
}

.ai-chat-assistant .ai-chat-bubble {
    background: white;
    color: var(--text-primary);
    border: 1px solid color-mix(in srgb, var(--theme-accent) 20%, transparent);
    border-bottom-left-radius: 4px;
}

.ai-chat-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.ai-chat-text {
    flex: 1;
}

.ai-chat-text strong {
    color: var(--theme-accent);
    font-weight: 600;
}

.ai-chat-user .ai-chat-text strong {
    color: white;
    font-weight: 700;
}

.ai-chat-compacted .ai-chat-bubble {
    background: color-mix(in srgb, var(--warning-color) 15%, white);
    border-color: var(--warning-color);
}

/* Typing Indicator */
.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 4px 0;
}

.typing-dots .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--theme-accent);
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots .dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dots .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Chat Input - Fixed at bottom of AI Assistant */
.ai-chat-input-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid color-mix(in srgb, var(--theme-accent) 15%, transparent);
    background: rgba(255, 255, 255, 0.98);
    flex-shrink: 0;
}

/* Suggested Responses */
.ai-suggested-responses {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

.ai-suggested-btn {
    padding: 8px 16px;
    background: color-mix(in srgb, var(--theme-accent) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--theme-accent) 30%, transparent);
    border-radius: 16px;
    color: var(--theme-accent);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ai-suggested-btn:hover {
    background: color-mix(in srgb, var(--theme-accent) 20%, transparent);
    border-color: var(--theme-accent);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ai-suggested-btn:active {
    transform: translateY(0);
}

/* Input row with button */
.ai-chat-input-container > div:last-child {
    display: flex;
    gap: 8px;
}

.ai-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid color-mix(in srgb, var(--theme-accent) 20%, transparent);
    border-radius: 20px;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ai-chat-input:focus {
    border-color: var(--theme-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-accent) 15%, transparent);
}

.ai-chat-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

.ai-chat-send-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--theme-accent);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.ai-chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    background: color-mix(in srgb, var(--theme-accent) 85%, black);
}

.ai-chat-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.ai-chat-send-btn svg {
    width: 18px;
    height: 18px;
}

/* Archived Conversations */
.ai-archived-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-archive-empty {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
    padding: 12px;
    font-style: italic;
}

.ai-archive-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--theme-accent) 15%, transparent);
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-archive-item:hover {
    border-color: var(--theme-accent);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--theme-accent) 15%, transparent);
}

.ai-archive-summary {
    font-size: 0.8rem;
    color: var(--text-primary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-archive-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-left: 8px;
}

.ai-archive-badge {
    text-align: center;
    padding: 8px 12px;
    background: color-mix(in srgb, var(--warning-color) 15%, white);
    border: 1px dashed var(--warning-color);
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--warning-color);
    margin-bottom: 12px;
}

.ai-actions {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid color-mix(in srgb, var(--theme-accent) 15%, transparent);
}

.ai-action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: white;
    border: 2px solid color-mix(in srgb, var(--theme-accent) 20%, transparent);
    border-radius: 10px;
    color: var(--theme-text);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.ai-action-btn:hover {
    background: color-mix(in srgb, var(--theme-accent) 10%, transparent);
    border-color: var(--theme-accent);
}

.ai-action-btn svg {
    width: 18px;
    height: 18px;
}

/* Archived Conversations Modal */
.archived-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.archived-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.archived-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid color-mix(in srgb, var(--theme-accent) 15%, transparent);
}

.archived-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--theme-text);
}

.archived-close-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    border-radius: 8px;
}

.archived-close-btn:hover {
    background: color-mix(in srgb, var(--theme-accent) 10%, transparent);
    color: var(--theme-accent);
}

.archived-close-btn svg {
    width: 20px;
    height: 20px;
}

.archived-modal .ai-archived-list {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .ai-assistant {
        width: 100%;
        max-width: 100%;
    }
}

/* ===== AI LEARNING HINT ===== */
.learning-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(219, 64, 51, 0.15);
    border-radius: 8px;
    color: #666;
    font-size: 0.9rem;
    opacity: 0;
    animation: fadeInUp 0.5s ease-out forwards;
    transition: opacity 0.5s ease-out;
}

.learning-hint.fade-out {
    opacity: 0;
}

.learning-hint-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    stroke: var(--primary-color);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== AI SEARCH SUGGESTIONS ===== */
.search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border: 1px solid color-mix(in srgb, var(--theme-accent) 15%, transparent);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.suggestion-section {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.suggestion-section:last-child {
    border-bottom: none;
}

.suggestion-header {
    padding: 8px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
}

.suggestion-item:hover {
    background: color-mix(in srgb, var(--theme-accent) 8%, transparent);
}

.suggestion-icon {
    width: 20px;
    height: 20px;
    color: var(--theme-accent);
    flex-shrink: 0;
}

.suggestion-content {
    flex: 1;
    min-width: 0;
}

.suggestion-text {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

.suggestion-subtext {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ===== MANIFEST MODAL ===== */
.manifest-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.manifest-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.manifest-modal-content {
    position: relative;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.4s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.manifest-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.manifest-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: rotate(90deg);
}

.manifest-modal-close svg {
    width: 20px;
    height: 20px;
    stroke: #333;
}

.manifest-modal-body {
    padding: 60px 60px 40px;
    overflow-y: auto;
}

.manifest-title {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--theme-accent);
    margin-bottom: 30px;
    text-align: center;
}

.manifest-text {
    font-size: 1rem;
    line-height: 1.8;
    color: #333;
}

.manifest-text p {
    margin-bottom: 20px;
}

.manifest-text p:last-child {
    margin-bottom: 0;
}

.manifest-text strong {
    color: #333;
    font-weight: 600;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .manifest-modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .manifest-modal-body {
        padding: 50px 30px 30px;
    }

    .manifest-title {
        font-size: 1.8rem;
    }

    .manifest-text {
        font-size: 0.95rem;
    }
}
