/* NeighborhoodAI Widget */
.nai-widget {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.nai-header {
    text-align: center;
    padding: 1.25rem 1.5rem 0.75rem;
}
.nai-header h3 {
    color: var(--brand-primary, #1a3d0a);
    margin: 0 0 0.25rem;
    font-size: 1.3rem;
}
.nai-header p {
    color: #666;
    margin: 0;
    font-size: 0.9rem;
}
.nai-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.nai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 420px;
    min-height: 280px;
}
.nai-msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}
.nai-msg.user {
    align-self: flex-end;
    background: var(--brand-primary, #1a3d0a);
    color: white;
    border-bottom-right-radius: 4px;
}
.nai-msg.assistant {
    align-self: flex-start;
    background: #f3f4f6;
    color: #333;
    border-bottom-left-radius: 4px;
    white-space: pre-wrap;
}
.nai-msg.system {
    align-self: center;
    background: #fff3cd;
    color: #856404;
    font-size: 0.8rem;
    text-align: center;
    border-radius: 8px;
    padding: 8px 14px;
}
.nai-typing {
    font-style: italic;
    color: #999;
}
.nai-input-row {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
}
.nai-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
}
.nai-input:focus {
    border-color: var(--brand-primary, #1a3d0a);
}
.nai-send-btn {
    padding: 10px 20px;
    background: var(--brand-primary, #1a3d0a);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}
.nai-send-btn:hover { background: var(--brand-primary-light, #2d5016); }
.nai-send-btn:disabled { background: #ccc; cursor: not-allowed; }
.nai-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 14px 10px;
    font-size: 0.75rem;
}
.nai-usage { color: #888; }
.nai-clear-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.75rem;
}
.nai-clear-btn:hover { color: #666; }

.nai-end-spinner {
    display: inline-block;
    margin-left: 6px;
    font-size: 1rem;
    animation: nai-spin 1s linear infinite;
}
@keyframes nai-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Login prompt */
.nf-login-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    flex: 1;
}
.nf-login-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}
.nf-login-prompt p {
    color: #555;
    font-size: 1.05rem;
    line-height: 1.5;
    margin: 0;
    font-weight: 500;
}
.nf-login-btn {
    margin-top: 1rem;
    padding: 10px 20px;
    background: #2d5016;
    color: white;
    border: 2px solid #2d5016;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}
.nf-login-btn:hover {
    background: #0f2505;
    border-color: #0f2505;
}

/* Phase Two: AI-recommended listing cards */
.nai-listings {
    margin: 0.5rem 0;
    padding: 0.5rem;
}
.nai-listings-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1a3d0a;
    margin-bottom: 0.5rem;
}
.nai-listing-card {
    display: flex;
    gap: 0.5rem;
    background: #f8faf6;
    border: 1px solid #e0e8d8;
    border-radius: 8px;
    padding: 0.5rem;
    margin-bottom: 0.4rem;
    align-items: flex-start;
    position: relative;
}
.nai-listing-fav-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(255,255,255,0.85);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: transform 0.15s ease;
    padding: 0;
    line-height: 1;
}
.nai-listing-fav-btn:hover {
    transform: scale(1.2);
    background: rgba(255,255,255,1);
}
.nai-listing-fav-btn.favorited {
    background: rgba(255,255,255,0.95);
}
.nai-listing-img {
    width: 70px;
    height: 55px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}
.nai-listing-info {
    flex: 1;
    min-width: 0;
}
.nai-listing-addr {
    font-weight: 600;
    font-size: 0.8rem;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nai-listing-city {
    font-size: 0.72rem;
    color: #666;
}
.nai-listing-price {
    font-weight: 700;
    font-size: 0.85rem;
    color: #1a3d0a;
    margin: 0.15rem 0;
}
.nai-listing-details {
    font-size: 0.7rem;
    color: #555;
}
.nai-listing-mls {
    font-size: 0.65rem;
    color: #999;
}
