/* =====================================================
   MIGUN re:bene — Chat Widget Styles
   Floating chat assistant with responsive design
   ===================================================== */

/* Chat Widget Container */
.chat-widget {
    position: fixed;
    bottom: 100px;
    right: 20px;
    z-index: 1000;
    font-family: var(--font-body);
}

/* Chat Toggle Button */
.chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gold);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
}

.chat-toggle:hover {
    background: var(--gold-dark);
    transform: scale(1.1);
    box-shadow: var(--shadow-gold);
}

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

.chat-toggle img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.chat-toggle .notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: var(--error);
    border-radius: 50%;
    border: 2px solid var(--white);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: var(--transition-base);
    border: 1px solid var(--border);
}

.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Chat Header */
.chat-header {
    background: var(--black);
    color: var(--white);
    padding: 15px 20px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header .chat-title {
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-header .chat-status {
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.chat-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Chat Messages Container */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-secondary);
    scroll-behavior: smooth;
}

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

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

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

/* Message Styles */
.chat-message {
    margin-bottom: 15px;
    display: flex;
    animation: slideIn 0.3s ease;
}

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

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

.chat-message.bot {
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

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

.chat-message.bot .message-content {
    background: var(--white);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: right;
}

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

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    border-bottom-left-radius: 4px;
    margin-bottom: 15px;
    width: fit-content;
}

.typing-indicator.active {
    display: flex;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--gray-text);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Chat Input */
.chat-input {
    padding: 15px;
    background: var(--white);
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-body);
    transition: var(--transition-fast);
}

.chat-input input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.1);
}

.chat-input input::placeholder {
    color: var(--text-muted);
}

.chat-send {
    background: var(--gold);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 5px;
}

.chat-send:hover:not(:disabled) {
    background: var(--gold-dark);
}

.chat-send:disabled {
    background: var(--gray-medium);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Quick Actions */
.chat-quick-actions {
    padding: 10px 15px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-action-btn {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition-fast);
    color: var(--text-secondary);
}

.quick-action-btn:hover {
    background: var(--gold);
    color: var(--white);
    border-color: var(--gold);
}

/* Home & Delete action buttons */
.chat-quick-actions {
    justify-content: flex-start;
    align-items: center;
}

.chat-action-btn {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    cursor: pointer;
    transition: var(--transition-fast);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.chat-action-btn:hover {
    color: var(--gold);
    border-color: var(--gold);
}

.chat-home-btn {
    margin-left: auto;
}

.chat-delete-btn:hover {
    color: #dc3545;
    border-color: #dc3545;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

.welcome-message h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 16px;
}

.welcome-message p {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
}

.welcome-message .quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.welcome-message .quick-action-btn {
    text-align: left;
    padding: 10px 15px;
    border-radius: var(--radius-md);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-widget {
        bottom: 80px;
        right: 15px;
    }
    
    .chat-toggle {
        width: 50px;
        height: 50px;
    }
    
    .chat-toggle img {
        width: 28px;
        height: 28px;
    }
    
    .chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }
    
    .chat-window.active {
        transform: translateY(0);
    }
    
    .chat-header {
        border-radius: 0;
        padding: 15px 20px;
    }
    
    .chat-messages {
        padding: 15px;
    }
    
    .message-content {
        max-width: 85%;
        font-size: 15px;
    }
    
    .chat-input {
        padding: 15px 20px;
    }
    
    .chat-quick-actions {
        padding: 10px 20px;
    }
    
    .quick-action-btn {
        font-size: 13px;
        padding: 8px 14px;
    }
}

@media (max-width: 480px) {
    .chat-widget {
        bottom: 70px;
        right: 10px;
    }
    
    .chat-toggle {
        width: 45px;
        height: 45px;
    }
    
    .chat-toggle img {
        width: 24px;
        height: 24px;
    }
    
    .message-content {
        font-size: 14px;
    }
}

/* Bottom Sheet Alternative for Mobile */
@media (max-width: 768px) {
    .chat-window.bottom-sheet {
        height: 80vh;
        border-radius: 20px 20px 0 0;
        top: auto;
        bottom: 0;
    }
    
    .chat-window.bottom-sheet .chat-header {
        border-radius: 20px 20px 0 0;
    }
    
    .chat-window.bottom-sheet .chat-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: var(--gray-medium);
        border-radius: 2px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .chat-window {
        background: var(--bg-dark);
        border-color: var(--border);
    }
    
    .chat-message.bot .message-content {
        background: var(--bg-dark-alt);
        color: var(--white);
        border-color: var(--border);
    }
    
    .chat-input {
        background: var(--bg-dark-alt);
        border-color: var(--border);
    }
    
    .chat-input input {
        background: var(--bg-dark);
        color: var(--white);
        border-color: var(--border);
    }
    
    .typing-indicator {
        background: var(--bg-dark-alt);
        border-color: var(--border);
    }
    
    .quick-action-btn {
        background: var(--bg-dark-alt);
        color: var(--white);
        border-color: var(--border);
    }
    
    .welcome-message {
        color: var(--text-muted);
    }
}

/* Accessibility */
.chat-toggle:focus,
.chat-close:focus,
.chat-send:focus,
.quick-action-btn:focus {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .chat-window {
        border: 2px solid var(--text-primary);
    }
    
    .chat-message.bot .message-content {
        border: 2px solid var(--text-primary);
    }
    
    .chat-input input {
        border: 2px solid var(--text-primary);
    }
}

/* Demo Booking Form */
.demo-booking-form {
    margin: 15px 0;
    padding: 20px;
    background: var(--white);
    border: 2px solid var(--gold);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-gold);
}

