/* ==========================================
   Floating Chat Widget Styles
   Jumper & Kater e.V.
   ========================================== */

/* Floating Chat Button */
.chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: var(--primary, #007aec);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 122, 236, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 9998;
    border: none;
}

.chat-fab:hover {
    background: var(--primary-dark, #0066cc);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 122, 236, 0.5);
}

.chat-fab:active {
    transform: translateY(0) scale(0.95);
}

.chat-icon {
    color: white;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    padding: 0 6px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    height: 550px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    animation: slideUpIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUpIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #007aec 0%, #00bac7 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    padding: 4px;
    object-fit: contain;
}

.chat-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.chat-status {
    font-size: 12px;
    opacity: 0.9;
    margin: 0;
    line-height: 1.3;
}

.chat-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Email Form */
.chat-email-form {
    padding: 30px 24px;
    flex: 1;
    overflow-y: auto;
}

.chat-welcome {
    text-align: center;
    margin-bottom: 24px;
}

.chat-welcome h4 {
    font-size: 20px;
    margin: 0 0 8px 0;
    color: var(--gray-900, #212121);
}

.chat-welcome p {
    font-size: 14px;
    color: var(--gray-600, #757575);
    margin: 0;
    line-height: 1.5;
}

.chat-form-group {
    margin-bottom: 16px;
}

.chat-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--gray-700, #616161);
}

.chat-form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300, #E0E0E0);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.chat-form-group input:focus {
    outline: none;
    border-color: var(--primary, #007aec);
    box-shadow: 0 0 0 3px rgba(0, 122, 236, 0.1);
}

.chat-email-form .btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary, #007aec);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.chat-email-form .btn-primary:hover {
    background: var(--primary-dark, #0066cc);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 236, 0.3);
}

.chat-email-form .btn-primary:active {
    transform: translateY(0);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--gray-50, #FAFAFA);
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--gray-300, #E0E0E0);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400, #BDBDBD);
}

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

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

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

.chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-300, #E0E0E0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    color: var(--gray-700, #616161);
}

.chat-message.admin .chat-message-avatar {
    background: var(--primary, #007aec);
    color: white;
}

.chat-message-content {
    max-width: 75%;
    display: flex;
    flex-direction: column;
}

.chat-message.user .chat-message-content {
    align-items: flex-end;
}

.chat-message-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.chat-message.admin .chat-message-bubble {
    background: white;
    color: var(--gray-900, #212121);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chat-message.user .chat-message-bubble {
    background: var(--primary, #007aec);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message-time {
    font-size: 11px;
    color: var(--gray-500, #9E9E9E);
    margin-top: 4px;
    padding: 0 4px;
}

/* Chat Input */
.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--gray-200, #EEEEEE);
    background: white;
    flex-shrink: 0;
}

.chat-input-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input-form textarea {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--gray-300, #E0E0E0);
    border-radius: 20px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    min-height: 40px;
    transition: all 0.3s ease;
    line-height: 1.5;
}

.chat-input-form textarea:focus {
    outline: none;
    border-color: var(--primary, #007aec);
    box-shadow: 0 0 0 3px rgba(0, 122, 236, 0.1);
}

.chat-input-form textarea::-webkit-scrollbar {
    width: 6px;
}

.chat-input-form textarea::-webkit-scrollbar-thumb {
    background: var(--gray-300, #E0E0E0);
    border-radius: 3px;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    background: var(--primary, #007aec);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send-btn:hover {
    background: var(--primary-dark, #0066cc);
    transform: scale(1.05);
}

.chat-send-btn:active {
    transform: scale(0.95);
}

.chat-send-btn:disabled {
    background: var(--gray-400, #BDBDBD);
    cursor: not-allowed;
    transform: none;
}

.chat-input-hint {
    margin-top: 6px;
    text-align: center;
}

.chat-input-hint small {
    font-size: 11px;
    color: var(--gray-500, #9E9E9E);
}

/* Empty State */
.chat-empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--gray-500, #9E9E9E);
}

.chat-empty-state svg {
    margin-bottom: 12px;
    opacity: 0.5;
}

.chat-empty-state p {
    margin: 0;
    font-size: 14px;
}

/* Loading State */
.chat-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 8px;
}

.chat-loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid var(--gray-200, #EEEEEE);
    border-top-color: var(--primary, #007aec);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
        max-height: calc(100vh - 120px);
        bottom: 90px;
        right: 16px;
        border-radius: 12px;
    }

    .chat-fab {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

    .chat-message-content {
        max-width: 80%;
    }

    .chat-header {
        padding: 12px;
    }

    .chat-logo {
        width: 36px;
        height: 36px;
    }

    .chat-title {
        font-size: 15px;
    }

    .chat-status {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .chat-window {
        width: 100%;
        height: 100%;
        max-height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .chat-message-content {
        max-width: 85%;
    }
}

/* Print Styles */
@media print {
    .chat-fab,
    .chat-window {
        display: none !important;
    }
}
