/**
 * Vision Upload Styles for AI Chat
 * v6.0 - Redesigned with v25 fonts and improved voice icons
 * Design System: Cormorant Garamond + Inter
 */

/* ========== Upload button - Photo icon ========== */
.v25-ai-chat-upload {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    margin: 0;
    background: linear-gradient(135deg, rgba(166, 90, 60, 0.08) 0%, rgba(166, 90, 60, 0.04) 100%);
    border: 1.5px solid rgba(166, 90, 60, 0.25);
    border-radius: 12px;
    color: #A65A3C;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.v25-ai-chat-upload:hover {
    background: linear-gradient(135deg, rgba(166, 90, 60, 0.15) 0%, rgba(166, 90, 60, 0.08) 100%);
    border-color: #A65A3C;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(166, 90, 60, 0.2);
}

.v25-ai-chat-upload:active {
    transform: scale(0.98);
}

.v25-ai-chat-upload:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.v25-ai-chat-upload svg {
    width: 18px;
    height: 18px;
}

/* ========== Upload hint - Styled with v25 fonts ========== */
.v25-ai-upload-hint {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 0.9375rem;
    font-weight: 500;
    font-style: italic;
    color: #78716c;
    text-align: center;
    padding: 6px 16px 10px;
    letter-spacing: 0.02em;
    line-height: 1.4;
    background: linear-gradient(90deg, transparent, rgba(166, 90, 60, 0.05), transparent);
    border-radius: 0 0 16px 16px;
}

/* Decorative elements for hint */
.v25-ai-upload-hint::before,
.v25-ai-upload-hint::after {
    content: "✦";
    color: #A65A3C;
    opacity: 0.4;
    font-size: 0.625rem;
    vertical-align: middle;
    margin: 0 8px;
}

/* ========== Image Preview (before sending) ========== */
.v25-ai-image-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin: 0 10px 6px;
    background: linear-gradient(135deg, #faf8f5 0%, #f5efe8 100%);
    border-radius: 12px;
    border: 1px solid #e8e0d5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.v25-ai-preview-thumb {
    position: relative;
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    max-width: 52px !important;
    flex-shrink: 0 !important;
    overflow: hidden !important;
}

.v25-ai-preview-thumb img {
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    max-width: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
    object-fit: cover !important;
    border-radius: 8px !important;
    border: 1.5px solid rgba(166, 90, 60, 0.2) !important;
    display: block !important;
}

/* Remove button - appears on hover */
.v25-ai-preview-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    padding: 0;
    background: #fff;
    border: 1.5px solid #e0d5c7;
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.v25-ai-preview-thumb:hover .v25-ai-preview-remove,
.v25-ai-preview-remove:focus {
    opacity: 1;
    transform: scale(1);
}

.v25-ai-preview-remove:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}

.v25-ai-preview-remove svg {
    width: 10px;
    height: 10px;
}

.v25-ai-preview-text {
    font-family: "Inter", sans-serif;
    font-size: 13px;
    color: #57534e;
    flex: 1;
}

/* ========== Image in chat message ========== */
.v25-ai-message-with-image {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 10px 14px !important;
}

.v25-ai-msg-image-thumb {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    flex-shrink: 0 !important;
    overflow: hidden !important;
    border-radius: 8px !important;
}

.v25-ai-msg-image-thumb img {
    width: 44px !important;
    height: 44px !important;
    max-width: 44px !important;
    max-height: 44px !important;
    object-fit: cover !important;
    border-radius: 8px !important;
    display: block !important;
}

.v25-ai-message-with-image span {
    font-family: "Inter", sans-serif;
    font-size: 13px !important;
    color: inherit !important;
}

