/**
 * MAIN CSS - Batdongsan Theme
 * Based on Rehomes WordPress Theme
 *
 * Structure:
 * 1. CSS Variables
 * 2. Reset & Base
 * 3. Typography
 * 4. Layout & Grid
 * 5. Utilities
 * 6. Lazy Load
 */

/* ==========================================================================
   LAZY LOAD - Global Styles
   ========================================================================== */
/* Images before load */
img.lazy,
video.lazy,
iframe.lazy {
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

/* Images after load */
img.lazy.loaded,
img.lazy[data-ll-status="loaded"],
video.lazy.loaded,
video.lazy[data-ll-status="loaded"],
iframe.lazy.loaded,
iframe.lazy[data-ll-status="loaded"] {
    opacity: 1;
}

/* Background images lazy load */
.lazy[data-bg] {
    background-color: #f0f0f0;
    transition: background-image 0.4s ease-in-out;
}

/* Shimmer loading placeholder */
img.lazy:not(.loaded):not([data-ll-status="loaded"]) {
    background: linear-gradient(110deg, #f0f0f0 8%, #fafafa 18%, #f0f0f0 33%);
    background-size: 200% 100%;
    animation: lazyShimmer 1.5s infinite linear;
}

@keyframes lazyShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==========================================================================
   1. CSS VARIABLES
   ========================================================================== */
:root {
    /* Colors - Real Estate Theme */
    --color-primary: #173e62;
    --color-secondary: #f5821f;
    --color-accent: #2d5a7b;
    --color-dark: #1a1a2e;
    --color-light: #f8f9fa;
    --color-white: #ffffff;
    --color-black: #000000;

    /* Text Colors */
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-muted: #888888;
    --text-light: #ffffff;

    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f7fa;
    --bg-dark: #173e62;
    --bg-darker: #0f2940;

    /* Border Colors */
    --border-color: #e0e0e0;
    --border-light: #f0f0f0;

    /* Typography - Modern Sans-serif (Vietnamese support) */
    --font-heading: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-base: 16px;
    --line-height-base: 1.7;

    /* Font Sizes */
    --fs-xs: 0.75rem;    /* 12px */
    --fs-sm: 0.875rem;   /* 14px */
    --fs-base: 1rem;     /* 16px */
    --fs-lg: 1.125rem;   /* 18px */
    --fs-xl: 1.25rem;    /* 20px */
    --fs-2xl: 1.5rem;    /* 24px */
    --fs-3xl: 1.875rem;  /* 30px */
    --fs-4xl: 2.25rem;   /* 36px */
    --fs-5xl: 3rem;      /* 48px */
    --fs-6xl: 3.75rem;   /* 60px */

    /* Font Weights */
    --fw-light: 300;
    --fw-normal: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --fw-bold: 700;

    /* Spacing */
    --spacing-xs: 0.25rem;   /* 4px */
    --spacing-sm: 0.5rem;    /* 8px */
    --spacing-md: 1rem;      /* 16px */
    --spacing-lg: 1.5rem;    /* 24px */
    --spacing-xl: 2rem;      /* 32px */
    --spacing-2xl: 3rem;     /* 48px */
    --spacing-3xl: 4rem;     /* 64px */
    --spacing-4xl: 6rem;     /* 96px */

    /* Section Spacing */
    --section-padding: 80px;
    --section-padding-sm: 60px;

    /* Container */
    --container-max: 1290px;
    --container-padding: 15px;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Z-index */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-tooltip: 600;
}

/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    font-size: var(--fs-base);
    font-weight: var(--fw-normal);
    line-height: var(--line-height-base);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Remove default margins */
h1, h2, h3, h4, h5, h6,
p, ul, ol, figure, blockquote {
    margin: 0;
}

/* Lists */
ul, ol {
    padding: 0;
    list-style: none;
}

/* Links */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-secondary);
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Form elements */
button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

/* ==========================================================================
   3. TYPOGRAPHY
   ========================================================================== */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-heading);
    font-weight: var(--fw-semibold);
    line-height: 1.25;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    letter-spacing: -0.02em;
}

h1, .h1 { font-size: var(--fs-5xl); font-weight: var(--fw-bold); }
h2, .h2 { font-size: var(--fs-4xl); }
h3, .h3 { font-size: var(--fs-3xl); }
h4, .h4 { font-size: var(--fs-2xl); }
h5, .h5 { font-size: var(--fs-xl); }
h6, .h6 { font-size: var(--fs-lg); }

p {
    margin-bottom: var(--spacing-md);
}

p:last-child {
    margin-bottom: 0;
}

.typo-heading {
    font-family: var(--font-heading);
}

.lead {
    font-size: var(--fs-lg);
    font-weight: var(--fw-light);
}

/* ==========================================================================
   4. LAYOUT & GRID
   ========================================================================== */

/* Wrapper */
.opal-wrapper {
    overflow-x: hidden;
}

/* Site Structure */
.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-content-contain {
    flex: 1;
}

.site-content {
    padding-top: var(--spacing-2xl);
    padding-bottom: var(--spacing-2xl);
}

/* Container */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--container-padding);
    padding-right: var(--container-padding);
}

.container-fluid {
    width: 100%;
    padding-left: var(--container-padding);
    padding-right: var(--container-padding);
}

