/* SunHomeKey AI Chatbot - Frontend Styles */

#sunhomekey-ai-chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Ikona czatu */
.sunhomekey-ai-chat-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    color: white;
}

.sunhomekey-ai-chat-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.sunhomekey-ai-chat-icon svg {
    width: 28px;
    height: 28px;
}

/* Okno czatu */
.sunhomekey-ai-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Nagłówek */
.sunhomekey-ai-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sunhomekey-ai-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.sunhomekey-ai-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.sunhomekey-ai-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Wiadomości */
.sunhomekey-ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sunhomekey-ai-message {
    display: flex;
    margin-bottom: 12px;
    animation: fadeIn 0.3s ease;
}

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

.sunhomekey-ai-message-user {
    justify-content: flex-end;
}

.sunhomekey-ai-message-bot {
    justify-content: flex-start;
}

.sunhomekey-ai-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
}

.sunhomekey-ai-message-user .sunhomekey-ai-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.sunhomekey-ai-message-bot .sunhomekey-ai-message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sunhomekey-ai-message-content a {
    color: #667eea;
    text-decoration: underline;
}

.sunhomekey-ai-message-content a:hover {
    color: #764ba2;
}

/* Animacja "Myślę..." */
.sunhomekey-ai-thinking {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.sunhomekey-ai-thinking-text {
    color: #667eea;
    font-size: 14px;
    font-style: italic;
}

.sunhomekey-ai-thinking-dot {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: thinkingDot 1.4s infinite;
}

.sunhomekey-ai-thinking-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.sunhomekey-ai-thinking-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes thinkingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Pole wprowadzania */
.sunhomekey-ai-chat-input-container {
    display: flex;
    padding: 16px;
    background: white;
    border-top: 1px solid #e9ecef;
    gap: 8px;
}

.sunhomekey-ai-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.sunhomekey-ai-chat-input:focus {
    border-color: #667eea;
}

.sunhomekey-ai-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.sunhomekey-ai-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.sunhomekey-ai-send-btn:active {
    transform: scale(0.95);
}

.sunhomekey-ai-send-btn svg {
    width: 20px;
    height: 20px;
}

/* Responsywność */
@media (max-width: 480px) {
    #sunhomekey-ai-chatbot-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .sunhomekey-ai-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 80px);
        bottom: 70px;
    }
    
    .sunhomekey-ai-chat-icon {
        width: 50px;
        height: 50px;
    }
}

/* Scrollbar styling */
.sunhomekey-ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.sunhomekey-ai-chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.sunhomekey-ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Intro shortcode box */
.sunhomekey-ai-intro-box {
    position: relative;
    margin: 30px 0;
    padding: 28px 28px 24px;
    border-radius: 18px;
    background: radial-gradient(circle at top left, rgba(102, 126, 234, 0.25), transparent 55%),
                radial-gradient(circle at bottom right, rgba(118, 75, 162, 0.25), transparent 55%),
                #ffffff;
    box-shadow: 0 14px 45px rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(102, 126, 234, 0.25);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
}

.sunhomekey-ai-intro-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(102, 126, 234, 0.4);
    color: #444;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.sunhomekey-ai-intro-title {
    margin: 0 0 8px;
    font-size: 24px;
    line-height: 1.3;
    color: #1b1f3b;
}

.sunhomekey-ai-intro-subtitle {
    margin: 0 0 18px;
    font-size: 14px;
    line-height: 1.6;
    color: #3f4a5a;
}

.sunhomekey-ai-intro-input-wrapper {
    margin-bottom: 18px;
}

.sunhomekey-ai-intro-input-label {
    font-size: 13px;
    font-weight: 600;
    color: #58627a;
    margin-bottom: 8px;
}

.sunhomekey-ai-intro-input-container {
    display: flex;
    gap: 12px;
    align-items: stretch;
    flex-wrap: wrap;
}

.sunhomekey-ai-intro-input-field {
    flex: 1 1 300px;
    min-height: 52px;
    border-radius: 12px;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(102, 126, 234, 0.4);
    font-size: 15px;
    color: #222b45;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7), 0 4px 15px rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
    outline: none;
    font-family: inherit;
}

.sunhomekey-ai-intro-input-field:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15), 0 4px 20px rgba(102, 126, 234, 0.3);
}

