/* DRAPP Chat Widget — Styles v1.1 */

:root {
    --dcw-primary: #000;
    --dcw-primary-hover: #222;
    --dcw-bg: #fff;
    --dcw-bg-alt: #f5f5f5;
    --dcw-text: #1a1a1a;
    --dcw-text-muted: #666;
    --dcw-border: #e5e5e5;
    --dcw-success: #22c55e;
    --dcw-error: #ef4444;
    --dcw-bot-bg: #f0f0f0;
    --dcw-user-bg: #000;
    --dcw-user-text: #fff;
    --dcw-radius: 16px;
    --dcw-shadow: 0 8px 30px rgba(0,0,0,0.12);
    --dcw-z: 99990;
}

.dcw-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--dcw-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    z-index: var(--dcw-z);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transition: transform 0.2s ease, background 0.2s ease, opacity 0.25s ease;
    border: 1px solid #ffffff52;
}
.dcw-button:hover {
    transform: scale(1.08);
    background: var(--dcw-primary-hover);
}
.dcw-button svg {
    width: 26px;
    height: 26px;
    transition: opacity 0.2s, transform 0.2s;
}
.dcw-button .dcw-icon-close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg);
}
.dcw-button.dcw-open .dcw-icon-chat { opacity: 0; transform: rotate(90deg); }
.dcw-button.dcw-open .dcw-icon-close { opacity: 1; transform: rotate(0); }

.dcw-proactive {
    position: fixed;
    bottom: 86px;
    right: 20px;
    background: #000;
    border-radius: 12px;
    padding: 12px 16px;
    max-width: 250px;
    box-shadow: var(--dcw-shadow);
    z-index: var(--dcw-z);
    font-size: 14px;
    line-height: 1.4;
    color: #fff;
    animation: dcwSlideUp 0.4s ease;
    cursor: pointer;
}
.dcw-proactive::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 24px;
    width: 12px;
    height: 12px;
    background: #000;
    transform: rotate(45deg);
    box-shadow: 2px 2px 4px rgba(0,0,0,0.06);
}
.dcw-proactive-close {
    position: absolute;
    top: -1px;
    right: -1px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #fff;
    padding: 2px 4px;
    line-height: 1;
}

.dcw-window {
    position: fixed;
    bottom: 88px;
    right: 20px;
    width: 380px;
    max-height: 520px;
    background: var(--dcw-bg);
    border-radius: var(--dcw-radius);
    box-shadow: var(--dcw-shadow);
    z-index: var(--dcw-z);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.dcw-window.dcw-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ─── Scroll Container ──────────────────────────────────────────────────────── */
.dcw-scroll {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding-bottom: 12px;
    -webkit-overflow-scrolling: touch;
}

.dcw-header {
    background: var(--dcw-primary);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.dcw-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: url('/static/img/v2/DRAPP_36.png');
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.dcw-header-info { flex: 1; min-width: 0; }
.dcw-header-name {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.dcw-header-status {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 2px;
}
.dcw-header-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
    padding: 0;
    font-size: 20px;
    line-height: 1;
}
.dcw-header-close:hover {
    background: rgba(255,255,255,0.4);
}

.dcw-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dcw-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
    animation: dcwFadeIn 0.25s ease;
}
.dcw-msg-bot {
    background: var(--dcw-bot-bg);
    color: var(--dcw-text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.dcw-msg-user {
    background: var(--dcw-user-bg);
    color: var(--dcw-user-text);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.dcw-msg-bot strong,
.dcw-msg-bot b {
    font-weight: 600;
}

.dcw-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 12px;
    flex-shrink: 0;
}
.dcw-chip {
    padding: 8px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--dcw-border);
    background: var(--dcw-bg);
    color: var(--dcw-text);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    line-height: 1.3;
}
.dcw-chip:hover {
    background: var(--dcw-primary);
    color: #fff;
    border-color: var(--dcw-primary);
}

.dcw-form {
    padding: 12px 16px;
    border-top: 1px solid var(--dcw-border);
    flex-shrink: 0;
    overflow-y: auto;
}
.dcw-form-group {
    margin-bottom: 10px;
}
.dcw-form-group:last-child {
    margin-bottom: 0;
}
.dcw-form-row {
    display: flex;
    gap: 8px;
}
.dcw-form-row .dcw-form-group {
    flex: 1;
}
.dcw-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--dcw-border);
    border-radius: 10px;
    font-size: 14px;
    color: var(--dcw-text);
    background: var(--dcw-bg);
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
    font-family: inherit;
}
.dcw-input:focus {
    border-color: var(--dcw-primary);
}
.dcw-input::placeholder {
    color: #aaa;
}
select.dcw-input {
    appearance: auto;
    -webkit-appearance: auto;
    color: var(--dcw-text);
}
select.dcw-input:invalid,
select.dcw-input option[value=""][disabled] {
    color: #aaa;
}
.dcw-input.dcw-error {
    border-color: var(--dcw-error);
}
textarea.dcw-input {
    resize: none;
    min-height: 52px;
}
.dcw-btn {
    width: 100%;
    padding: 11px;
    border: none;
    border-radius: 10px;
    background: var(--dcw-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}
.dcw-btn:hover {
    background: var(--dcw-primary-hover);
}
.dcw-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.dcw-form-note {
    font-size: 11px;
    color: var(--dcw-text-muted);
    margin-top: 6px;
    text-align: center;
}
.dcw-error-text {
    color: var(--dcw-error);
    font-size: 12px;
    margin-top: 4px;
}
.dcw-form .dcw-actions {
    padding: 0;
    margin-bottom: 8px;
}

.dcw-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    align-self: flex-start;
    background: var(--dcw-bot-bg);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}
.dcw-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #999;
    animation: dcwBounce 1.2s infinite;
}
.dcw-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.dcw-typing-dot:nth-child(3) { animation-delay: 0.3s; }

.dcw-success-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--dcw-success);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 24px;
}

@keyframes dcwSlideUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes dcwFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes dcwBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* ─── Size Help Button (product page) ────────────────────────────────────── */
.info-size-help {
    margin: 4px 8px 0 0;
    text-align: center;
}
.size-help-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 0;
    border: solid 1px #e2e2e4;
    background: transparent;
    color: #000;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    transition: color 0.15s;
    font-family: inherit;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
}
.size-help-btn .icon {
    width: 16px;
    height: 16px;
    opacity: 0.6;
}
.size-help-btn:hover .icon {
    opacity: 1;
}

@media (max-width: 480px) {
    .dcw-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 90vh;
        border-radius: var(--dcw-radius) var(--dcw-radius) 0 0;
    }
    .dcw-scroll {
        padding-bottom: 16px;
    }
    textarea.dcw-input {
        min-height: 44px;
    }
    .dcw-button {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
    }
    .dcw-button.dcw-open {
        display: none;
    }
    .dcw-proactive {
        bottom: 78px;
        right: 16px;
        max-width: 220px;
        font-size: 13px;
        padding: 10px 14px;
    }
}

.dcw-scroll::-webkit-scrollbar {
    width: 4px;
}
.dcw-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.dcw-scroll::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}
