/* Embedded Chat Styles */

/* Chat floating button */
.chat-floating-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF6B35, #ff8c61);
    border: none;
    cursor: pointer;
    z-index: 1050;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chat-floating-btn:hover {
    transform: scale(1.1);
}

.chat-floating-btn i {
    color: white;
    font-size: 24px;
}

.chat-floating-btn .chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}



/* Chat panel */
.embedded-chat-panel {
    position: fixed;
    bottom: 0;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: auto;
    max-height: 0;
    background: white;
    border-radius: 15px 15px 0 0;
        box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.15);
        box-sizing: border-box;
    z-index: 1001;
    overflow: hidden;
    transition: max-height 0.3s ease, bottom 0.3s ease;
    display: flex;
    flex-direction: column;
}

.embedded-chat-panel.open {
    max-height: 500px;
}

.embedded-chat-panel.keyboard-visible {
    /* Las dimensiones y posiciones son manejadas por el JS (visualViewport)
       para asegurar que el input se mantenga por encima del teclado sin
       desplazar innecesariamente el header. */
    border-radius: 15px 15px 0 0;
    transition: none !important;
}

.embedded-chat-panel.minimized {
    height: 55px;
    max-height: 55px;
}

/* Chat header */
.embedded-chat-header {
    padding: 12px 15px;
    background: linear-gradient(135deg, #FF6B35, #ff8c61);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    flex-shrink: 0;
}

.embedded-chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.embedded-chat-header-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.embedded-chat-header-name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.embedded-chat-header-actions {
    display: flex;
    gap: 8px;
}

.embedded-chat-header-actions button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.embedded-chat-header-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Product info bar */
.embedded-chat-product {
    padding: 10px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.embedded-chat-product-img {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    object-fit: cover;
}

.embedded-chat-product-info {
    flex: 1;
    min-width: 0;
}

.embedded-chat-product-title {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.embedded-chat-product-price {
    font-size: 14px;
    font-weight: 700;
    color: #FF6B35;
}

/* Messages container */
.embedded-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px 15px 6px 15px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

/* Chat body - container for messages/other elements so input stays anchored at bottom */
.embedded-chat-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Message bubbles */
.embedded-chat-message {
    max-width: 80%;
    display: flex;
    flex-direction: column;
}

.embedded-chat-message.sent {
    align-self: flex-end;
}

.embedded-chat-message.received {
    align-self: flex-start;
}

.embedded-chat-message-content {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.embedded-chat-message.sent .embedded-chat-message-content {
    background: linear-gradient(135deg, #FF6B35, #ff8c61);
    color: white;
    border-bottom-right-radius: 4px;
}

.embedded-chat-message.received .embedded-chat-message-content {
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
}

.embedded-chat-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 5px;
}

.embedded-chat-message.sent .embedded-chat-message-time {
    text-align: right;
}

/* Input area */
.embedded-chat-input {
    padding: 12px 15px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.embedded-chat-input input {
    flex: 1;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.embedded-chat-input input:focus {
    border-color: #FF6B35;
}

.embedded-chat-input button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF6B35, #ff8c61);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.embedded-chat-input button:hover {
    transform: scale(1.05);
}

.embedded-chat-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Typing indicator */
.embedded-chat-typing {
    display: none;
    padding: 5px 15px;
    font-size: 12px;
    color: #999;
    font-style: italic;
}

.embedded-chat-typing.visible {
    display: block;
}

/* Welcome/Start chat state */
.embedded-chat-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
    background: #f8f9fa;
}

.embedded-chat-welcome i {
    font-size: 48px;
    color: #FF6B35;
    margin-bottom: 15px;
}

.embedded-chat-welcome h5 {
    margin-bottom: 10px;
    color: #333;
}

.embedded-chat-welcome p {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
}

.embedded-chat-welcome button {
    background: linear-gradient(135deg, #FF6B35, #ff8c61);
    border: none;
    color: white;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.embedded-chat-welcome button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

/* Loading state */
.embedded-chat-loading {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.embedded-chat-loading .spinner-border {
    color: #FF6B35;
}

/* Offer message styling */
.embedded-chat-message.offer .embedded-chat-message-content {
    background: #e3fcf7 !important;
    border: 1px solid #2EC4B6 !important;
    color: #333 !important;
}

.embedded-offer-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-top: 8px;
    font-weight: 500;
}

.embedded-offer-status.pending {
    background-color: #ffd700;
    color: #000;
}

.embedded-offer-status.accepted {
    background-color: #2EC4B6;
    color: #fff;
}

.embedded-offer-status.rejected {
    background-color: #dc3545;
    color: #fff;
}

/* Make Offer Button */
.btn-make-offer {
    background: #fff;
    border: 1px solid #FF6B35;
    color: #FF6B35;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-make-offer:hover {
    background: #FF6B35;
    color: white;
}

/* Form flex behavior so it never clips */
.embedded-chat-offer-form {
    background: #fff;
    border-top: 1px solid #e9ecef;
    padding: 15px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.embedded-chat-panel.keyboard-visible .embedded-chat-product {
    padding: 5px 15px;
}
.embedded-chat-panel.keyboard-visible .embedded-chat-product-img {
    width: 30px;
    height: 30px;
}
.embedded-chat-panel.keyboard-visible .embedded-chat-product-title,
.embedded-chat-panel.keyboard-visible .embedded-chat-product-price {
    font-size: 12px;
}

.offer-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.offer-form-header h6 {
    margin: 0;
    color: #333;
    font-weight: 600;
}

.close-offer-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 5px;
    font-size: 16px;
    line-height: 1;
}

.close-offer-btn:hover {
    color: #333;
}

.offer-form-body .offer-input-group {
    display: flex;
    align-items: stretch;
    margin-bottom: 10px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.offer-form-body .offer-input-group:focus-within {
    border-color: #FF6B35;
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.1);
}

.offer-form-body .offer-input-group .currency-symbol {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #666;
    padding: 0 12px;
    font-weight: 600;
    font-size: 14px;
    border-right: 1px solid #e9ecef;
}

.offer-form-body .offer-input-group input {
    flex: 1;
    border: none;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
}

.offer-form-body .offer-input-group input::placeholder {
    color: #aaa;
}

.offer-form-body .offer-message-input {
    width: 100%;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    font-size: 14px;
    padding: 10px 12px;
    margin-bottom: 10px;
    resize: none;
    font-family: inherit;
}

.offer-form-body .offer-message-input:focus {
    border-color: #FF6B35;
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.1);
}

.btn-submit-offer {
    width: 100%;
    background: linear-gradient(135deg, #FF6B35, #ff8c61);
    border: none;
    color: white;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-submit-offer:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.btn-submit-offer:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ==================== BOOKING FORM STYLES ==================== */

/* Book Service Button */
.btn-book-service {
    background: #fff;
    border: 1px solid #2EC4B6;
    color: #2EC4B6;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-book-service:hover {
    background: #2EC4B6;
    color: white;
}

/* Booking Form Container */
.embedded-chat-booking-form {
    background: #fff;
    border-top: 1px solid #e9ecef;
    padding: 0;
    flex-shrink: 0;
    max-height: 360px;
    overflow-y: auto;
}

.booking-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(135deg, #2EC4B6, #45d9cc);
    color: white;
    position: sticky;
    top: 0;
    z-index: 1;
}

.booking-form-header h6 {
    margin: 0;
    font-weight: 600;
    font-size: 14px;
}

.close-booking-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px 10px;
    font-size: 18px;
    line-height: 1;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-booking-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.booking-form-body {
    padding: 15px;
}

/* Booking Steps */
.booking-step {
    animation: fadeInBooking 0.3s ease;
}

@keyframes fadeInBooking {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.booking-label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #333;
    margin-bottom: 10px;
}

/* Date Navigation */
.booking-date-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.booking-month-year {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.booking-nav-btn {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #666;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.booking-nav-btn:hover {
    background: #2EC4B6;
    border-color: #2EC4B6;
    color: white;
}

/* Date Selector */
.booking-date-selector {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 5px 0;
    scrollbar-width: none;
}

.booking-date-selector::-webkit-scrollbar {
    display: none;
}

.booking-date-card {
    flex: 0 0 auto;
    min-width: 55px;
    padding: 10px 6px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.booking-date-card:hover:not(.past):not(.unavailable) {
    border-color: #2EC4B6;
    transform: translateY(-2px);
}

.booking-date-card.selected {
    background: #2EC4B6;
    border-color: #2EC4B6;
    color: white;
}

.booking-date-card.unavailable,
.booking-date-card.past {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f8f9fa;
}

.booking-date-day {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 2px;
    color: #6c757d;
}

.booking-date-card.selected .booking-date-day {
    color: rgba(255, 255, 255, 0.9);
}

.booking-date-num {
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}

/* Time Slots */
.booking-time-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.booking-time-btn {
    padding: 10px 8px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    color: #495057;
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.booking-time-btn:hover {
    border-color: #2EC4B6;
    background: #e3fcf7;
    color: #2EC4B6;
}

.booking-time-btn.selected {
    background: #2EC4B6;
    border-color: #2EC4B6;
    color: white;
}

.booking-no-times {
    text-align: center;
    padding: 20px;
    color: #999;
}

.booking-no-times i {
    font-size: 32px;
    margin-bottom: 10px;
    display: block;
}

.booking-no-times p {
    margin: 0;
    font-size: 13px;
}

.booking-back-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    padding: 5px 0;
    display: flex;
    align-items: center;
}

.booking-back-btn:hover {
    color: #2EC4B6;
}

/* Booking Summary */
.booking-summary {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
}

.booking-summary-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 13px;
    color: #333;
}

.booking-summary-item i {
    color: #2EC4B6;
    width: 18px;
    text-align: center;
}

.booking-summary-item:not(:last-child) {
    border-bottom: 1px solid #e9ecef;
}

.booking-notes {
    width: 100%;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    font-size: 13px;
    padding: 10px;
    margin-bottom: 12px;
    resize: none;
    font-family: inherit;
}

.booking-notes:focus {
    border-color: #2EC4B6;
    outline: none;
}

.booking-actions {
    display: flex;
    gap: 10px;
}

.booking-change-btn {
    flex: 0 0 auto;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #666;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.booking-change-btn:hover {
    background: #e9ecef;
}

.btn-submit-booking {
    flex: 1;
    background: linear-gradient(135deg, #2EC4B6, #45d9cc);
    border: none;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-submit-booking:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 196, 182, 0.3);
}

.btn-submit-booking:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Booking Loading */
.booking-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.booking-loading .spinner-border {
    color: #2EC4B6;
}

/* Booking Success */
.booking-success {
    text-align: center;
    padding: 20px 10px;
}

.booking-success-icon {
    font-size: 48px;
    color: #2EC4B6;
    margin-bottom: 15px;
}

.booking-success h5 {
    margin-bottom: 8px;
    color: #333;
}

.booking-success p {
    color: #666;
    font-size: 13px;
    margin-bottom: 15px;
}

.booking-success-details {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 15px;
}

.booking-success-details > div {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 13px;
    color: #333;
}

.booking-success-details i {
    color: #2EC4B6;
}

.booking-close-success-btn {
    background: linear-gradient(135deg, #2EC4B6, #45d9cc);
    border: none;
    color: white;
    padding: 10px 25px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.booking-close-success-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 196, 182, 0.3);
}

/* Responsive */
@media (max-width: 480px) {
    .embedded-chat-panel {
        right: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 15px 15px 0 0;
    }
    
    .embedded-chat-panel.open {
        height: 70vh;
    }

    .embedded-chat-panel.keyboard-visible {
        height: auto;
        max-height: 100vh;
    }

    .chat-floating-btn {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }
}

@media (max-width: 768px) {
    .embedded-chat-panel {
        right: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 15px 15px 0 0;
    }

    .embedded-chat-panel.open {
        height: 75vh;
    }

    .embedded-chat-panel.keyboard-visible {
        height: auto;
        max-height: 100vh;
    }

    .chat-floating-btn {
        bottom: 20px;
        right: 20px;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    /* Can add dark mode styles here if needed */
}