.sunhomekey-ai-intro-input-field::placeholder {
    color: #8a94a6;
    opacity: 1;
}

.sunhomekey-ai-intro-ask-btn {
    flex: 0 0 auto;
    min-width: 120px;
    min-height: 52px;
    border-radius: 12px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    font-family: inherit;
}

.sunhomekey-ai-intro-ask-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.sunhomekey-ai-intro-ask-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4);
}

.sunhomekey-ai-intro-list {
    list-style: none;
    padding-left: 0;
    margin: 10px 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 6px 16px;
    font-size: 13px;
    color: #2f3b52;
}

.sunhomekey-ai-intro-list li {
    position: relative;
    padding-left: 16px;
}

.sunhomekey-ai-intro-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    top: 0;
    color: #667eea;
}

/* Kafelki nieruchomości w oknie chatu */
.sunhomekey-ai-properties {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

/* Kontener dla kart nieruchomości */
.sunhomekey-ai-properties-container {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

/* Karta nieruchomości */
.sunhomekey-ai-property-card {
    display: block;
    border-radius: 12px;
    background: #ffffff;
    text-decoration: none;
    color: inherit;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    overflow: hidden;
}

.sunhomekey-ai-property-card:hover {
    transform: translateY(-2px);
    border-color: #667eea;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.25);
    text-decoration: none;
    color: inherit;
}

/* Obrazek nieruchomości */
.sunhomekey-ai-property-image {
    width: 100%;
    height: 180px;
    background-size: cover;
    background-position: center;
    background-color: #f3f4f6;
    position: relative;
    overflow: hidden;
}

.sunhomekey-ai-property-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #9ca3af;
}

.sunhomekey-ai-property-placeholder svg {
    width: 48px;
    height: 48px;
}

/* Zawartość karty */
.sunhomekey-ai-property-content {
    padding: 14px;
}

.sunhomekey-ai-property-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 10px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Szczegóły nieruchomości */
.sunhomekey-ai-property-details {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #6b7280;
}

.sunhomekey-ai-property-details span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sunhomekey-ai-property-details svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: #9ca3af;
}

.sunhomekey-ai-property-address,
.sunhomekey-ai-property-bedrooms,
.sunhomekey-ai-property-bathrooms {
    white-space: nowrap;
}

/* Cena */
.sunhomekey-ai-property-price {
    font-size: 18px;
    font-weight: 700;
    color: #667eea;
    margin-top: 8px;
}

/* Responsywność kart */
@media (max-width: 768px) {
    .sunhomekey-ai-properties-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .sunhomekey-ai-property-image {
        height: 160px;
    }
    
    .sunhomekey-ai-property-content {
        padding: 12px;
    }
    
    .sunhomekey-ai-property-title {
        font-size: 14px;
    }
    
    .sunhomekey-ai-property-price {
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .sunhomekey-ai-intro-box {
        padding: 20px 16px 16px;
        margin: 16px -8px 24px;
        border-radius: 16px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
    }

    .sunhomekey-ai-intro-title {
        font-size: 18px;
        line-height: 1.35;
        margin-bottom: 6px;
        text-align: left;
        letter-spacing: 0.01em;
    }

    .sunhomekey-ai-intro-subtitle {
        font-size: 13px;
        line-height: 1.55;
        margin-bottom: 14px;
    }

    .sunhomekey-ai-intro-input-container {
        flex-direction: column;
        gap: 10px;
    }

    .sunhomekey-ai-intro-input-field {
        min-height: 46px;
        padding: 12px 14px;
        font-size: 14px;
    }
    
    .sunhomekey-ai-intro-ask-btn {
        width: 100%;
        min-height: 46px;
        padding: 12px 18px;
        font-size: 14px;
    }

    .sunhomekey-ai-intro-list {
        margin-top: 14px;
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 6px;
        -webkit-overflow-scrolling: touch;
    }

    .sunhomekey-ai-intro-list li {
        padding-left: 0;
        padding: 6px 10px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.9);
        border: 1px solid rgba(102, 126, 234, 0.25);
        white-space: nowrap;
        font-size: 12px;
    }

    .sunhomekey-ai-intro-list li::before {
        display: none;
    }
}
