* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-blue: #1e3a5f;
    --primary-orange: #e67e22;
    --primary-green: #27ae60;
    --light-gray: #f8f9fa;
    --text-dark: #2c3e50;
    --border-gray: #e8ecef;
    --red: #e74c3c;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    height: 100%;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Buttons */
.btn {
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-orange);
    color: white;
}

.btn-primary:hover {
    background: #d35400;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.3);
}

.btn-outline {
    background: transparent;
    color: white;
    border: 1px solid white;
}

.btn-outline:hover {
    background: white;
    color: var(--primary-blue);
}

.btn-outline-dark {
    background: transparent;
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
}

.btn-outline-dark:hover {
    background: var(--primary-blue);
    color: white;
}

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1.125rem;
}

/* Navbar */
.navbar {
    background: var(--primary-blue);
    color: white;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.logo-icon {
    width: 32px;
    height: 32px;
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-btn span {
    width: 24px;
    height: 2px;
    background: white;
    transition: all 0.3s;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--primary-orange);
}

.nav-auth, .nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
}

.user-details {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-role {
    font-size: 0.75rem;
    opacity: 0.8;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Hero Section */
.hero {
    background: var(--light-gray);
    padding: 5rem 0;
    position: relative;
    overflow: hidden;
}

.hero-bg-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.pattern-circle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.6;
}

.pattern-circle-1 {
    width: 80px;
    height: 80px;
    background: rgba(230, 126, 34, 0.1);
    top: 40px;
    left: 40px;
}

.pattern-circle-2 {
    width: 128px;
    height: 128px;
    background: rgba(30, 58, 95, 0.05);
    bottom: 40px;
    right: 40px;
}

.pattern-circle-3 {
    width: 64px;
    height: 64px;
    background: rgba(39, 174, 96, 0.1);
    top: 50%;
    right: 25%;
}

.pattern-square {
    position: absolute;
    border: 2px solid rgba(230, 126, 34, 0.1);
    transform: rotate(45deg);
}

.pattern-square-1 {
    width: 60px;
    height: 60px;
    top: 20%;
    right: 10%;
}

.pattern-square-2 {
    width: 40px;
    height: 40px;
    bottom: 30%;
    left: 15%;
}

.pattern-dots {
    position: absolute;
    width: 100px;
    height: 100px;
    background-image: radial-gradient(circle, rgba(30, 58, 95, 0.1) 2px, transparent 2px);
    background-size: 20px 20px;
}

.pattern-dots-1 {
    top: 10%;
    right: 5%;
}

.pattern-dots-2 {
    bottom: 10%;
    left: 5%;
}

.hero-container {
    text-align: center;
    position: relative;
    z-index: 1;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(230, 126, 34, 0.1);
    color: var(--primary-orange);
    border-radius: 2rem;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.badge svg {
    width: 16px;
    height: 16px;
}

.hero h1 {
    font-size: 2.5rem;
    color: var(--primary-blue);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-description {
    font-size: 1.125rem;
    color: var(--text-dark);
    max-width: 800px;
    margin: 0 auto 2rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 3rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    max-width: 700px;
    margin: 0 auto;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stat-number {
    font-size: 2rem;
    color: var(--primary-orange);
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-dark);
}

/* Features Section */
.features {
    padding: 4rem 0;
    background: white;
    position: relative;
}

.section-divider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--primary-blue), var(--primary-orange), var(--primary-green));
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: 2rem;
    color: var(--primary-blue);
    margin-bottom: 0.75rem;
}

.underline {
    width: 80px;
    height: 4px;
    background: var(--primary-orange);
    margin: 0 auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.feature-card {
    padding: 2rem;
    border: 2px solid var(--border-gray);
    border-radius: 0.5rem;
    transition: all 0.3s;
}

.feature-card:hover {
    border-color: var(--primary-orange);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    transition: transform 0.3s;
}

.feature-card:hover .feature-icon {
    transform: scale(1.1);
}

.feature-icon-orange {
    background: var(--primary-orange);
    color: white;
}

.feature-icon-green {
    background: var(--primary-green);
    color: white;
}

.feature-icon-blue {
    background: var(--primary-blue);
    color: white;
}

.feature-card h3 {
    font-size: 1.25rem;
    color: var(--primary-blue);
    margin-bottom: 0.75rem;
}

.feature-card p {
    color: var(--text-dark);
}

/* Users Section */
.users {
    padding: 4rem 0;
    background: var(--light-gray);
}

.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.user-card {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.user-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
}

.user-card-tenant {
    border-top: 4px solid var(--primary-orange);
}

.user-card-broker {
    border-top: 4px solid var(--primary-blue);
}

.user-card-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.user-card-icon-orange {
    background: var(--primary-orange);
    color: white;
}

.user-card-icon-blue {
    background: var(--primary-blue);
    color: white;
}

.user-card h3 {
    font-size: 1.5rem;
    color: var(--primary-blue);
    margin-bottom: 1rem;
}

.user-card ul {
    list-style: none;
}

.user-card li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.user-card li svg {
    color: var(--primary-green);
    flex-shrink: 0;
    margin-top: 2px;
}

/* Comparison Section */
.comparison {
    padding: 4rem 0;
    background: white;
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.comparison-card {
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 2px solid;
    transition: all 0.3s;
}

.comparison-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.comparison-card-bad {
    background: #fff5f5;
    border-color: var(--red);
}

.comparison-card-good {
    background: #f0fdf4;
    border-color: var(--primary-green);
}

.comparison-card h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.comparison-card-bad h3 {
    color: var(--red);
}

.comparison-card-good h3 {
    color: var(--primary-green);
}

.comparison-card ul {
    list-style: none;
}

.comparison-card li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
}

.comparison-card-bad li span {
    color: var(--red);
    margin-top: 2px;
}

.comparison-card-good li span {
    color: var(--primary-green);
    margin-top: 2px;
}

/* CTA Section */
.cta {
    padding: 4rem 0;
    background: var(--primary-blue);
    color: white;
    position: relative;
    overflow: hidden;
}

.cta-bg-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.cta-circle {
    position: absolute;
    border-radius: 50%;
}

.cta-circle-1 {
    width: 256px;
    height: 256px;
    background: rgba(230, 126, 34, 0.1);
    top: -128px;
    right: -128px;
}

.cta-circle-2 {
    width: 192px;
    height: 192px;
    background: rgba(39, 174, 96, 0.1);
    bottom: -96px;
    left: -96px;
}

.cta-container {
    text-align: center;
    position: relative;
    z-index: 1;
}

.cta h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.cta p {
    font-size: 1.125rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* Footer */
.footer {
    background: #2c3e50;
    color: white;
    padding: 2rem 0;
}

.footer-container {
    text-align: center;
}

.footer-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.footer p {
    font-size: 0.875rem;
    opacity: 0.7;
}

/* Chat FAB */
.chat-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    background: var(--primary-orange);
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 999;
}

.chat-fab:hover {
    background: #d35400;
    transform: scale(1.1);
}

.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    background: var(--primary-green);
    border-radius: 50%;
    border: 2px solid white;
}

