/**
 * Modern Chat Widget Styles
 * Gordons Makeovers
 */

:root {
    --aacb-primary: rgb(213, 172, 99);
    --aacb-secondary: #2C3E50;
    --aacb-success: #27AE60;
    --aacb-text: #333;
    --aacb-border: #E1E4E8;
    --aacb-bg: #FFFFFF;
    --aacb-shadow: 0 5px 40px rgba(0,0,0,0.16);
    --aacb-light-gray: #F5F5F5;
}

/* Chat Bubble */
.aacb-chat-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--aacb-primary);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--aacb-shadow);
    transition: transform 0.3s ease;
    z-index: 9999;
    animation: attentionShake 5s ease-in-out infinite;
}

@keyframes attentionShake {
    0%, 70%, 100% {
        transform: translateX(0);
    }
    72% {
        transform: translateX(-5px) rotate(-2deg);
    }
    74% {
        transform: translateX(5px) rotate(2deg);
    }
    76% {
        transform: translateX(-3px) rotate(-1deg);
    }
    78% {
        transform: translateX(3px) rotate(1deg);
    }
    80% {
        transform: translateX(-2px) rotate(0deg);
    }
    82% {
        transform: translateX(2px) rotate(0deg);
    }
}

.aacb-chat-bubble:hover {
    transform: scale(1.05);
    animation: none;
}

.aacb-bubble-text {
    font-weight: 500;
}

/* Old Chat Bubble (ID) - Hidden, using modern bubble instead */
#aacb-bubble,
.aacb-bubble,
#aacb-widget {
    display: none !important;
}

/* Chat Widget - Hidden by default */
.aacb-widget {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--aacb-shadow);
    flex-direction: column;
    z-index: 10000;
}

.aacb-widget.aacb-widget--open {
    display: flex;
}

/* Main Window */
.aacb-chat-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--aacb-shadow);
    display: flex;
    flex-direction: column;
    z-index: 10000;
}

/* Header */
.aacb-chat-header {
    background: var(--aacb-secondary);
    color: white;
    padding: 16px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.aacb-agent-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.aacb-agent-avatar {
    width: 40px;
    height: 40px;
    background-image: url('https://plus.unsplash.com/premium_photo-1658506665340-ddad298283fb');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 50%;
    border: 2px solid var(--aacb-primary);
}

.aacb-agent-name {
    font-weight: 600;
    font-size: 16px;
}

.aacb-agent-status {
    font-size: 12px;
    opacity: 0.9;
}

.aacb-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.aacb-menu-dots-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.aacb-menu-dots-btn:hover {
    opacity: 1;
}

.aacb-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 150px;
    overflow: hidden;
}

.aacb-dropdown-menu button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: var(--aacb-secondary);
    transition: background 0.2s ease;
}

.aacb-dropdown-menu button:hover {
    background: var(--aacb-light-gray);
}

.aacb-restart-chat {
    border-bottom: 1px solid var(--aacb-border);
}

.aacb-close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
}

