/* Chat Widget Styles */
.chat-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Chat Button */
.chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.6);
}

.chat-button svg {
    width: 30px;
    height: 30px;
    fill: white;
}

.chat-button .close-icon {
    display: none;
}

.chat-button.active .chat-icon {
    display: none;
}

.chat-button.active .close-icon {
    display: block;
}

/* Unread Badge */
.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
}

.chat-badge.show {
    display: flex;
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    left: 0;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chat-window.open {
    display: flex;
    animation: slideUp 0.3s ease;
}

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

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

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

.chat-header-info p {
    margin: 2px 0 0 0;
    font-size: 12px;
    opacity: 0.9;
}

/* Chat Body */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f7f7f7;
    display: flex;
    flex-direction: column;
}

/* Welcome Screen */
.chat-welcome {
    text-align: center;
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.chat-welcome h3 {
    color: #222;
    margin: 0 0 6px 0;
    font-size: 20px;
}

.chat-welcome p {
    color: #666;
    margin: 0 0 12px 0;
    font-size: 14px;
    line-height: 1.4;
}

/* Tabs */
.chat-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    background: #f0f0f0;
    padding: 4px;
    border-radius: 8px;
}

.chat-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-tab:hover {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.chat-tab.active {
    background: white;
    color: #10b981;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chat-tab-content {
    flex: 1;
    overflow-y: auto;
}

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

.chat-user-form input,
.chat-user-form textarea {
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.chat-user-form input:focus,
.chat-user-form textarea:focus {
    outline: none;
    border-color: #10b981;
}

.chat-user-form input.error {
    border-color: #ef4444;
}

.chat-user-form .error-message {
    color: #ef4444;
    font-size: 12px;
    margin-top: -8px;
    display: none;
}

.chat-user-form .error-message.show {
    display: block;
}

/* Feedback Success */
.feedback-success {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.feedback-success h3 {
    color: #10b981;
    font-size: 24px;
    margin-bottom: 12px;
}

.feedback-success p {
    color: #666;
    margin-bottom: 24px;
}

.btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
}

.chat-user-form textarea {
    resize: vertical;
    min-height: 80px;
}

.chat-user-form button {
    padding: 12px 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.chat-user-form button:hover {
    transform: translateY(-1px);
}

/* Chat Messages */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

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

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

.message-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-message.user .message-bubble {
    background: #10b981;
    color: white;
    border-bottom-right-radius: 4px;
}

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

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 4px;
}

.chat-message.user .message-time {
    text-align: right;
}

.chat-message.admin .message-time {
    text-align: left;
}

/* Chat Footer */
.chat-footer {
    padding: 16px;
    background: white;
    border-top: 1px solid #eee;
}

.chat-response-notice {
    font-size: 11px;
    color: #666;
    text-align: center;
    margin-bottom: 12px;
    padding: 6px;
    background: #fef3c7;
    border-radius: 6px;
}

.chat-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input-wrapper input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
}

.chat-input-wrapper input:focus {
    outline: none;
    border-color: #10b981;
}

.chat-send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #10b981;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.chat-send-button:hover {
    background: #059669;
}

.chat-send-button:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

.chat-send-button svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 140px);
        max-height: 600px;
    }
}

/* Scrollbar */
.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-body::-webkit-scrollbar-thumb {
    background: #10b981;
    border-radius: 3px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
    background: #059669;
}

/* Back Button & Actions Wrapper */
.chat-actions-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 8px;
}

.chat-actions-wrapper .chat-response-notice {
    margin-bottom: 0;
    flex: 1;
}

.chat-back-button {
    background: transparent;
    border: 1px solid #ddd;
    color: #666;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.chat-back-button:hover {
    background: #f0f0f0;
    border-color: #10b981;
    color: #10b981;
}

/* Secondary Button */
.btn-secondary {
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.btn-secondary:hover {
    border-color: #10b981;
    color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

/* Or Text Divider */
.or-text {
    color: #999;
    font-size: 12px;
    margin: 12px 0 !important;
}

/* Chat Deleted Notice */
.chat-deleted-notice {
    text-align: center;
    padding: 30px 20px;
}

.chat-deleted-notice .deleted-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.chat-deleted-notice h3 {
    color: #666;
    font-size: 20px;
    margin-bottom: 8px;
}

.chat-deleted-notice p {
    color: #888;
    margin-bottom: 20px;
    font-size: 14px;
}

.chat-deleted-notice .btn-primary {
    display: block;
    width: 100%;
    margin-bottom: 8px;
}

.chat-deleted-notice .btn-secondary {
    display: block;
    width: 100%;
}