/* Chat Pages */
.chat-container {
    display: flex;
    flex-direction: column;
    background: white;
    height: 100vh !important;
    width: 100%;
}

.chat-header {
    background: var(--primary-blue);
    color: white;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-header-title h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.chat-header-title p {
    font-size: 0.875rem;
    opacity: 0.8;
}

.icon-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-user-bar {
    background: white;
    border-bottom: 1px solid var(--border-gray);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #666;
}

.chat-user-bar strong {
    color: var(--primary-blue);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--light-gray);
    min-height: 0;  /* KEY FIX */ 
}

.message {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    margin-bottom: 1rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-user {
    margin-left: auto;
    background: var(--primary-orange);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.message-bot {
    background: white;
    color: var(--text-dark);
    border-bottom-left-radius: 0.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message-typing {
    font-style: italic;
    color: #666;
    background: white;
}

.property-card {
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 0.75rem;
    margin: 0.75rem 0;
    border-left: 4px solid var(--primary-blue);
    max-width: 70%;
}

.property-card h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.125rem;
    color: var(--primary-blue);
}

.property-card p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

.chat-input-form {
    background: white;
    border-top: 1px solid var(--border-gray);
    padding: 1rem;
    display: flex;
    gap: 0.5rem;
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #ccc;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.1);
}

.chat-send-btn {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.3s;
}

.chat-send-btn:hover {
    background: #15304d;
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.broker-actions {
    display: flex;
    gap: 0.5rem;
}

.broker-action-btn {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.broker-action-btn:hover {
    background: #15304d;
}

/* Auth Page */
.auth-container {
    min-height: 100vh;
    background: var(--light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-card {
    width: 100%;
    max-width: 500px;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

.auth-back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-blue);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    transition: color 0.3s;
}

.auth-back-btn:hover {
    color: var(--primary-orange);
}

.auth-header {
    background: var(--primary-blue);
    color: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.auth-header p {
    font-size: 0.875rem;
    opacity: 0.8;
}

.role-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.role-btn {
    padding: 1.5rem 1rem;
    border-radius: 0.5rem;
    border: 2px solid var(--border-gray);
    background: var(--light-gray);
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.role-btn:hover {
    border-color: var(--primary-orange);
}

.role-btn.active-broker {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: white;
}

.role-btn.active-tenant {
    background: var(--primary-orange);
    border-color: var(--primary-orange);
    color: white;
}

.role-btn svg {
    width: 32px;
    height: 32px;
}

.role-btn-label {
    font-weight: 600;
}

.auth-description {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 2px rgba(230, 126, 34, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.auth-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
}

.auth-link {
    font-size: 0.875rem;
    color: var(--text-dark);
}

.auth-link button {
    background: none;
    border: none;
    color: var(--primary-orange);
    cursor: pointer;
    text-decoration: underline;
}

.message-box {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.message-success {
    background: #f0fdf4;
    color: var(--primary-green);
}

.message-error {
    background: #fef3c7;
    color: #92400e;
}

.step {
    display: none;
}

.step.active {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--primary-blue);
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
        display: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-auth, .nav-user {
        width: 100%;
        margin-left: 0;
        padding-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        flex-direction: column;
    }

    .nav-user button {
        width: 100%;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .users-grid {
        grid-template-columns: 1fr;
    }

    .comparison-grid {
        grid-template-columns: 1fr;
    }

    .hero-buttons {
        flex-direction: column;
    }

    .message, .property-card {
        max-width: 85%;
    }

    .broker-actions {
        flex-wrap: wrap;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

.chat-popup {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 9999;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat-popup iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* FIX: Make iframe chat fill entire chat container */
#chatWindow {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 420px;
    height: calc(100vh - 100px) !important; /* 100px = header + input box */
    display: none;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    overflow: hidden;
    z-index: 2000;
}

#chatContent {
    width: 100%;
    height: 100% !important;
}

#chatContent iframe {
    width: 100% !important;
    height: 100% !important;
    border: none;
    display: block;
}

.chat-close-btn {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    font-weight: bold;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-close-btn:hover {
    background: #c0392b;
}