/* ========== Vision progress ========== */
.v25-ai-vision-progress {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.v25-ai-vision-status {
    font-family: "Inter", sans-serif;
    font-size: 13px;
    color: #57534e;
}

/* ========== Form layout ========== */
.v25-ai-chat-form {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    gap: 12px;
    background: #fff;
    border-top: 1px solid #e8e0d5;
}

.v25-ai-chat-input {
    flex: 1;
    min-width: 0;
    font-family: "Inter", sans-serif;
}

/* ========== STT (Speech-to-Text) Microphone Button ========== */
.v25-ai-chat-mic {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    margin: 0;
    background: linear-gradient(135deg, rgba(166, 90, 60, 0.08) 0%, rgba(166, 90, 60, 0.04) 100%);
    border: 1.5px solid rgba(166, 90, 60, 0.25);
    border-radius: 12px;
    color: #A65A3C;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    position: relative;
}

.v25-ai-chat-mic:hover {
    background: linear-gradient(135deg, rgba(166, 90, 60, 0.15) 0%, rgba(166, 90, 60, 0.08) 100%);
    border-color: #A65A3C;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(166, 90, 60, 0.2);
}

.v25-ai-chat-mic:active {
    transform: scale(0.98);
}

.v25-ai-chat-mic svg {
    width: 18px;
    height: 18px;
}

/* Active listening state - Recording */
.v25-ai-chat-mic.v25-ai-mic-active {
    background: linear-gradient(135deg, #A65A3C 0%, #8B4A32 100%);
    border-color: #A65A3C;
    color: #fff;
    animation: v25-mic-pulse 1.5s ease-in-out infinite;
    box-shadow: 0 4px 12px rgba(166, 90, 60, 0.35);
}

/* Processing state (Yandex STT) */
.v25-ai-chat-mic.v25-ai-mic-processing {
    background: linear-gradient(135deg, rgba(166, 90, 60, 0.15) 0%, rgba(166, 90, 60, 0.08) 100%);
    border-color: #A65A3C;
    color: #A65A3C;
    pointer-events: none;
}

.v25-ai-chat-mic.v25-ai-mic-processing svg {
    animation: v25-mic-spin 0.8s linear infinite;
}

@keyframes v25-mic-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes v25-mic-pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(166, 90, 60, 0.35), 0 0 0 0 rgba(166, 90, 60, 0.4);
    }
    50% {
        box-shadow: 0 4px 12px rgba(166, 90, 60, 0.35), 0 0 0 10px rgba(166, 90, 60, 0);
    }
}

/* Mic error tooltip */
.v25-ai-mic-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 14px;
    background: #1c1917;
    color: #fff;
    font-family: "Inter", sans-serif;
    font-size: 12px;
    border-radius: 8px;
    white-space: nowrap;
    z-index: 1000;
    animation: v25-tooltip-fade 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.v25-ai-mic-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1c1917;
}

/* ========== TTS (Text-to-Speech) Button ========== */
.v25-ai-message-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e8e0d5;
}

.v25-ai-tts-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: linear-gradient(135deg, rgba(166, 90, 60, 0.08) 0%, rgba(166, 90, 60, 0.04) 100%);
    border: 1.5px solid rgba(166, 90, 60, 0.25);
    border-radius: 50%;
    color: #A65A3C;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.v25-ai-tts-btn:hover {
    background: linear-gradient(135deg, rgba(166, 90, 60, 0.15) 0%, rgba(166, 90, 60, 0.08) 100%);
    border-color: #A65A3C;
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(166, 90, 60, 0.2);
}

.v25-ai-tts-btn:active {
    transform: scale(0.95);
}

.v25-ai-tts-btn svg {
    width: 16px;
    height: 16px;
}

/* Loading state - pulse animation */
.v25-ai-tts-btn.v25-ai-tts-loading {
    pointer-events: none;
}

.v25-ai-tts-btn.v25-ai-tts-loading svg {
    animation: v25-tts-pulse 1s ease-in-out infinite;
}

@keyframes v25-tts-pulse {
    0%, 100% { opacity: 0.4; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.05); }
}

