/* =====================================================
   BLITZ STUDIO - AI Chatbot Styles
   Premium Floating Chat Widget
   ===================================================== */

/* =====================================================
   Chat Widget Container
   ===================================================== */
.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* =====================================================
   Chat Trigger Button
   ===================================================== */
.chat-trigger {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 8px 32px rgba(29, 185, 84, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.chat-trigger::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
    border-radius: 50%;
}

.chat-trigger:hover {
    transform: scale(1.1);
    box-shadow:
        0 12px 40px rgba(29, 185, 84, 0.5),
        0 6px 16px rgba(0, 0, 0, 0.3);
}

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

.chat-trigger-icon {
    width: 28px;
    height: 28px;
    color: var(--bg-dark);
    transition: transform 0.3s ease;
}

.chat-trigger.active .chat-trigger-icon {
    transform: rotate(180deg);
}

.chat-trigger .icon-chat,
.chat-trigger .icon-close {
    position: absolute;
    transition: all 0.3s ease;
}

.chat-trigger .icon-close {
    opacity: 0;
    transform: scale(0) rotate(-180deg);
}

.chat-trigger.active .icon-chat {
    opacity: 0;
    transform: scale(0) rotate(180deg);
}

.chat-trigger.active .icon-close {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* Notification Badge */
.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 24px;
    height: 24px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    border: 3px solid var(--bg-dark);
    animation: pulse-badge 2s ease-in-out infinite;
}

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

/* Scroll Notification Popup */
.chat-notification-popup {
    position: absolute;
    bottom: 80px;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-green);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow:
        0 10px 40px rgba(29, 185, 84, 0.2),
        0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    min-width: 220px;
    white-space: nowrap;
}

.chat-notification-popup.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.chat-notification-popup::before {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 24px;
    width: 16px;
    height: 16px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-green);
    border-bottom: 1px solid var(--border-green);
    transform: rotate(45deg);
}

.notification-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
}

.notification-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.notification-subtext {
    font-size: 12px;
    color: var(--text-secondary);
}

.notification-close {
    width: 24px;
    height: 24px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 10px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.notification-close:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Pulse animation for trigger when notification is showing */
.chat-trigger.has-notification {
    animation: notification-pulse 2s ease-in-out infinite;
}

@keyframes notification-pulse {
    0%, 100% {
        box-shadow:
            0 8px 32px rgba(29, 185, 84, 0.4),
            0 4px 12px rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow:
            0 8px 32px rgba(29, 185, 84, 0.6),
            0 4px 12px rgba(0, 0, 0, 0.2),
            0 0 0 8px rgba(29, 185, 84, 0.15);
    }
}

/* =====================================================
   Chat Window
   ===================================================== */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.4),
        0 10px 30px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* =====================================================
   Chat Header
   ===================================================== */
.chat-header {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.chat-header-avatar {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.chat-header-avatar i {
    font-size: 22px;
    color: var(--bg-dark);
}

.chat-header-status {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: #22c55e;
    border: 3px solid var(--bg-elevated);
    border-radius: 50%;
}

.chat-header-info {
    flex: 1;
}

.chat-header-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.chat-header-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-header-subtitle .status-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse-status 2s ease-in-out infinite;
}

@keyframes pulse-status {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chat-close {
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.chat-close:hover {
    background: var(--bg-card);
    border-color: var(--border-green);
    color: var(--primary);
}

/* =====================================================
   Chat Messages Area
   ===================================================== */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

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

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

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

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

/* Message Bubble */
.chat-message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: message-appear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-message.bot .message-avatar {
    background: var(--gradient-primary);
}

.chat-message.bot .message-avatar i {
    font-size: 14px;
    color: var(--bg-dark);
}

.chat-message.user .message-avatar {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}

.chat-message.user .message-avatar i {
    font-size: 14px;
    color: var(--text-secondary);
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-bubble {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
}

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

.chat-message.user .message-bubble {
    background: var(--gradient-primary);
    color: var(--bg-dark);
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    padding: 0 4px;
}

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

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 6px;
    padding: 14px 18px;
}

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

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

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Quick Replies */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.quick-reply {
    background: var(--bg-card);
    border: 1px solid var(--border-green);
    color: var(--primary);
    padding: 10px 16px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-reply:hover {
    background: var(--gradient-primary);
    color: var(--bg-dark);
    transform: translateY(-2px);
}

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

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 18px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    min-height: 48px;
    transition: border-color 0.3s ease;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
}

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

.chat-send {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--bg-dark);
    font-size: 18px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex-shrink: 0;
}

.chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px var(--glow-primary);
}

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

.chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* =====================================================
   Date Picker / Calendar Embed
   ===================================================== */
.calendar-embed {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    margin-top: 12px;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.calendar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.calendar-nav {
    display: flex;
    gap: 8px;
}

.calendar-nav button {
    width: 28px;
    height: 28px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 12px;
    transition: all 0.2s ease;
}

.calendar-nav button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day-label {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    padding: 8px 0;
    font-weight: 600;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calendar-day:hover:not(.disabled):not(.selected) {
    background: var(--bg-elevated);
}

.calendar-day.disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}

.calendar-day.selected {
    background: var(--gradient-primary);
    color: var(--bg-dark);
    font-weight: 700;
}

.calendar-day.today {
    border: 1px solid var(--primary);
}

/* Time Slots */
.time-slots {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.time-slots-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.time-slots-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.time-slot {
    padding: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-primary);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.time-slot:hover:not(.disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.time-slot.selected {
    background: var(--gradient-primary);
    border-color: var(--primary);
    color: var(--bg-dark);
    font-weight: 600;
}

.time-slot.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =====================================================
   Welcome Screen
   ===================================================== */
.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 24px;
    flex: 1;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    background: var(--gradient-primary);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    animation: float-premium 3s ease-in-out infinite;
}

.welcome-icon i {
    font-size: 36px;
    color: var(--bg-dark);
}

.welcome-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.welcome-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    max-width: 280px;
    line-height: 1.6;
}

.welcome-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.welcome-option {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.welcome-option:hover {
    border-color: var(--border-green);
    transform: translateX(4px);
}

.welcome-option-icon {
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border: 1px solid var(--border-green);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 18px;
    flex-shrink: 0;
}

.welcome-option-text {
    flex: 1;
}

.welcome-option-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.welcome-option-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 480px) {
    .chat-widget {
        bottom: 16px;
        right: 16px;
    }

    .chat-trigger {
        width: 56px;
        height: 56px;
    }

    .chat-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
        bottom: 72px;
        right: -8px;
        border-radius: 20px;
    }

    .chat-header {
        padding: 16px;
    }

    .chat-messages {
        padding: 16px;
    }

    .chat-input-area {
        padding: 12px 16px;
    }

    .chat-input {
        padding: 12px 14px;
    }

    .chat-send {
        width: 44px;
        height: 44px;
    }

    .welcome-options {
        gap: 10px;
    }

    .welcome-option {
        padding: 14px 16px;
    }
}
