/* Sani-Tred Bot Chat Widget Styles */

/* Floating button */
.sanitred-chat-floating {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.sanitred-chat-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #d22027;
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(210, 32, 39, 0.4);
    transition: all 0.3s ease;
}

.sanitred-chat-button:hover {
    background: #b01c21;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(210, 32, 39, 0.5);
}

.sanitred-chat-button svg {
    width: 20px;
    height: 20px;
}

/* Chat window */
.sanitred-chat-window {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    width: 380px;
    height: 600px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

.sanitred-chat-floating .sanitred-chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    z-index: 9998;
}

/* Maximized state */
.sanitred-chat-window.maximized {
    width: calc(100vw - 40px) !important;
    height: calc(100vh - 40px) !important;
    top: 20px !important;
    left: 20px !important;
    right: 20px !important;
    bottom: 20px !important;
    border-radius: 12px;
}

/* Minimized state */
.sanitred-chat-window.minimized {
    height: 56px !important;
    overflow: hidden;
}

.sanitred-chat-window.minimized .sanitred-chat-messages,
.sanitred-chat-window.minimized .sanitred-chat-input-container,
.sanitred-chat-window.minimized .sanitred-resize-handle {
    display: none;
}

.sanitred-chat-inline .sanitred-chat-window {
    max-width: 100%;
    height: 500px;
    margin: 0 auto;
}

/* Header */
.sanitred-chat-header {
    background: linear-gradient(135deg, #d22027 0%, #b01c21 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
}

.sanitred-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff !important;
}

/* Window Controls */
.sanitred-window-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.sanitred-window-control {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.sanitred-window-control:hover {
    opacity: 0.7;
}

.sanitred-window-control svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.5;
}

/* Messages area */
.sanitred-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sanitred-chat-message {
    display: flex;
    gap: 12px;
    animation: messageSlideIn 0.3s ease;
}

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

.sanitred-chat-message.user {
    flex-direction: row-reverse;
}

.sanitred-chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 14px;
}

.sanitred-chat-message.assistant .sanitred-chat-message-avatar {
    background: #d22027;
    color: white;
}

.sanitred-chat-message.user .sanitred-chat-message-avatar {
    background: #e5e7eb;
    color: #374151;
}

.sanitred-chat-message-content {
    flex: 1;
    max-width: 75%;
}

.sanitred-chat-message-bubble {
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 14px;
}

.sanitred-chat-message.assistant .sanitred-chat-message-bubble {
    background: white;
    color: #1f2937;
    border: 1px solid #e5e7eb;
}

.sanitred-chat-message.user .sanitred-chat-message-bubble {
    background: #d22027;
    color: white;
}

.sanitred-chat-message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    padding: 0 4px;
}

/* Typing indicator */
.sanitred-chat-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    width: fit-content;
}

.sanitred-chat-typing span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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

/* Input area */
.sanitred-chat-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.sanitred-chat-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    transition: border-color 0.2s;
}

.sanitred-chat-input:focus {
    outline: none;
    border-color: #d22027;
}

.sanitred-chat-send {
    background: #d22027;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.sanitred-chat-send:hover:not(:disabled) {
    background: #b01c21;
}

.sanitred-chat-send:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Error message */
.sanitred-chat-error {
    background: #fee;
    color: #c00;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    margin: 12px;
    border: 1px solid #fcc;
}

/* Scrollbar styling */
.sanitred-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.sanitred-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.sanitred-chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.sanitred-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Resize Handles */
.sanitred-resize-handle {
    position: absolute;
    z-index: 10;
    background: transparent;
}

.sanitred-chat-window.maximized .sanitred-resize-handle,
.sanitred-chat-window.minimized .sanitred-resize-handle {
    display: none;
}

/* Top and Bottom */
.sanitred-resize-n,
.sanitred-resize-s {
    left: 0;
    right: 0;
    height: 10px;
    cursor: ns-resize;
}

.sanitred-resize-n {
    top: 0;
}

.sanitred-resize-s {
    bottom: 0;
}

/* Left and Right */
.sanitred-resize-e,
.sanitred-resize-w {
    top: 0;
    bottom: 0;
    width: 10px;
    cursor: ew-resize;
}

.sanitred-resize-e {
    right: 0;
}

.sanitred-resize-w {
    left: 0;
}

/* Corners */
.sanitred-resize-ne,
.sanitred-resize-nw,
.sanitred-resize-se,
.sanitred-resize-sw {
    width: 15px;
    height: 15px;
}

.sanitred-resize-ne {
    top: 0;
    right: 0;
    cursor: nesw-resize;
}

.sanitred-resize-nw {
    top: 0;
    left: 0;
    cursor: nwse-resize;
}

.sanitred-resize-se {
    bottom: 0;
    right: 0;
    cursor: nwse-resize;
}

.sanitred-resize-sw {
    bottom: 0;
    left: 0;
    cursor: nesw-resize;
}

/* Hover effect for resize handles (for visual feedback during development) */
.sanitred-resize-handle:hover {
    background: rgba(210, 32, 39, 0.1);
}

/* Dragging state */
.sanitred-chat-window.dragging {
    transition: none;
    user-select: none;
}

.sanitred-chat-window.resizing {
    transition: none;
}

/* Responsive */
@media (max-width: 480px) {
    .sanitred-chat-floating .sanitred-chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        right: 20px;
    }

    .sanitred-chat-button span {
        display: none;
    }

    .sanitred-chat-button {
        width: 56px;
        height: 56px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }
}
