/**
 * MOREX Real Estate Platform - Main Stylesheet
 * Imports design system and defines all components
 */

/* Import Design System */
@import url('design-system.css');

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Playfair+Display:wght@400;500;600;700;800&display=swap');

/* ============================================
   BUTTON COMPONENTS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    line-height: var(--leading-none);
    text-align: center;
    border-radius: var(--radius-lg);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    user-select: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button Variants */
.btn-primary {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -4px rgba(27, 58, 95, 0.3);
}

.btn-secondary {
    background: var(--accent);
    color: var(--white);
    border-color: var(--accent);
}

.btn-secondary:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -4px rgba(232, 119, 34, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-ghost {
    background: transparent;
    color: var(--text-primary);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--gray-100);
}

.btn-white {
    background: var(--white);
    color: var(--primary);
    border-color: var(--white);
}

.btn-white:hover {
    background: var(--gray-50);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Button Sizes */
.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-lg);
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-full);
}

.btn-icon-sm {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-full);
}

.btn-block {
    width: 100%;
}

/* ============================================
   FORM COMPONENTS
   ============================================ */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.form-label.required::after {
    content: ' *';
    color: var(--error);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    font-family: var(--font-primary);
    color: var(--text-primary);
    background: var(--white);
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27, 58, 95, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--gray-400);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-error {
    border-color: var(--error);
}

.form-error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-help {
    display: block;
    font-size: var(--text-sm);
    color: var(--text-light);
    margin-top: var(--space-1);
}

.form-error-message {
    display: block;
    font-size: var(--text-sm);
    color: var(--error);
    margin-top: var(--space-1);
}

/* Checkbox & Radio */
.form-checkbox,
.form-radio {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* ============================================
   CARD COMPONENTS
   ============================================ */
.card {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--gray-200);
}

.card-body {
    padding: var(--space-6);
}

.card-footer {
    padding: var(--space-6);
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* ============================================
   PROPERTY CARD COMPONENT
   ============================================ */
.property-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
}

@media (min-width: 640px) {
    .property-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .property-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.prop-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    display: block;
}

.prop-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.prop-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--gray-200);
}

.prop-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slower);
}

.prop-card:hover .prop-card-image img {
    transform: scale(1.05);
}

/* Loading skeleton for property card image */
.prop-card-image.loading {
    background: linear-gradient(90deg,
            var(--gray-200) 0%,
            var(--gray-300) 50%,
            var(--gray-200) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

.prop-card-badge {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    padding: var(--space-1) var(--space-3);
    background: rgba(27, 58, 95, 0.9);
    backdrop-filter: blur(10px);
    color: var(--white);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-full);
}

.prop-card-badge.featured {
    background: rgba(232, 119, 34, 0.9);
}

.prop-card-content {
    padding: var(--space-5);
}

.prop-card-price {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--primary);
    margin-bottom: var(--space-2);
}

.prop-card-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    line-height: var(--leading-snug);
    margin-bottom: var(--space-3);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.prop-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.prop-card-meta span {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.prop-card-meta ion-icon {
    font-size: 18px;
    color: var(--text-light);
}

/* ============================================
   HEADER - DYNAMIC ISLAND STYLE
   ============================================ */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-fixed);
    padding: var(--space-4) 0;
    transition: all var(--transition-slow);
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);
}

.site-header.scrolled {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-sm);
    padding: var(--space-2) 0;
}

.dynamic-island {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--space-4);
    gap: var(--space-6);
}

@media (min-width: 768px) {
    .dynamic-island {
        padding: 0 var(--space-6);
    }
}

@media (min-width: 1024px) {
    .dynamic-island {
        padding: 0 var(--space-8);
    }
}

/* Logo */
.island-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    z-index: var(--z-fixed);
    transition: all var(--transition-base);
}

.island-logo img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    transition: transform var(--transition-base);
}

.site-header.scrolled .island-logo img {
    width: 40px;
    height: 40px;
}

.island-logo span {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--white);
    transition: color var(--transition-base);
}

.site-header.scrolled .island-logo span {
    color: var(--primary);
}

.island-logo:hover img {
    transform: scale(1.05);
}

/* Navigation */
.island-nav {
    display: none;
}

@media (min-width: 1024px) {
    .island-nav {
        display: flex;
        align-items: center;
        gap: var(--space-6);
        flex: 1;
        justify-content: center;
    }
}

.island-nav a {
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    color: var(--white);
    padding: var(--space-2) var(--space-1);
    position: relative;
    transition: color var(--transition-base);
}

.site-header.scrolled .island-nav a {
    color: var(--text-primary);
}

.island-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width var(--transition-base);
}

.island-nav a:hover::after,
.island-nav a.active::after {
    width: 100%;
}

.island-nav a:hover {
    color: var(--accent);
}

/* CTA Button in Header */
.island-cta {
    padding: var(--space-2) var(--space-5);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: var(--white);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all var(--transition-base);
}

.island-cta:hover {
    background: var(--white);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.site-header.scrolled .island-cta {
    background: var(--accent);
    color: var(--white);
    border-color: var(--accent);
}

.site-header.scrolled .island-cta:hover {
    background: var(--accent-dark);
}

/* Mobile Hamburger */
.island-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    color: var(--white);
    transition: all var(--transition-base);
}

.island-hamburger:hover {
    background: rgba(255, 255, 255, 0.2);
}

.site-header.scrolled .island-hamburger {
    background: var(--gray-100);
    color: var(--primary);
}

.site-header.scrolled .island-hamburger:hover {
    background: var(--gray-200);
}

.island-hamburger ion-icon {
    font-size: 24px;
}

