/* Dorce AI Assistant - Glassmorphism UI Theme */
:root {
    --dorce-primary: #2563eb;
    --dorce-primary-hover: #1d4ed8;
    --dorce-glass-bg: rgba(255, 255, 255, 0.75);
    --dorce-glass-border: rgba(255, 255, 255, 0.6);
    --dorce-glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.25);
    --dorce-text-main: #334155;
    --dorce-text-mid: #64748b;
    --dorce-text-light: #94a3b8;
}

/* --- ANIMATIONS --- */
@keyframes dorceSlideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes dorceFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes dorceBounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

@keyframes dorceExpandDown {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* --- MODAL WRAPPER --- */
.dorce-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(4px);
    z-index: 2147483647;
    /* Max Z-Index */
    display: flex;
    align-items: center;
    justify-content: center;
}

.dorce-modal-container {
    position: relative;
    width: 90%;
    max-width: 900px;
    height: 85vh;
    background: var(--dorce-glass-bg);
    box-shadow: var(--dorce-glass-shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    border: 1px solid var(--dorce-glass-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: dorceSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Inter', sans-serif;
}

/* Header */
.dorce-header {
    padding: 20px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.4);
}

.dorce-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #1e293b;
}

.dorce-brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--dorce-primary), #3b82f6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

.dorce-title h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.dorce-title span {
    font-size: 12px;
    color: var(--dorce-text-mid);
    font-weight: 500;
}

.dorce-close-btn {
    background: rgba(255, 255, 255, 0.5);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dorce-text-mid);
    font-size: 18px;
}

.dorce-close-btn:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: rotate(90deg);
}

/* Chat Area */
.dorce-chat-area {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    scroll-behavior: smooth;
}

/* Messages */
.dorce-msg {
    display: flex;
    gap: 16px;
    opacity: 0;
    animation: dorceFadeIn 0.4s ease-out forwards;
}

.dorce-msg.user {
    flex-direction: row-reverse;
}

.dorce-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}

.dorce-msg.ai .dorce-avatar {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.dorce-msg.user .dorce-avatar {
    background: var(--dorce-primary);
    color: white;
}

.dorce-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dorce-bubble {
    max-width: 80%;
    padding: 16px 20px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.6;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.dorce-msg.ai .dorce-bubble {
    background: rgba(255, 255, 255, 0.7);
    border-top-left-radius: 4px;
    color: var(--dorce-text-main);
}

.dorce-msg.user .dorce-bubble {
    background: linear-gradient(135deg, var(--dorce-primary), var(--dorce-primary-hover));
    color: white;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* Cards */
.dorce-card-carousel {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.dorce-card {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    padding: 6px;
    width: 250px;
    flex-shrink: 0;
    transition: all 0.3s;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.6);
    text-decoration: none;
    color: inherit;
    display: block;
}

.dorce-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    background: white;
    z-index: 5;
}

.dorce-card-img {
    height: 130px;
    background: #cbd5e1;
    border-radius: 12px;
    margin-bottom: 10px;
    overflow: hidden;
    position: relative;
}

.dorce-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dorce-card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 6px;
    backdrop-filter: blur(4px);
    text-transform: uppercase;
}

.dorce-card h4 {
    margin: 0 0 4px;
    font-size: 14px;
    color: #0f172a;
    font-weight: 700;
    padding: 0 8px;
}

.dorce-card p {
    margin: 0;
    font-size: 12px;
    color: #64748b;
    padding: 0 8px 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Input Area */
.dorce-input-area {
    padding: 24px 30px;
    background: rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    display: flex;
    gap: 12px;
    align-items: center;
}

.dorce-input-wrapper {
    flex: 1;
    background: white;
    border-radius: 50px;
    padding: 6px 6px 6px 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    transition: 0.3s;
}

.dorce-input-wrapper:focus-within {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    border-color: var(--dorce-primary);
}

.dorce-input {
    border: none;
    outline: none;
    flex: 1;
    font-size: 16px;
    color: var(--dorce-text-main);
    background: transparent;
}

.dorce-mic-btn {
    background: none;
    border: none;
    color: var(--dorce-text-mid);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: 0.2s;
}

.dorce-mic-btn.listening {
    color: #ea580c;
    background: #fff7ed;
}

.dorce-send-btn {
    background: linear-gradient(135deg, var(--dorce-primary), var(--dorce-primary-hover));
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
    transition: 0.3s;
}

.dorce-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.4);
}

/* Typing Dots */
.dorce-typing {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.dorce-dot {
    width: 6px;
    height: 6px;
    background: var(--dorce-text-light);
    border-radius: 50%;
    animation: dorceBounce 1.4s infinite ease-in-out both;
}

.dorce-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.dorce-dot:nth-child(2) {
    animation-delay: -0.16s;
}


/* --- INLINE WIDGET STYLES --- */
.dorce-inline-wrapper {
    position: relative;
    width: 100%;
    z-index: 50;
    font-family: 'Inter', sans-serif;
}

.dorce-inline-search {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid white;
    border-radius: 16px;
    padding: 8px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.dorce-inline-search:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border-color: rgba(37, 99, 235, 0.5);
}

.dorce-inline-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--dorce-primary), #1d4ed8);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    margin-right: 12px;
}

.dorce-inline-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 12px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: none;
    flex-direction: column;
    animation: dorceExpandDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.dorce-inline-btn {
    background: rgba(37, 99, 235, 0.1);
    color: var(--dorce-primary);
    border: none;
    padding: 8px 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
}

.dorce-inline-btn:hover {
    background: var(--dorce-primary);
    color: white;
}

/* MINI CARDS (Inline) */
.dorce-mini-card {
    display: flex;
    gap: 10px;
    background: white;
    padding: 10px;
    border-radius: 12px;
    margin-top: 10px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: 0.2s;
    cursor: pointer;
    text-decoration: none;
}

.dorce-mini-card:hover {
    transform: translateY(-2px);
    border-color: #bfdbfe;
}

.dorce-mini-img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    background: #cbd5e1;
    flex-shrink: 0;
    overflow: hidden;
}

.dorce-mini-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dorce-mini-info h4 {
    margin: 0 0 2px;
    font-size: 13px;
    color: #0f172a;
    font-weight: 700;
}

.dorce-mini-info p {
    margin: 0;
    font-size: 11px;

    color: #64748b;
}

/* --- OLD STYLE INLINE WIDGET --- */
.dorce-inline-search.old-style {
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    border-radius: 9999px;
    background: white;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dorce-inline-search.old-style:focus-within {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    transform: none;
    border-color: transparent;
}

.dorce-inline-search.old-style .dorce-search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 12px;
}

.dorce-inline-search.old-style input {
    flex-grow: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 0 12px;
    font-size: 16px;
    color: #334155;
}

.dorce-inline-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 4px;
    flex-shrink: 0;
}

.dorce-inline-search.old-style .dorce-mic-btn {
    color: #64748b;
    padding: 8px;
    background: transparent;
}

.dorce-inline-search.old-style .dorce-mic-btn:hover {
    background: #f1f5f9;
    color: #334155;
}

.dorce-inline-search.old-style .dorce-inline-btn {
    background: #2563eb;
    color: white;
    border-radius: 9999px;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
}

.dorce-inline-search.old-style .dorce-inline-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

.dorce-mic-btn.recording {
    color: #ef4444 !important;
    animation: dorceBounce 1s infinite;
}