/* Live chat widget - Crisp-style: blue header, white chat, clear bubbles */
.chat-widget {
    --chat-blue: #1A73E8;
    --chat-blue-hover: #1557b0;
    --chat-bubble-customer: #1A73E8;
    --chat-bubble-admin: #f1f3f4;
    --chat-bubble-admin-text: #202124;
    --chat-border: #dadce0;
    --chat-bg: #ffffff;
    --chat-text-muted: #5f6368;
    --chat-radius: 12px;
    --chat-radius-sm: 8px;
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
}

/* Floating button (kleur via .chat-widget style of default --chat-blue) */
.chat-widget-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--chat-button-bg, var(--chat-blue));
    color: #fff;
    border: none;
    border-radius: 28px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(26, 115, 232, 0.4);
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.chat-widget-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 115, 232, 0.45);
    background: var(--chat-blue-hover);
}

.chat-widget-icon {
    font-size: 1.25em;
}

/* Panel */
.chat-widget-panel {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 0.5rem;
    width: min(calc(100vw - 2rem), 400px);
    max-height: 75vh;
    background: var(--chat-bg);
    border-radius: var(--chat-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    flex-direction: column;
}

.chat-widget-panel--open {
    display: flex;
}

/* Header (kleur via .chat-widget style of default --chat-blue) */
.chat-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem 1.25rem;
    background: var(--chat-header-bg, var(--chat-blue));
    color: #fff;
}

.chat-widget-header-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-widget-header-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.chat-widget-header-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    font-size: 1.35rem;
}

.chat-widget-header-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #34a853;
    border: 2px solid var(--chat-blue);
    border-radius: 50%;
}

.chat-widget-header-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.chat-widget-header-title {
    font-weight: 600;
    font-size: 1rem;
}

.chat-widget-header-subtitle {
    font-size: 0.8rem;
    opacity: 0.9;
}

.chat-widget-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s;
}

.chat-widget-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Guest form */
.chat-widget-guest-form {
    padding: 1.25rem 1rem;
    background: var(--chat-bg);
}

.chat-widget-guest-form p {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    color: var(--chat-text-muted);
    line-height: 1.45;
}

.chat-widget-guest-form label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--chat-bubble-admin-text);
}

.chat-widget-guest-form label .required {
    color: #d93025;
}

.chat-widget-guest-form input {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius-sm);
    font-size: 1rem;
    box-sizing: border-box;
}

.chat-widget-guest-form input:focus {
    outline: none;
    border-color: var(--chat-blue);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.chat-widget-btn-start {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.65rem 1rem;
    background: var(--chat-button-bg, var(--chat-blue));
    color: #fff;
    border: none;
    border-radius: var(--chat-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-widget-btn-start:hover {
    background: var(--chat-blue-hover);
}

/* Chat area */
.chat-widget-chat {
    display: flex;
    flex-direction: column;
    min-height: 300px;
    background: var(--chat-bg);
}

.chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 340px;
    background: var(--chat-bg);
}

/* Date separator */
.chat-widget-date {
    text-align: center;
    font-size: 0.75rem;
    color: var(--chat-text-muted);
    margin: 0.75rem 0 0.5rem;
}

/* Message row */
.chat-widget-message-wrap {
    width: 100%;
}

.chat-widget-message {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.chat-widget-message--customer {
    flex-direction: column;
    align-items: flex-end;
}

.chat-widget-message-you {
    font-size: 0.7rem;
    color: var(--chat-text-muted);
    margin-bottom: 0.2rem;
    padding-right: 0.25rem;
}

.chat-widget-message--admin .chat-widget-message-you {
    display: none;
}

.chat-widget-message-avatar {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: var(--chat-bubble-admin);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--chat-text-muted);
}

/* Bubbles */
.chat-widget-bubble {
    max-width: 82%;
}

.chat-widget-message--customer .chat-widget-bubble {
    margin-left: 0;
    margin-right: 0;
}

.chat-widget-bubble-inner {
    padding: 0.5rem 0.85rem;
    border-radius: 18px;
    font-size: 0.9375rem;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.chat-widget-message--customer .chat-widget-bubble-inner {
    background: var(--chat-bubble-customer);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-widget-message--admin .chat-widget-bubble-inner {
    background: var(--chat-bubble-admin);
    color: var(--chat-bubble-admin-text);
    border-bottom-left-radius: 4px;
}

.chat-widget-bubble-text {
    word-wrap: break-word;
    white-space: pre-wrap;
}

.chat-widget-bubble-time {
    font-size: 0.7rem;
    opacity: 0.85;
    margin-top: 0.25rem;
}

.chat-widget-message--admin .chat-widget-bubble-time {
    color: var(--chat-text-muted);
}

/* Input bar */
.chat-widget-form {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--chat-border);
    background: var(--chat-bg);
}

.chat-widget-form-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    background: #f8f9fa;
    border: 1px solid var(--chat-border);
    border-radius: 24px;
    padding: 0.35rem 0.35rem 0.35rem 0.75rem;
}

.chat-widget-form-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.chat-widget-form-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--chat-text-muted);
    font-size: 1.1rem;
    cursor: default;
    border-radius: 50%;
}

.chat-widget-form-icon:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--chat-bubble-admin-text);
}

.chat-widget-form textarea {
    flex: 1;
    min-height: 38px;
    max-height: 120px;
    padding: 0.5rem 0.25rem;
    border: none;
    background: transparent;
    border-radius: 0;
    font-family: inherit;
    font-size: 0.9375rem;
    resize: none;
    line-height: 1.4;
}

.chat-widget-form textarea::placeholder {
    color: var(--chat-text-muted);
}

.chat-widget-form textarea:focus {
    outline: none;
}

.chat-widget-send {
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    background: var(--chat-button-bg, var(--chat-blue));
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.15rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-widget-send:hover {
    background: var(--chat-blue-hover);
}

.chat-widget-transcript {
    display: block;
    width: calc(100% - 2rem);
    margin: 0 1rem 0.75rem;
    padding: 0.5rem;
    background: transparent;
    border: none;
    color: var(--chat-blue);
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.chat-widget-transcript:hover {
    color: var(--chat-blue-hover);
}