/* Menu View */
.aacb-menu-view {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.aacb-welcome-message {
    text-align: center;
    margin-bottom: 40px;
    padding-top: 20px;
}

.aacb-welcome-message h3 {
    color: var(--aacb-secondary);
    font-size: 24px;
    font-weight: 500;
    margin: 0;
}

.aacb-welcome-message p {
    color: #666;
    font-size: 14px;
    margin-top: 8px;
}

.aacb-menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aacb-menu-btn {
    background: white;
    border: 2px solid var(--aacb-border);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.aacb-menu-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, transparent, rgba(213, 172, 99, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.aacb-menu-btn:hover::before {
    opacity: 1;
}

.aacb-menu-btn:hover {
    border-color: var(--aacb-primary);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(213, 172, 99, 0.25);
}

.aacb-menu-btn svg {
    width: 36px;
    height: 36px;
    color: var(--aacb-primary);
    flex-shrink: 0;
}

.aacb-menu-btn div {
    flex: 1;
}

.aacb-menu-btn span {
    font-size: 16px;
    font-weight: 600;
    color: var(--aacb-secondary);
    display: block;
}

.aacb-menu-btn small {
    font-size: 13px;
    color: #666;
    display: block;
    margin-top: 4px;
}

/* Chat View */
.aacb-chat-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.aacb-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 0;
    scroll-behavior: smooth;
}

.aacb-messages-container {
    display: flex;
    flex-direction: column;
}

.aacb-message {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

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

.aacb-message-avatar {
    width: 32px;
    height: 32px;
    background-image: url('https://plus.unsplash.com/premium_photo-1658506665340-ddad298283fb');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 50%;
    border: 1px solid var(--aacb-primary);
}

.aacb-message-content {
    max-width: 70%;
    background: #F4F4F4;
    padding: 12px;
    border-radius: 12px;
}

.aacb-message-user .aacb-message-content {
    background: var(--aacb-primary);
    color: white;
}

.aacb-message-sender {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.7;
}

.aacb-message-text {
    font-size: 14px;
    line-height: 1.4;
}

.aacb-message-time {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.5;
}

/* Inline Booking Button */
.aacb-inline-booking-button {
    margin-top: 10px;
}

.aacb-inline-booking-button button {
    background: var(--aacb-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(213, 172, 99, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.aacb-inline-booking-button button:hover {
    background: rgb(193, 152, 79);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(213, 172, 99, 0.4);
}

.aacb-inline-booking-button button:active {
    transform: translateY(0);
}

/* Chat Input */
.aacb-chat-input {
    padding: 12px;
    border-top: 1px solid var(--aacb-border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.aacb-back-to-menu,
.aacb-back-to-calendar,
.aacb-back-to-time {
    background: var(--aacb-primary);
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.aacb-back-to-menu:hover,
.aacb-back-to-calendar:hover,
.aacb-back-to-time:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(213, 172, 99, 0.3);
}

.aacb-input-form {
    flex: 1;
    display: flex;
    gap: 8px;
}

.aacb-message-input {
    flex: 1;
    padding: 12px 20px;
    min-height: 44px;
    border: 1px solid var(--aacb-border);
    border-radius: 22px;
    font-size: 14px;
    color: black !important;
    outline: none;
    background: var(--aacb-light-gray);
    transition: all 0.3s ease;
}

.aacb-message-input::placeholder {
    color: #999;
    opacity: 1;
}

.aacb-message-input:focus {
    border-color: var(--aacb-primary);
    background: white;
    color: black !important;
}

.aacb-send-btn {
    background: var(--aacb-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(213, 172, 99, 0.3);
}

.aacb-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(213, 172, 99, 0.4);
}

/* Calendar View */
.aacb-calendar-view {
    padding: 16px;
    overflow-y: auto;
}

.aacb-calendar-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    text-align: center;
}

.aacb-calendar-header h3 {
    color: var(--aacb-secondary);
    margin-bottom: 8px;
    font-size: 20px;
    font-weight: 600;
}

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

.aacb-prev-month,
.aacb-next-month {
    background: var(--aacb-primary);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
}

.aacb-month-year {
    font-weight: 600;
    color: var(--aacb-secondary);
}

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

.aacb-calendar-header,
.aacb-calendar-day {
    text-align: center;
    padding: 8px;
    font-size: 14px;
}

.aacb-calendar-header {
    font-weight: 600;
    color: #666;
}

.aacb-calendar-day {
    cursor: pointer;
    border-radius: 4px;
}

.aacb-calendar-available {
    background: #F0F0F0;
}

.aacb-calendar-available:hover {
    background: var(--aacb-primary);
    color: white;
}

.aacb-calendar-disabled {
    color: #CCC;
    cursor: not-allowed;
    background: #FAFAFA;
}

.aacb-calendar-empty {
    visibility: hidden;
}

/* Time View */
.aacb-time-view {
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.aacb-time-header {
    margin-bottom: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.aacb-time-header h3 {
    color: var(--aacb-secondary);
    margin-bottom: 8px;
    font-size: 20px;
    font-weight: 600;
}

.aacb-selected-date {
    color: #666;
    font-size: 14px;
}

.aacb-time-section {
    margin-bottom: 24px;
}

.aacb-time-section h4 {
    color: var(--aacb-secondary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--aacb-border);
}

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

.aacb-time-slot {
    background: white;
    border: 1px solid var(--aacb-border);
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    font-size: 14px;
    transition: all 0.3s ease;
}

.aacb-time-slot:hover {
    border-color: var(--aacb-primary);
    background: var(--aacb-primary);
    color: white;
}

/* AM/PM Selection Buttons */
.aacb-ampm-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 10px 0;
}

.aacb-ampm-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: white;
    border: 2px solid var(--aacb-border);
    border-radius: 12px;
    padding: 24px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.aacb-ampm-btn:hover {
    border-color: var(--aacb-primary);
    background: var(--aacb-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(213, 172, 99, 0.3);
}

.aacb-ampm-btn svg {
    color: var(--aacb-primary);
}

.aacb-ampm-btn:hover svg {
    color: white;
}

.aacb-ampm-label {
    font-size: 18px;
    font-weight: 600;
    color: var(--aacb-secondary);
}

.aacb-ampm-btn:hover .aacb-ampm-label {
    color: white;
}


/* Form View */
.aacb-form-view {
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.aacb-form-header {
    margin-bottom: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.aacb-form-header h3 {
    color: var(--aacb-secondary);
    margin-bottom: 8px;
    font-size: 20px;
    font-weight: 600;
}

.aacb-booking-datetime {
    color: var(--aacb-primary);
    font-weight: 600;
    font-size: 14px;
}

.aacb-booking-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.aacb-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.aacb-form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--aacb-secondary);
}

.aacb-form-group input,
.aacb-form-group textarea {
    padding: 10px;
    border: 1px solid var(--aacb-border);
    border-radius: 6px;
    font-size: 14px;
}

.aacb-form-group input:focus,
.aacb-form-group textarea:focus {
    outline: none;
    border-color: var(--aacb-primary);
}

.aacb-submit-btn {
    background: var(--aacb-primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.aacb-submit-btn:hover {
    background: #c49c53;
}

/* Confirmation */
.aacb-confirmation {
    text-align: center;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.aacb-success-tick {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    animation: checkmark 0.5s ease-in-out;
}

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

.aacb-confirmation-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--aacb-success);
    margin: 0;
}

.aacb-confirmation-message {
    font-size: 16px;
    color: #666;
    margin: 0;
}

.aacb-confirmation-details {
    background: var(--aacb-light-gray);
    border-radius: 12px;
    padding: 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.aacb-detail-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    text-align: left;
}

.aacb-detail-item svg {
    color: var(--aacb-primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.aacb-detail-label {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.aacb-detail-value {
    font-size: 15px;
    color: var(--aacb-secondary);
    font-weight: 500;
}

.aacb-confirmation-email {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: #E8F5E9;
    border-radius: 8px;
    font-size: 14px;
    color: #2E7D32;
    width: 100%;
}

.aacb-confirmation-email svg {
    flex-shrink: 0;
}

.aacb-confirmation-email strong {
    font-weight: 600;
}

.aacb-done-btn {
    background: var(--aacb-primary);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.aacb-done-btn:hover {
    background: #c49c53;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(213, 172, 99, 0.3);
}

/* Typing Indicator */
.aacb-typing-indicator {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.aacb-typing-dots {
    display: flex;
    gap: 4px;
    padding: 12px;
    background: #F4F4F4;
    border-radius: 12px;
}

.aacb-typing-dots span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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

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

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