/* Wrap */
.wrap {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

/* Content Area */
.content-area {
    width: 100%;
}

.site-main {
    margin-bottom: var(--spacing-2xl);
}

/* Section */
.section {
    padding: var(--section-padding) 0;
}

.section-sm {
    padding: var(--section-padding-sm) 0;
}

/* ==========================================================================
   5. UTILITIES
   ========================================================================== */

/* Display */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.d-grid { display: grid !important; }

/* Flexbox */
.flex-row { flex-direction: row !important; }
.flex-column { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-nowrap { flex-wrap: nowrap !important; }
.justify-content-start { justify-content: flex-start !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-around { justify-content: space-around !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-end { align-items: flex-end !important; }
.align-items-center { align-items: center !important; }
.align-items-stretch { align-items: stretch !important; }
.align-self-start { align-self: flex-start !important; }
.align-self-end { align-self: flex-end !important; }
.align-self-center { align-self: center !important; }

/* Gap */
.gap-1 { gap: var(--spacing-xs) !important; }
.gap-2 { gap: var(--spacing-sm) !important; }
.gap-3 { gap: var(--spacing-md) !important; }
.gap-4 { gap: var(--spacing-lg) !important; }
.gap-5 { gap: var(--spacing-xl) !important; }

/* Text Alignment */
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

/* Text Transform */
.text-uppercase { text-transform: uppercase !important; }
.text-lowercase { text-transform: lowercase !important; }
.text-capitalize { text-transform: capitalize !important; }

/* Font Weight */
.fw-light { font-weight: var(--fw-light) !important; }
.fw-normal { font-weight: var(--fw-normal) !important; }
.fw-medium { font-weight: var(--fw-medium) !important; }
.fw-semibold { font-weight: var(--fw-semibold) !important; }
.fw-bold { font-weight: var(--fw-bold) !important; }

/* Text Colors */
.text-primary { color: var(--color-primary) !important; }
.text-secondary { color: var(--color-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-white { color: var(--color-white) !important; }
.text-dark { color: var(--text-primary) !important; }

/* Background Colors */
.bg-primary { background-color: var(--color-primary) !important; }
.bg-secondary { background-color: var(--color-secondary) !important; }
.bg-light { background-color: var(--bg-secondary) !important; }
.bg-dark { background-color: var(--bg-dark) !important; }
.bg-white { background-color: var(--color-white) !important; }

/* Width */
.w-100 { width: 100% !important; }
.w-auto { width: auto !important; }

/* Height */
.h-100 { height: 100% !important; }
.h-auto { height: auto !important; }

/* Margin */
.m-0 { margin: 0 !important; }
.m-auto { margin: auto !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }
.my-0 { margin-top: 0 !important; margin-bottom: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--spacing-xs) !important; }
.mb-2 { margin-bottom: var(--spacing-sm) !important; }
.mb-3 { margin-bottom: var(--spacing-md) !important; }
.mb-4 { margin-bottom: var(--spacing-lg) !important; }
.mb-5 { margin-bottom: var(--spacing-xl) !important; }

/* Padding */
.p-0 { padding: 0 !important; }
.p-1 { padding: var(--spacing-xs) !important; }
.p-2 { padding: var(--spacing-sm) !important; }
.p-3 { padding: var(--spacing-md) !important; }
.p-4 { padding: var(--spacing-lg) !important; }
.p-5 { padding: var(--spacing-xl) !important; }
.py-3 { padding-top: var(--spacing-md) !important; padding-bottom: var(--spacing-md) !important; }
.py-4 { padding-top: var(--spacing-lg) !important; padding-bottom: var(--spacing-lg) !important; }
.py-5 { padding-top: var(--spacing-xl) !important; padding-bottom: var(--spacing-xl) !important; }
.px-3 { padding-left: var(--spacing-md) !important; padding-right: var(--spacing-md) !important; }
.px-4 { padding-left: var(--spacing-lg) !important; padding-right: var(--spacing-lg) !important; }

/* Position */
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.position-fixed { position: fixed !important; }
.position-sticky { position: sticky !important; }

/* Overflow */
.overflow-hidden { overflow: hidden !important; }
.overflow-auto { overflow: auto !important; }

/* Visibility */
.visible { visibility: visible !important; }
.invisible { visibility: hidden !important; }

/* Screen Reader Only */
.sr-only,
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Clearfix */
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* List Inline */
.list-inline {
    padding-left: 0;
    list-style: none;
}

.list-inline-item {
    display: inline-block;
}

.list-inline-item:not(:last-child) {
    margin-right: var(--spacing-sm);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--color-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* ==========================================================================
   6. RESPONSIVE
   ========================================================================== */
@media (max-width: 1199.98px) {
    :root {
        --section-padding: 60px;
    }

    h1, .h1 { font-size: var(--fs-4xl); }
    h2, .h2 { font-size: var(--fs-3xl); }
}

@media (max-width: 991.98px) {
    :root {
        --section-padding: 50px;
    }

    h1, .h1 { font-size: var(--fs-3xl); }
    h2, .h2 { font-size: var(--fs-2xl); }
    h3, .h3 { font-size: var(--fs-xl); }
}

@media (max-width: 767.98px) {
    :root {
        --section-padding: 40px;
        --container-padding: 15px;
    }

    h1, .h1 { font-size: var(--fs-2xl); }
    h2, .h2 { font-size: var(--fs-xl); }
    h3, .h3 { font-size: var(--fs-lg); }
}

/* Responsive Display */
@media (min-width: 576px) {
    .d-sm-none { display: none !important; }
    .d-sm-block { display: block !important; }
    .d-sm-flex { display: flex !important; }
}

@media (min-width: 768px) {
    .d-md-none { display: none !important; }
    .d-md-block { display: block !important; }
    .d-md-flex { display: flex !important; }
}

@media (min-width: 992px) {
    .d-lg-none { display: none !important; }
    .d-lg-block { display: block !important; }
    .d-lg-flex { display: flex !important; }
}

@media (min-width: 1200px) {
    .d-xl-none { display: none !important; }
    .d-xl-block { display: block !important; }
    .d-xl-flex { display: flex !important; }
}
