/* Dr Rinse brand colors */
:root {
    --dr-blue: #424093;
    --dr-red: #ed3338;
    --dr-blue-dark: #353475;
    --dr-red-dark: #d42b30;
}

/* Floating chat launcher */
#dcw-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--dr-red);
    color: #fff;
    border: 3px solid var(--dr-blue);
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(66, 64, 147, 0.35);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
    padding: 6px;
    overflow: hidden;
}

#dcw-launcher img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

#dcw-launcher:hover {
    background: var(--dr-red-dark);
    transform: scale(1.05);
}

#dcw-launcher.dcw-hidden {
    display: none;
}

/* Chat panel */
#dcw-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 48px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(66, 64, 147, 0.22);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
    border: 2px solid var(--dr-blue);
}

#dcw-panel.dcw-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

#dcw-header {
    background: var(--dr-blue);
    color: #fff;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

#dcw-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

#dcw-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 50%;
    background: #fff;
    padding: 2px;
}

#dcw-header-title {
    font-size: 0.95rem;
    font-weight: 600;
}

#dcw-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

#dcw-clear,
#dcw-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 4px;
}

#dcw-clear {
    font-size: 1.1rem;
}

#dcw-clear:hover,
#dcw-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

#dcw-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8f8f8;
}

.dcw-message {
    max-width: 85%;
    padding: 9px 13px;
    border-radius: 12px;
    line-height: 1.45;
    font-size: 0.9rem;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.dcw-message.bot a.dcw-download-link {
    color: var(--dr-blue);
    font-weight: 600;
    text-decoration: underline;
    white-space: normal;
    display: inline-block;
    margin-top: 4px;
}

.dcw-message.bot a.dcw-download-link:hover {
    color: var(--dr-red);
}

.dcw-message.user {
    align-self: flex-end;
    background: var(--dr-blue);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.dcw-message.bot {
    align-self: flex-start;
    background: #e8e8e8;
    color: #222;
    border-bottom-left-radius: 4px;
}

.dcw-message.typing {
    align-self: flex-start;
    background: #e8e8e8;
    color: #888;
    font-style: italic;
}

#dcw-input-area {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

#dcw-input {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
}

#dcw-input:focus {
    border-color: var(--dr-blue);
}

#dcw-send {
    padding: 9px 16px;
    background: var(--dr-red);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    flex-shrink: 0;
}

#dcw-send:hover {
    background: var(--dr-red-dark);
}

#dcw-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    #dcw-panel {
        bottom: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    #dcw-launcher {
        bottom: 16px;
        right: 16px;
    }
}
