/* PM Car Detailing - AI Chat Widget */
.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: var(--font-sans, -apple-system, sans-serif);
}

.chat-widget__toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c41e3a 0%, #a01930 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(196, 30, 58, .5);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .3s, box-shadow .3s;
}

.chat-widget__toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 28px rgba(196, 30, 58, .6);
}

.chat-widget__toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.chat-widget__toggle .chat-widget__close-icon {
    display: none;
}

.chat-widget.open .chat-widget__toggle .chat-widget__open-icon {
    display: none;
}

.chat-widget.open .chat-widget__toggle .chat-widget__close-icon {
    display: block;
}

.chat-widget__panel {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 500px;
    max-height: calc(100vh - 140px);
    background: var(--color-bg-card, #1a1a1a);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chat-widget.open .chat-widget__panel {
    display: flex;
}

.chat-widget__header {
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #c41e3a 0%, #8b1528 100%);
    color: white;
    display: flex;
    align-items: center;
    gap: .75rem;
}

.chat-widget__header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.chat-widget__header p {
    margin: .25rem 0 0;
    font-size: .8rem;
    opacity: .9;
}

.chat-widget__messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-widget__message {
    max-width: 85%;
    padding: .75rem 1rem;
    border-radius: 12px;
    font-size: .9rem;
    line-height: 1.5;
}

.chat-widget__message--bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .1);
}

.chat-widget__welcome {
    width: 100%;
    max-width: 100%;
}

.chat-widget__welcome p {
    margin: 0 0 1rem;
}

.chat-widget__quick-options {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.chat-widget__quick-options--hidden {
    display: none !important;
}

.chat-widget__quick-option {
    display: block;
    width: 100%;
    padding: .8rem 1rem;
    background: rgba(196, 30, 58, .3);
    border: 1px solid rgba(196, 30, 58, .5);
    border-radius: 10px;
    color: #ff6b8a;
    font-size: .9rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background .2s, color .2s, transform .2s;
}

.chat-widget__quick-option:hover {
    background: rgba(196, 30, 58, .5);
    color: white;
    transform: translateX(4px);
}

.chat-widget__message--user {
    align-self: flex-end;
    background: linear-gradient(135deg, #c41e3a 0%, #8b1528 100%);
    color: white;
}

.chat-widget__message--error {
    align-self: stretch;
    background: rgba(220, 38, 38, .2);
    border: 1px solid rgba(220, 38, 38, .4);
}

.chat-widget__links {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .75rem;
}

.chat-widget__link-btn {
    display: inline-block;
    padding: .5rem 1rem;
    background: rgba(196, 30, 58, .3);
    color: #ff6b8a;
    border: 1px solid rgba(196, 30, 58, .5);
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .2s, color .2s;
}

.chat-widget__link-btn:hover {
    background: rgba(196, 30, 58, .5);
    color: white;
}

.chat-widget__input-area {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
    display: flex;
    gap: .5rem;
    align-items: center;
}

.chat-widget__input {
    flex: 1;
    padding: .75rem 1rem;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 10px;
    background: rgba(0, 0, 0, .3);
    color: white;
    font-size: .9rem;
}

.chat-widget__input::placeholder {
    color: rgba(255, 255, 255, .5);
}

.chat-widget__input:focus {
    outline: none;
    border-color: var(--color-accent, #c41e3a);
}

.chat-widget__send {
    padding: .75rem 1.25rem;
    background: linear-gradient(135deg, #c41e3a 0%, #8b1528 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s;
}

.chat-widget__send:hover:not(:disabled) {
    opacity: .9;
}

.chat-widget__send:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.chat-widget__typing {
    display: flex;
    gap: 4px;
    padding: .75rem 1rem;
}

.chat-widget__typing span {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, .5);
    border-radius: 50%;
    animation: chat-widget-bounce 1.4s ease-in-out infinite;

}

.chat-widget__typing span:nth-child(2) { animation-delay: .2s; }
.chat-widget__typing span:nth-child(3) { animation-delay: .4s; }

@keyframes chat-widget-bounce {
    0%, 80%, 100% { transform: scale(0.8); opacity: .5; }
    40% { transform: scale(1.2); opacity: 1; }
}

/* In-Chat Booking Form */
.chat-widget__booking-form {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.chat-booking-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: .85rem;
    color: var(--color-text-muted, rgba(255,255,255,.8));
}

.chat-booking-back {
    background: none;
    border: none;
    color: var(--color-accent, #c41e3a);
    cursor: pointer;
    font-size: .9rem;
    padding: 0;
}

.chat-booking-back:hover {
    text-decoration: underline;
}

.chat-booking-step h4 {
    margin: 0 0 .75rem;
    font-size: 1rem;
}

.chat-booking-options {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.chat-booking-btn {
    display: block;
    width: 100%;
    padding: .7rem 1rem;
    background: rgba(196, 30, 58, .3);
    border: 1px solid rgba(196, 30, 58, .5);
    border-radius: 8px;
    color: #ff6b8a;
    font-size: .85rem;
    text-align: left;
    cursor: pointer;
    transition: background .2s, color .2s;
}

.chat-booking-btn:hover {
    background: rgba(196, 30, 58, .5);
    color: white;
}

.chat-booking-btn.chat-booking-next,
.chat-booking-btn.chat-booking-submit {
    margin-top: 1rem;
    text-align: center;
    background: linear-gradient(135deg, #c41e3a 0%, #8b1528 100%);
    color: white;
    border-color: transparent;
}

.chat-booking-checkboxes {
    gap: .5rem;
}

.chat-booking-checkbox {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    font-size: .85rem;
    color: var(--color-text-muted, rgba(255,255,255,.8));
}

.chat-booking-checkbox input {
    margin: 0;
}

.chat-booking-fields {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.chat-booking-fields label {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    font-size: .85rem;
}

.chat-booking-fields input,
.chat-booking-fields select {
    padding: .6rem;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,.2);
    background: rgba(0,0,0,.3);
    color: white;
    font-size: .9rem;
}

.chat-booking-summary {
    font-size: .9rem;
    margin-bottom: 1rem;
}

.chat-booking-summary p {
    margin: .35rem 0;
}

.chat-booking-pay-options {
    margin-bottom: 1rem;
}

.chat-booking-pay-options label {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .5rem;
    cursor: pointer;
    font-size: .9rem;
}

.chat-booking-error {
    color: #dc2626;
    font-size: .85rem;
    margin: 0;
}

@media (max-width: 768px) {
    .chat-widget {
        bottom: 90px; /* Above sticky Book Now button */
    }
}

@media (max-width: 480px) {
    .chat-widget {
        right: 16px;
    }
    .chat-widget__panel {
        width: calc(100vw - 32px);
        right: -8px;
    }
}
