/* ─── OkeAsk AI Chat Widget ─── */

.okeask-chat-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    height: 52px;
    border-radius: 26px;
    background: #016FC8;
    color: #fff;
    border: none;
    cursor: pointer;
    z-index: 999990;
    box-shadow: 0 4px 20px rgba(1, 111, 200, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 20px 0 16px;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: okeask-pulse 2.5s infinite;
}

.okeask-chat-bubble:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 28px rgba(1, 111, 200, 0.55);
    animation: none;
}

.okeask-chat-bubble svg {
    width: 24px;
    height: 24px;
    fill: #fff;
    flex-shrink: 0;
}

.okeask-chat-bubble__label {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.okeask-chat-bubble__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e31e25;
    display: none;
}

@keyframes okeask-pulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(1, 111, 200, 0.45); }
    50% { box-shadow: 0 4px 30px rgba(1, 111, 200, 0.7), 0 0 0 8px rgba(1, 111, 200, 0.15); }
}

/* Proactive tooltip */
.okeask-chat-tooltip {
    position: fixed;
    bottom: 82px;
    right: 20px;
    max-width: 280px;
    background: #fff;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 999990;
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    cursor: pointer;
    animation: okeask-tooltip-in 0.3s ease-out;
    display: none;
}

.okeask-chat-tooltip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 24px;
    width: 16px;
    height: 16px;
    background: #fff;
    transform: rotate(45deg);
    box-shadow: 4px 4px 8px rgba(0,0,0,0.05);
}

.okeask-chat-tooltip__close {
    position: absolute;
    top: 4px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

@keyframes okeask-tooltip-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Chat Panel ─── */

.okeask-chat-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 440px;
    height: 100%;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
    z-index: 9999999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: okeask-panel-in 0.25s ease-out;
}

.okeask-chat-panel.active {
    display: flex;
}

@keyframes okeask-panel-in {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* ─── Header ─── */

.okeask-chat-header {
    display: flex;
    align-items: center;
    padding: 16px;
    background: #016FC8;
    color: #fff;
    flex-shrink: 0;
    min-height: 56px;
}

.okeask-chat-header__avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
}

.okeask-chat-header__info {
    flex: 1;
    min-width: 0;
}

.okeask-chat-header__name {
    font-weight: 600;
    font-size: 16px;
}

.okeask-chat-header__status {
    font-size: 12px;
    opacity: 0.85;
}