@media (min-width: 1024px) {
    .island-hamburger {
        display: none;
    }
}

/* ============================================
   MOBILE MENU OVERLAY
   ============================================ */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: var(--white);
    z-index: calc(var(--z-fixed) + 10);
    display: flex;
    flex-direction: column;
    padding: var(--space-6);
    transform: translateX(100%);
    transition: transform var(--transition-slow) cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-overlay.active {
    transform: translateX(0);
}

.mobile-menu-close {
    align-self: flex-end;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border-radius: var(--radius-full);
    color: var(--primary);
    margin-bottom: var(--space-8);
}

.mobile-menu-close ion-icon {
    font-size: 24px;
}

.mobile-menu-overlay nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.mobile-menu-overlay nav a {
    font-size: var(--text-xl);
    font-weight: var(--font-medium);
    color: var(--text-primary);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.mobile-menu-overlay nav a:hover {
    background: var(--gray-100);
    color: var(--accent);
}

@media (min-width: 1024px) {
    .mobile-menu-overlay {
        display: none;
    }
}

/* ============================================
   SECTION LAYOUTS
   ============================================ */
.section {
    padding: var(--space-16) 0;
}

.section-sm {
    padding: var(--space-12) 0;
}

.section-lg {
    padding: var(--space-24) 0;
}

@media (min-width: 768px) {
    .section {
        padding: var(--space-20) 0;
    }

    .section-sm {
        padding: var(--space-16) 0;
    }

    .section-lg {
        padding: var(--space-32) 0;
    }
}

/* Section Headers */
.section-header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto var(--space-12);
}

.section-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: rgba(232, 119, 34, 0.1);
    color: var(--accent);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-full);
    margin-bottom: var(--space-4);
}

.section-title {
    font-size: var(--text-4xl);
    margin-bottom: var(--space-3);
}

.section-subtitle {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-weight: var(--font-normal);
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    background: var(--gray-900);
    color: var(--gray-400);
    padding: var(--space-16) 0 var(--space-8);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-10);
    margin-bottom: var(--space-12);
}

@media (min-width: 640px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .footer-grid {
        grid-template-columns: 2fr 1fr 1fr 1fr;
    }
}

.footer-brand {
    max-width: 350px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.footer-logo img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.footer-logo span {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--white);
}

.footer-brand p {
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-6);
}

.footer-social {
    display: flex;
    gap: var(--space-3);
}

.footer-social a {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-800);
    border-radius: var(--radius-lg);
    color: var(--gray-400);
    transition: all var(--transition-fast);
}

.footer-social a:hover {
    background: var(--accent);
    color: var(--white);
}

.footer-social ion-icon {
    font-size: 20px;
}

.footer-column h4 {
    font-family: var(--font-primary);
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--white);
    margin-bottom: var(--space-4);
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.footer-links a {
    font-size: var(--text-base);
    color: var(--gray-400);
    transition: all var(--transition-fast);
}

.footer-links a:hover {
    color: var(--white);
    transform: translateX(4px);
}

.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    padding-top: var(--space-8);
    border-top: 1px solid var(--gray-800);
}

.footer-copyright {
    font-size: var(--text-sm);
}

.footer-legal {
    display: flex;
    gap: var(--space-6);
}

.footer-legal a {
    font-size: var(--text-sm);
    color: var(--gray-400);
}

.footer-legal a:hover {
    color: var(--white);
}

/* ============================================
   ALERT/BADGE COMPONENTS
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-full);
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-dark);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-dark);
}

.badge-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-dark);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info-dark);
}

.badge-primary {
    background: rgba(27, 58, 95, 0.1);
    color: var(--primary);
}

/* ============================================
   RESPONSIVE SPACING ADJUSTMENTS
   ============================================ */
@media (max-width: 767px) {
    h1 {
        font-size: var(--text-4xl);
    }

    h2 {
        font-size: var(--text-3xl);
    }

    h3 {
        font-size: var(--text-2xl);
    }

    .section-title {
        font-size: var(--text-3xl);
    }
}

/* ============================================
   MAIN CONTENT WRAPPER
   ============================================ */
main {
    padding-top: var(--header-height);
    min-height: 100vh;
}

/* ============================================
   MOBILE BOTTOM NAVIGATION BAR
   ============================================ */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: var(--space-2) var(--space-3);
    padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: flex-end;
    }

    main {
        padding-bottom: 90px;
        /* Space for bottom nav */
    }
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: var(--space-2);
    color: var(--gray-500);
    font-size: 10px;
    font-weight: var(--font-medium);
    text-decoration: none;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 56px;
}

.bottom-nav-item ion-icon {
    font-size: 22px;
}

.bottom-nav-item span {
    white-space: nowrap;
}

.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-item.active ion-icon {
    transform: scale(1.1);
}

/* Center Search Button - Elevated */
.bottom-nav-search {
    position: relative;
    margin-top: -20px;
}

.search-icon-wrap {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    color: white;
    box-shadow: 0 4px 15px rgba(27, 58, 95, 0.4);
    transition: all 0.3s ease;
}

.bottom-nav-search:hover .search-icon-wrap,
.bottom-nav-search:active .search-icon-wrap {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(27, 58, 95, 0.5);
}

.search-icon-wrap ion-icon {
    font-size: 24px;
}

.bottom-nav-search span {
    margin-top: 8px;
    color: var(--primary);
    font-weight: var(--font-semibold);
}

/* Hide top hamburger on mobile when bottom nav is present */
@media (max-width: 768px) {
    .island-hamburger {
        display: none !important;
    }
}