/* Playing state */
.v25-ai-tts-btn.v25-ai-tts-playing {
    background: linear-gradient(135deg, #A65A3C 0%, #8B4A32 100%);
    border-color: #A65A3C;
    color: #fff;
    box-shadow: 0 3px 10px rgba(166, 90, 60, 0.3);
}

.v25-ai-tts-btn.v25-ai-tts-playing:hover {
    background: linear-gradient(135deg, #8B4A32 0%, #6d3a26 100%);
}

/* Playing animation - sound waves */
.v25-ai-tts-btn.v25-ai-tts-playing svg path:nth-child(2),
.v25-ai-tts-btn.v25-ai-tts-playing svg path:nth-child(3) {
    animation: v25-tts-wave 0.5s ease-in-out infinite alternate;
}

.v25-ai-tts-btn.v25-ai-tts-playing svg path:nth-child(3) {
    animation-delay: 0.15s;
}

@keyframes v25-tts-wave {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* ========== Vision Product Cards ========== */
.v25-ai-vision-products {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.v25-ai-vision-product {
    background: linear-gradient(135deg, #faf8f5 0%, #f5efe8 100%);
    border: 1px solid #e8e0d5;
    border-radius: 12px;
    padding: 12px 14px;
    transition: all 0.2s ease;
}

.v25-ai-vision-product:hover {
    border-color: rgba(166, 90, 60, 0.3);
    box-shadow: 0 2px 8px rgba(166, 90, 60, 0.08);
}

.v25-ai-vision-product-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.v25-ai-vision-product-link {
    font-family: "Inter", sans-serif;
    color: #A65A3C;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
    flex: 1;
    transition: color 0.2s ease;
}

.v25-ai-vision-product-link:hover {
    color: #8B4A32;
    text-decoration: underline;
}

.v25-ai-vision-product-price {
    font-family: "Inter", sans-serif;
    color: #1c1917;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

/* Action buttons row */
.v25-ai-vision-product-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.v25-ai-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-family: "Inter", sans-serif;
    font-size: 11px;
    color: #57534e;
    background: #fff;
    border: 1px solid #e0d5c7;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.v25-ai-action-btn:hover {
    background: #faf8f5;
    border-color: #c9bfb0;
    color: #1c1917;
}

.v25-ai-action-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.v25-ai-action-btn span {
    white-space: nowrap;
}

/* Wishlist button special styling */
.v25-ai-action-wishlist:hover {
    border-color: #f87171;
    color: #ef4444;
}

.v25-ai-action-wishlist.v25-ai-wishlist-added {
    background: #fef2f2;
    border-color: #f87171;
    color: #ef4444;
}

.v25-ai-action-wishlist.v25-ai-wishlist-added svg {
    fill: #ef4444;
}

/* Open button special styling */
.v25-ai-action-open:hover {
    border-color: #A65A3C;
    color: #A65A3C;
}

/* Copy success state */
.v25-ai-action-btn.v25-ai-copy-success {
    background: #f0fdf4;
    border-color: #86efac;
    color: #16a34a;
}

/* Share button container */
.v25-ai-vision-share {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e8e0d5;
    display: flex;
    justify-content: flex-end;
}

.v25-ai-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-family: "Inter", sans-serif;
    font-size: 12px;
    color: #57534e;
    background: #fff;
    border: 1px solid #e0d5c7;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.v25-ai-share-btn:hover {
    background: #faf8f5;
    border-color: #A65A3C;
    color: #A65A3C;
}

.v25-ai-share-btn svg {
    width: 14px;
    height: 14px;
}

/* Share tooltip */
.v25-ai-share-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: #1c1917;
    color: #fff;
    font-family: "Inter", sans-serif;
    font-size: 11px;
    border-radius: 6px;
    white-space: nowrap;
    animation: v25-tooltip-fade 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.v25-ai-share-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1c1917;
}

@keyframes v25-tooltip-fade {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ========== Mobile Responsive ========== */
@media (max-width: 480px) {
    .v25-ai-chat-upload {
        width: 34px;
        height: 34px;
        border-radius: 10px;
    }

    .v25-ai-chat-upload svg {
        width: 16px;
        height: 16px;
    }

    .v25-ai-upload-hint {
        font-size: 0.8125rem;
        padding: 4px 12px 8px;
    }

    .v25-ai-upload-hint::before,
    .v25-ai-upload-hint::after {
        margin: 0 6px;
    }

    .v25-ai-image-preview {
        padding: 8px 12px;
        margin: 0 8px 4px;
    }

    .v25-ai-preview-thumb,
    .v25-ai-preview-thumb img {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;
        min-height: 44px !important;
        max-height: 44px !important;
    }

    .v25-ai-preview-text {
        font-size: 12px;
    }

    .v25-ai-msg-image-thumb,
    .v25-ai-msg-image-thumb img {
        width: 36px !important;
        height: 36px !important;
    }

    /* Always show remove button on mobile */
    .v25-ai-preview-remove {
        opacity: 1;
        transform: scale(1);
    }

    .v25-ai-chat-mic {
        width: 34px;
        height: 34px;
        margin: 0;
        border-radius: 10px;
    }

    .v25-ai-chat-mic svg {
        width: 16px;
        height: 16px;
    }

    .v25-ai-tts-btn {
        width: 36px;
        height: 36px;
    }

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

    .v25-ai-vision-product-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .v25-ai-vision-product-price {
        font-size: 13px;
    }

    .v25-ai-action-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .v25-ai-action-btn span {
        display: none;
    }

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

    .v25-ai-share-btn span {
        display: none;
    }
}