.demo-booking-header {
    text-align: center;
    margin-bottom: 20px;
}

.demo-booking-header h4 {
    color: var(--gold);
    margin-bottom: 5px;
    font-size: 18px;
}

.demo-booking-header p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.demo-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.demo-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.demo-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.demo-form label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.demo-form input,
.demo-form select,
.demo-form textarea {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14px;
    transition: var(--transition-fast);
}

.demo-form input:focus,
.demo-form select:focus,
.demo-form textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.1);
}

.demo-form input::placeholder,
.demo-form textarea::placeholder {
    color: var(--text-muted);
}

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

.demo-form .form-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.demo-form .btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    flex: 1;
}

.demo-form .btn-primary {
    background: var(--gold);
    color: var(--white);
}

.demo-form .btn-primary:hover:not(:disabled) {
    background: var(--gold-dark);
}

.demo-form .btn-primary:disabled {
    background: var(--gray-medium);
    cursor: not-allowed;
    opacity: 0.6;
}

.demo-form .btn-secondary {
    background: var(--gray-light);
    color: var(--text-primary);
}

.demo-form .btn-secondary:hover {
    background: var(--gray-medium);
    color: var(--white);
}

/* Mobile responsive for demo form */
@media (max-width: 768px) {
    .demo-booking-form {
        margin: 10px;
        padding: 15px;
    }
    
    .demo-form .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .demo-form .form-actions {
        flex-direction: column;
    }
    
    .demo-form .btn {
        width: 100%;
    }
}

/* Accessibility */
.demo-form input:focus,
.demo-form select:focus,
.demo-form textarea:focus,
.demo-form .btn:focus {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .demo-booking-form {
        border: 3px solid var(--text-primary);
    }
    
    .demo-form input,
    .demo-form select,
    .demo-form textarea {
        border: 2px solid var(--text-primary);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .chat-toggle,
    .chat-window,
    .chat-message,
    .chat-input input,
    .chat-send,
    .chat-close,
    .quick-action-btn,
    .typing-dot,
    .notification-badge,
    .demo-booking-form,
    .demo-form input,
    .demo-form select,
    .demo-form textarea,
    .demo-form .btn {
        transition: none;
        animation: none;
    }
}
