/* SianKan - Clean Professional Styles */

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* ===== Chat Panel (Support Widget) ===== */

/* Toggle button */
.chat-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: #111827;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s, background-color 0.2s;
}

.chat-toggle-btn:hover {
    background-color: #1f2937;
    transform: scale(1.05);
}

/* Panel */
.chat-panel {
    position: fixed;
    bottom: 92px;
    right: 24px;
    z-index: 1001;
    width: 400px;
    height: 500px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

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

/* Header */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #111827;
    color: #fff;
    flex-shrink: 0;
}

.chat-header-title {
    font-size: 14px;
    font-weight: 600;
}

.chat-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.chat-close-btn:hover {
    opacity: 1;
}

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

/* Message bubbles */
.chat-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.chat-bubble-user {
    align-self: flex-end;
    background-color: #111827;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-bubble-assistant {
    align-self: flex-start;
    background-color: #f3f4f6;
    color: #111827;
    border-bottom-left-radius: 4px;
}

.chat-bubble-error {
    align-self: flex-start;
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-bottom-left-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-retry-btn {
    background: none;
    border: 1px solid #991b1b;
    color: #991b1b;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    align-self: flex-start;
    transition: background-color 0.15s;
}

.chat-retry-btn:hover {
    background-color: #fee2e2;
}

/* Thinking indicator */
.chat-thinking {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px 18px;
}

.chat-thinking .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #9ca3af;
    animation: chatDotBounce 1.4s ease-in-out infinite;
}

.chat-thinking .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-thinking .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes chatDotBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Image preview above input */
.chat-image-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px 0;
    flex-shrink: 0;
}

.chat-preview-img {
    max-height: 64px;
    max-width: 100px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    object-fit: cover;
}

.chat-remove-image {
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-remove-image:hover {
    background: #dc2626;
}

/* Image in user bubble */
.chat-bubble-user img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 8px;
    margin-bottom: 6px;
    display: block;
}

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

/* Upload button */
.chat-upload-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background-color: transparent;
    color: #6b7280;
    border: 1px solid #d1d5db;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.15s, color 0.15s;
}

.chat-upload-btn:hover {
    border-color: #111827;
    color: #111827;
}

.chat-upload-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.chat-input:focus {
    border-color: #111827;
}

.chat-input:disabled {
    background-color: #f9fafb;
    cursor: not-allowed;
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background-color: #111827;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color 0.15s;
}

.chat-send-btn:hover {
    background-color: #1f2937;
}

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

/* Responsive: mobile full-width */
@media (max-width: 640px) {
    .chat-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 60vh;
        border-radius: 12px 12px 0 0;
    }

    .chat-toggle-btn {
        bottom: 16px;
        right: 16px;
    }
}

/* Print Styles */
@media print {
    header, footer, nav, button, a { display: none !important; }
    .chat-panel, .chat-toggle-btn { display: none !important; }
    body { font-size: 12pt; line-height: 1.4; }
}
