/**
 * anesda.de Chat Widget - Styling
 */

:root {
    --chat-primary: #0066CC;
    --chat-primary-dark: #0052A3;
    --chat-background: #FFFFFF;
    --chat-text-dark: #333333;
    --chat-text-light: #666666;
    --chat-border: #E0E0E0;
    --chat-user-bg: #E3F2FD;
    --chat-admin-bg: #F5F5F5;
    --chat-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --chat-radius: 8px;
}

.anesda-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* ============= Chat Bubble Button ============= */
.chat-bubble-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-dark) 100%);
    color: white;
    border: none;
    font-size: 28px;
    cursor: pointer;
    box-shadow: var(--chat-shadow);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.chat-bubble-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 102, 204, 0.3);
}

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

/* ============= Chat Window ============= */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 450px;
    min-width: 350px;
    height: 600px;
    background: var(--chat-background);
    border-radius: var(--chat-radius);
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--chat-border);
}

/* ============= Chat Header ============= */
.chat-header {
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-dark) 100%);
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--chat-border);
}

.chat-title {
    flex: 1;
}

.chat-title h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-status {
    font-size: 12px;
    opacity: 0.9;
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
}

.chat-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.chat-close-btn:hover {
    transform: scale(1.2);
}

/* ============= Messages Container ============= */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #FAFAFA;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Welcome Message */
.chat-welcome {
    padding: 12px;
    background: var(--chat-admin-bg);
    border-radius: var(--chat-radius);
    text-align: center;
    color: var(--chat-text-light);
}

.chat-welcome p {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.4;
}

/* ============= Chat Messages ============= */
.chat-message {
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease-out;
}

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

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

.chat-message--admin {
    align-items: flex-start;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 12px;
}

.message-sender {
    font-weight: 600;
    color: var(--chat-text-dark);
}

.message-time {
    color: var(--chat-text-light);
    margin-left: 8px;
    font-size: 11px;
}

.message-content {
    max-width: 84%;
    padding: 10px 12px;
    border-radius: 8px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
    font-size: 14px;
}

.chat-message--user .message-content {
    background: var(--chat-primary);
    color: white;
    border-bottom-right-radius: 2px;
}

.chat-message--admin .message-content {
    background: var(--chat-admin-bg);
    color: var(--chat-text-dark);
    border-bottom-left-radius: 2px;
}

/* ============= Input Area ============= */
.chat-input-area {
    border-top: 1px solid var(--chat-border);
    padding: 12px;
    background: var(--chat-background);
}

.chat-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row {
    display: flex;
    gap: 8px;
    flex-direction: column;
}

.chat-input {
    flex: 1;
    border: 1px solid var(--chat-border);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.chat-input:focus {
    outline: none;
    border-color: var(--chat-primary);
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.chat-textarea {
    resize: none;
    min-height: 60px;
    max-height: 120px;
}

.chat-send-btn {
    padding: 10px 16px;
    background: var(--chat-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    align-self: flex-end;
}

.chat-send-btn:hover {
    background: var(--chat-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.3);
}

.chat-send-btn:active {
    transform: translateY(0);
}

/* ============= Feedback Message ============= */
.chat-feedback {
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    margin-top: 8px;
    text-align: center;
    animation: fadeInOut 0.3s ease;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.chat-feedback--success {
    background: #C8E6C9;
    color: #2E7D32;
}

.chat-feedback--error {
    background: #FFCDD2;
    color: #C62828;
}

.chat-feedback--info {
    background: #BBDEFB;
    color: #1565C0;
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--chat-border);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--chat-text-light);
}

/* ============= Responsive Design ============= */
@media (max-width: 768px) {
    .anesda-chat-widget {
        bottom: 10px;
        right: 10px;
    }

    .chat-window {
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
        height: 70vh;
        bottom: 70px;
        min-width: auto;
    }

    .chat-bubble-btn {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }

    .message-content {
        max-width: 90%;
    }
}

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

    .chat-header {
        border-radius: 0;
    }

    .chat-messages {
        padding: 12px;
    }

    .chat-input-area {
        padding: 10px;
    }

    .form-row {
        flex-direction: column;
    }

    .chat-input {
        width: 100%;
    }

    .message-content {
        max-width: 100%;
    }
}

/* ============= Dark Mode Support (Optional) ============= */
@media (prefers-color-scheme: dark) {
    .anesda-chat-widget {
        --chat-background: #2D2D2D;
        --chat-text-dark: #FFFFFF;
        --chat-text-light: #CCCCCC;
        --chat-border: #444444;
        --chat-user-bg: #1A3A52;
        --chat-admin-bg: #3A3A3A;
    }

    .chat-messages {
        background: #1F1F1F;
    }

    .chat-welcome {
        background: var(--chat-admin-bg);
        color: var(--chat-text-light);
    }

    .message-time {
        color: var(--chat-text-light);
    }

    .message-sender {
        color: var(--chat-text-dark);
    }
}

/* ============= Print Styles ============= */
@media print {
    .anesda-chat-widget {
        display: none !important;
    }
}