.okeask-chat-header__close {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.8;
    transition: opacity 0.2s;
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.okeask-chat-header__close:hover {
    opacity: 1;
}

/* ─── Messages Area ─── */

.okeask-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

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

.okeask-chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

/* ─── Message Bubbles ─── */

.okeask-msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.okeask-msg--assistant {
    align-self: flex-start;
    background: #f0f2f5;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
}

.okeask-msg--user {
    align-self: flex-end;
    background: #016FC8;
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* ─── Typing Indicator ─── */

.okeask-typing {
    align-self: flex-start;
    display: none;
    gap: 4px;
    padding: 12px 18px;
    background: #f0f2f5;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}

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

.okeask-typing__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: okeask-bounce 1.4s infinite ease-in-out;
}

.okeask-typing__dot:nth-child(1) { animation-delay: 0s; }
.okeask-typing__dot:nth-child(2) { animation-delay: 0.2s; }
.okeask-typing__dot:nth-child(3) { animation-delay: 0.4s; }

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

/* ─── Property Cards ─── */

.okeask-property-card {
    border: 1px solid #e8eaed !important;
    border-radius: 12px !important;
    overflow: visible !important;
    background: #fff !important;
    align-self: stretch !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    max-height: none !important;
}

/* ─── Image Slider ─── */

.okeask-slider {
    position: relative;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
}

.okeask-slider__track {
    display: flex;
    transition: transform 0.3s ease;
}

.okeask-slider__img {
    width: 100% !important;
    min-width: 100% !important;
    height: 220px !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    cursor: pointer;
    flex-shrink: 0;
}

.okeask-slider__btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    border: none;
    font-size: 22px;
    line-height: 36px;
    text-align: center;
    padding: 0;
    cursor: pointer;
    z-index: 2;
    color: #333;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.okeask-slider__btn--prev { left: 8px; }
.okeask-slider__btn--next { right: 8px; }

.okeask-slider__btn:hover {
    background: #fff;
}

.okeask-slider__dots {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 2;
}

.okeask-slider__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    transition: background 0.2s;
}

.okeask-slider__dot.active {
    background: #fff;
}

@media (max-width: 768px) {
    .okeask-slider__img {
        height: 200px !important;
    }
}

.okeask-property-card__body {
    padding: 10px 12px !important;
    cursor: pointer;
    display: block !important;
    visibility: visible !important;
}

.okeask-property-card__price {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #016FC8 !important;
    margin-bottom: 2px !important;
    display: block !important;
}

.okeask-property-card__address {
    font-size: 13px !important;
    color: #555 !important;
    margin-bottom: 4px !important;
    display: block !important;
}

.okeask-property-card__details {
    font-size: 13px !important;
    color: #777 !important;
    margin-bottom: 4px !important;
    display: block !important;
}

.okeask-property-card__czynsz {
    font-size: 12px !important;
    color: #999 !important;
    margin-bottom: 4px !important;
    display: block !important;
}

.okeask-property-card__title {
    font-size: 12px !important;
    color: #888 !important;
    margin-top: 4px !important;
    display: block !important;
    line-height: 1.3 !important;
}

.okeask-property-card__actions {
    display: flex !important;
    gap: 8px !important;
    padding: 8px 12px 12px !important;
    visibility: visible !important;
}

.okeask-property-card__actions a,
.okeask-property-card__actions button {
    flex: 1 !important;
    padding: 10px 10px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    text-align: center !important;
    cursor: pointer !important;
    text-decoration: none !important;
    border: none !important;
    font-family: inherit !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.okeask-property-card__actions a {
    background: #f0f2f5 !important;
    color: #333 !important;
}

.okeask-property-card__actions button {
    background: #016FC8 !important;
    color: #fff !important;
}

/* ─── Phone Input (inline lead capture) ─── */

.okeask-phone-input {
    align-self: stretch;
    background: #f0f7ff;
    border: 1px solid #016FC8;
    border-radius: 12px;
    padding: 14px;
}

.okeask-phone-input__label {
    font-size: 14px;
    color: #333;
    margin-bottom: 10px;
    font-weight: 500;
}

.okeask-phone-input__row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.okeask-phone-input__field {
    flex: 1;
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    min-height: 42px;
    -webkit-appearance: none;
}

.okeask-phone-input__field:focus {
    border-color: #016FC8;
}

.okeask-phone-input__btn {
    background: #016FC8;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    min-height: 42px;
    font-family: inherit;
    flex-shrink: 0;
}

.okeask-phone-input__btn:hover {
    background: #0161b0;
}

/* ─── Confirmation ─── */

.okeask-confirmation {
    align-self: stretch;
    background: #f0faf0;
    border: 1px solid #4caf50;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.okeask-confirmation__icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #4caf50;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.okeask-confirmation__text {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
}

/* ─── Quick Replies ─── */

.okeask-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-self: flex-start;
    max-width: 100%;
}

.okeask-quick-reply {
    padding: 8px 16px;
    border: 1px solid #016FC8;
    border-radius: 20px;
    background: #fff;
    color: #016FC8;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
    min-height: 40px;
}

.okeask-quick-reply:hover,
.okeask-quick-reply:active {
    background: #016FC8;
    color: #fff;
}

.okeask-quick-reply--primary {
    background: #016FC8;
    color: #fff;
    border-color: #016FC8;
    font-weight: 600;
}

.okeask-quick-reply--primary:hover,
.okeask-quick-reply--primary:active {
    background: #0161b0;
}

/* ─── Input Area ─── */

.okeask-chat-input {
    display: flex;
    align-items: flex-end;
    padding: 10px 12px;
    border-top: 1px solid #e8eaed;
    gap: 8px;
    flex-shrink: 0;
}

.okeask-chat-input textarea {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 15px;
    resize: none;
    max-height: 80px;
    min-height: 42px;
    line-height: 1.4;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.okeask-chat-input textarea:focus {
    border-color: #016FC8;
}

.okeask-chat-input__send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #016FC8;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.okeask-chat-input__send:hover {
    background: #0161b0;
}

.okeask-chat-input__send:disabled {
    background: #ccc;
    cursor: default;
}

.okeask-chat-input__send svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

/* ─── Disclaimer ─── */

.okeask-chat-disclaimer {
    text-align: center;
    font-size: 11px;
    color: #aaa;
    padding: 4px 12px 4px;
    flex-shrink: 0;
}

/* ─── Messengers Row ─── */

.okeask-messengers {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 6px 12px;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.okeask-messengers a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: transform 0.15s;
}

.okeask-messengers a:hover {
    transform: scale(1.15);
}

.okeask-messengers a img {
    width: 30px;
    height: 30px;
}

/* ─── Mobile: full screen, proper safe areas ─── */

@media (max-width: 768px) {
    .okeask-chat-panel {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        box-shadow: none;
    }

    /* Safe area for notch/status bar */
    .okeask-chat-header {
        padding-top: max(16px, env(safe-area-inset-top));
    }

    /* Safe area for home indicator */
    .okeask-messengers {
        padding-bottom: max(6px, env(safe-area-inset-bottom));
    }

    .okeask-chat-bubble {
        bottom: 16px;
        right: 16px;
    }

    .okeask-chat-tooltip {
        right: 16px;
        bottom: 80px;
        max-width: 240px;
    }

    .okeask-msg {
        max-width: 92%;
    }

    .okeask-property-card__img {
        height: 160px;
    }
}

/* Hide site elements behind chat when open */
.okeask-chat-panel.active ~ .wrap-favorite,
.okeask-chat-panel.active ~ .custom-widget,
.okeask-chat-panel.active ~ .scroll-to-top,
.okeask-chat-panel.active ~ [class*="scroll"],
.okeask-chat-panel.active ~ [class*="back-to-top"] {
    display: none !important;
}

/* Hide all floating site elements when chat is open */
body.okeask-chat-open #scroll-top,
body.okeask-chat-open .wrap-favorite {
    display: none !important;
}

/* ─── Print: hide chat ─── */

@media print {
    .okeask-chat-bubble,
    .okeask-chat-panel,
    .okeask-chat-tooltip {
        display: none !important;
    }
}
