/* ==========================================================================
   Lonwala.com - Complete Mobile-First Universal Responsive Engine
   Full Breakpoints Support:
   - Extra Small (Mobile Phones): < 576px (Default Mobile-First)
   - Small (Large Phones / Phablets): >= 576px
   - Medium (Tablets / iPads): >= 768px
   - Large (Laptops / Small Desktops): >= 992px
   - Extra Large (Standard Desktops): >= 1200px
   - Extra Extra Large (Large Desktops / 4K): >= 1400px
   ========================================================================== */

/* Universal Reset & Anti-Horizontal Overflow */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
  width: 100% !important;
  margin: 0;
  padding: 0;
  -webkit-text-size-adjust: 100%;
}

img, svg, video, canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ==========================================================================
   1. Standard Responsive Container System
   ========================================================================== */
.container, .container-fluid {
  width: 100%;
  margin-right: auto;
  margin-left: auto;
  padding-right: 16px;
  padding-left: 16px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -12px;
  margin-left: -12px;
}

.row > * {
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  padding-right: 12px;
  padding-left: 12px;
}

/* No gutters utility */
.g-0 {
  margin-right: 0;
  margin-left: 0;
}
.g-0 > * {
  padding-right: 0;
  padding-left: 0;
}

/* Base Mobile-First Column Defaults (< 576px) */
.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-6  { flex: 0 0 50%; max-width: 50%; }
.col-4  { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-3  { flex: 0 0 25%; max-width: 25%; }

/* Mobile Base Order */
.order-1 { order: 1 !important; }
.order-2 { order: 2 !important; }

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

/* ==========================================================================
   2. Breakpoint: Small (sm >= 576px) - Large Phones / Phablets
   ========================================================================== */
@media (min-width: 576px) {
  .container {
    max-width: 540px;
    padding-right: 16px;
    padding-left: 16px;
  }

  .col-sm-12 { flex: 0 0 100% !important; max-width: 100% !important; }
  .col-sm-6  { flex: 0 0 50% !important; max-width: 50% !important; }
  .col-sm-4  { flex: 0 0 33.333333% !important; max-width: 33.333333% !important; }
  .col-sm-3  { flex: 0 0 25% !important; max-width: 25% !important; }

  .d-sm-none  { display: none !important; }
  .d-sm-block { display: block !important; }
  .d-sm-flex  { display: flex !important; }
}

/* ==========================================================================
   3. Breakpoint: Medium (md >= 768px) - Tablets / iPads
   ========================================================================== */
@media (min-width: 768px) {
  .container {
    max-width: 720px;
    padding-right: 20px;
    padding-left: 20px;
  }

  .col-md-12 { flex: 0 0 100% !important; max-width: 100% !important; }
  .col-md-8  { flex: 0 0 66.666667% !important; max-width: 66.666667% !important; }
  .col-md-6  { flex: 0 0 50% !important; max-width: 50% !important; }
  .col-md-4  { flex: 0 0 33.333333% !important; max-width: 33.333333% !important; }
  .col-md-3  { flex: 0 0 25% !important; max-width: 25% !important; }

  .order-md-1 { order: 1 !important; }
  .order-md-2 { order: 2 !important; }

  .d-md-none  { display: none !important; }
  .d-md-block { display: block !important; }
  .d-md-flex  { display: flex !important; }
}

/* ==========================================================================
   4. Breakpoint: Large (lg >= 992px) - Laptops / Small Desktops
   ========================================================================== */
@media (min-width: 992px) {
  .container {
    max-width: 960px;
    padding-right: 24px;
    padding-left: 24px;
  }
  .container-fluid {
    padding-right: 32px;
    padding-left: 32px;
  }

  .col-lg-12 { flex: 0 0 100% !important; max-width: 100% !important; }
  .col-lg-10 { flex: 0 0 83.333333% !important; max-width: 83.333333% !important; }
  .col-lg-8  { flex: 0 0 66.666667% !important; max-width: 66.666667% !important; }
  .col-lg-7  { flex: 0 0 58.333333% !important; max-width: 58.333333% !important; }
  .col-lg-6  { flex: 0 0 50% !important; max-width: 50% !important; }
  .col-lg-5  { flex: 0 0 41.666667% !important; max-width: 41.666667% !important; }
  .col-lg-4  { flex: 0 0 33.333333% !important; max-width: 33.333333% !important; }
  .col-lg-3  { flex: 0 0 25% !important; max-width: 25% !important; }

  .order-lg-1 { order: 1 !important; }
  .order-lg-2 { order: 2 !important; }

  .d-lg-none  { display: none !important; }
  .d-lg-block { display: block !important; }
  .d-lg-flex  { display: flex !important; }
}

/* ==========================================================================
   5. Breakpoint: Extra Large (xl >= 1200px) - Standard Desktop
   ========================================================================== */
@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
  .container-fluid {
    padding-right: 40px;
    padding-left: 40px;
  }

  .col-xl-12 { flex: 0 0 100% !important; max-width: 100% !important; }
  .col-xl-8  { flex: 0 0 66.666667% !important; max-width: 66.666667% !important; }
  .col-xl-6  { flex: 0 0 50% !important; max-width: 50% !important; }
  .col-xl-4  { flex: 0 0 33.333333% !important; max-width: 33.333333% !important; }
  .col-xl-3  { flex: 0 0 25% !important; max-width: 25% !important; }

  .order-xl-1 { order: 1 !important; }
  .order-xl-2 { order: 2 !important; }

  .d-xl-block { display: block !important; }
  .d-xl-none  { display: none !important; }
}

/* ==========================================================================
   6. Breakpoint: XXL (xxl >= 1400px) - Large Displays / 4K
   ========================================================================== */
@media (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }
  .hero-content h1 {
    font-size: 54px;
  }
}

/* ==========================================================================
   7. Specific Component Responsiveness
   ========================================================================== */

/* --- A. HERO SECTION DESKTOP vs MOBILE --- */
/* Desktop (>= 1200px): Text Left (1), Image Right (2) */
@media (min-width: 1200px) {
  .hero-row {
    display: flex !important;
    align-items: center !important;
    flex-direction: row-reverse !important;
  }
  .hero-image-col {
    order: 2 !important;
    flex: 0 0 50% !important;
    max-width: 50% !important;
    width: 50% !important;
  }
  .hero-text-col {
    order: 1 !important;
    flex: 0 0 50% !important;
    max-width: 50% !important;
    width: 50% !important;
    padding-right: 25px;
  }
  .hero-one-image img {
    max-width: 520px;
    height: 400px;
    object-fit: cover;
    border-radius: 16px;
    margin-left: auto;
  }
}

/* Mobile & Tablet (< 1200px): Image on TOP (1), Text on BOTTOM (2) */
@media (max-width: 1199px) {
  .hero-row {
    display: flex !important;
    flex-direction: column !important;
  }
  .hero-image-col {
    order: 1 !important;
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
    margin-bottom: 24px !important;
    text-align: center !important;
  }
  .hero-text-col {
    order: 2 !important;
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
    text-align: center !important;
    padding-right: 0 !important;
  }
  .hero-one-image {
    margin: 0 auto !important;
    text-align: center !important;
  }
  .hero-one-image img {
    width: 100% !important;
    max-width: 480px !important;
    height: 240px !important;
    object-fit: cover !important;
    border-radius: 14px !important;
    margin: 0 auto !important;
    box-shadow: 0 12px 30px rgba(15, 15, 45, 0.12) !important;
  }
  .hero-content .hero-desc {
    margin-left: auto;
    margin-right: auto;
    max-width: 600px;
  }
  .hero-button {
    justify-content: center !important;
  }
  .hero-feature-badges {
    justify-content: center !important;
  }
}

/* Phone Screen Hero (< 768px) */
@media (max-width: 767px) {
  .hero-section {
    padding: 24px 0 45px !important;
  }
  .hero-one-image img {
    height: 210px !important;
    max-width: 100% !important;
    border-radius: 12px !important;
  }
  .hero-content h1 {
    font-size: clamp(24px, 6.5vw, 32px) !important;
    line-height: 1.25 !important;
    margin-bottom: 14px !important;
  }
  .hero-content .hero-desc {
    font-size: 14px !important;
    line-height: 1.6 !important;
    margin-bottom: 22px !important;
  }
  .hero-button {
    flex-direction: column !important;
    width: 100% !important;
    gap: 10px !important;
  }
  .hero-button .main-btn, 
  .hero-button a, 
  .hero-button button {
    width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
    padding: 12px 18px !important;
  }
  .hero-feature-badges {
    flex-direction: column !important;
    align-items: center !important;
    gap: 12px !important;
    margin-top: 22px !important;
  }
  .feature-badge-item {
    width: 100% !important;
    max-width: 320px !important;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
  }
}

/* --- B. HEADER & MOBILE DRAWER NAVIGATION --- */
@media (max-width: 1199px) {
  .navbar-toggler {
    display: flex !important;
  }
  .nav-menu {
    position: fixed;
    top: 0;
    left: -340px;
    width: 320px;
    max-width: 86vw;
    height: 100vh;
    height: 100dvh;
    background: #ffffff;
    z-index: 10001;
    box-shadow: 12px 0 35px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 24px 20px 30px;
    transition: left 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav-menu.active {
    left: 0;
  }
  .nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }
  .nav-overlay.active {
    opacity: 1;
    visibility: visible;
  }
  .nav-menu .mobile-logo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 18px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 14px;
  }
  .nav-menu .mobile-logo img {
    height: 44px;
    width: auto;
  }
  .nav-menu .mobile-close-btn {
    position: absolute;
    top: 20px;
    right: 18px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    color: var(--heading-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
  }
  .main-menu {
    width: 100%;
    flex: 1;
  }
  .main-menu ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    width: 100%;
  }
  .main-menu ul li {
    width: 100%;
    border-bottom: 1px solid #f8fafc;
  }
  .main-menu ul li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--heading-color);
  }
  .main-menu ul li.active a,
  .main-menu ul li a:hover {
    color: var(--primary-color);
    background: rgba(255, 94, 20, 0.05);
  }
}

/* Header Top Bar on Mobile (< 768px) */
@media (max-width: 767px) {
  body {
    padding-bottom: 64px; /* Space for Sticky Bottom Bar */
  }
  .header-top-bar {
    padding: 6px 0 !important;
    font-size: 12px !important;
  }
  .header-top-bar .top-left {
    text-align: center;
    justify-content: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .header-top-bar .top-right {
    display: none !important;
  }
  .primary-menu {
    min-height: 60px !important;
  }
  .site-branding .brand-logo img {
    height: 44px !important;
    max-width: 150px !important;
  }
  .nav-right-item {
    gap: 8px !important;
  }
  .bar-item {
    padding: 6px !important;
  }
  .bar-item img {
    width: 18px !important;
  }
}

/* --- C. SERVICES (6 LOAN CARDS) RESPONSIVENESS --- */
/* Desktop (>= 992px): 3 columns (33.333% each) */
@media (min-width: 992px) {
  .services-section .col-lg-4 {
    flex: 0 0 33.333333% !important;
    max-width: 33.333333% !important;
    width: 33.333333% !important;
  }
}

/* Tablet (768px - 991px): 2 columns (50% each) */
@media (min-width: 768px) and (max-width: 991px) {
  .services-section .col-lg-4, 
  .services-section .col-md-6 {
    flex: 0 0 50% !important;
    max-width: 50% !important;
    width: 50% !important;
  }
}

/* Mobile (< 768px): 1 column (100% full width) */
@media (max-width: 767px) {
  .services-section .col-lg-4, 
  .services-section .col-md-6 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
  }
  .single-blog-post {
    margin-bottom: 20px !important;
  }
  .post-thumbnail {
    height: 180px !important;
  }
  .post-content {
    padding: 18px 16px !important;
  }
}

/* --- D. ABOUT SECTION & INFOGRAPHIC --- */
@media (max-width: 991px) {
  .about-image-wrapper {
    margin-bottom: 30px;
    text-align: center;
  }
  .about-image-wrapper img {
    max-height: 380px;
    margin: 0 auto;
  }
  .about-one_content-box {
    padding-left: 0 !important;
    text-align: center;
  }
  .partner-tags {
    justify-content: center;
  }
}

@media (max-width: 767px) {
  .about-stat-box {
    padding: 16px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    text-align: center;
  }
}

/* --- E. EMI CALCULATOR RESPONSIVENESS --- */
@media (max-width: 991px) {
  .calculator-card {
    padding: 24px 18px !important;
  }
  .calc-result-box {
    margin-top: 25px !important;
    padding: 24px 18px !important;
  }
}

@media (max-width: 767px) {
  .calculator-section {
    padding: 40px 0 !important;
  }
  /* Category Tabs horizontal swipe */
  .calc-tabs {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 8px !important;
    padding-bottom: 10px !important;
    margin-bottom: 20px !important;
    justify-content: flex-start !important;
    scrollbar-width: none !important;
  }
  .calc-tabs::-webkit-scrollbar {
    display: none;
  }
  .calc-tab-btn {
    flex-shrink: 0 !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
  }
  .calc-label-row {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .calc-label-row label {
    font-size: 14px !important;
  }
  .calc-input-wrapper {
    padding: 4px 8px !important;
  }
  .calc-num-input {
    width: 85px !important;
    font-size: 14px !important;
  }
  .calc-range::-webkit-slider-thumb {
    width: 26px !important;
    height: 26px !important;
  }
  .emi-display h3 {
    font-size: 26px !important;
  }
  .chart-container {
    flex-direction: column !important;
    gap: 12px !important;
    margin: 15px 0 !important;
  }
  .chart-svg-wrap {
    width: 110px !important;
    height: 110px !important;
  }
  /* Amortization Table Scroll */
  .amortization-table-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .amortization-table th, 
  .amortization-table td {
    padding: 8px 10px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }
}

/* --- F. FORMS & INPUTS (iOS Safari Zoom Prevention) --- */
.form_control, 
input[type="text"],
input[type="number"],
input[type="tel"],
input[type="email"],
input[type="password"],
select, 
textarea {
  font-size: 16px !important; /* Prevents auto-zoom on iPhone/Safari */
  border-radius: 8px;
}

@media (max-width: 767px) {
  .contact-area {
    padding: 20px 16px !important;
  }
  .form_control {
    min-height: 48px !important;
  }
  .page-banner {
    padding-top: 50px !important;
    padding-bottom: 50px !important;
  }
  .pt-110, .pt-120, .pt-130, .pt-170, .pt-185 {
    padding-top: 45px !important;
  }
  .pb-80, .pb-100, .pb-130, .pb-170 {
    padding-bottom: 45px !important;
  }
  .mb-50 {
    margin-bottom: 25px !important;
  }
}

/* --- G. MOBILE BOTTOM BAR & FLOATING WIDGETS --- */
@media (max-width: 767px) {
  .mobile-bottom-bar {
    display: block !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 60px !important;
    background: #ffffff !important;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.12) !important;
    z-index: 9998 !important;
    padding: 5px 8px !important;
    border-top: 1px solid #e2e8f0 !important;
  }
  .mobile-bar-actions {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 6px !important;
    height: 100% !important;
  }
  .mobile-bar-btn {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 4px 2px !important;
    border-radius: 8px !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    line-height: 1.1 !important;
    text-decoration: none !important;
  }
  .mobile-bar-btn i {
    font-size: 15px !important;
    margin-bottom: 2px !important;
  }
  /* Hide Standalone WhatsApp Button on Phone to prevent clutter */
  .whatsapp-widget-container {
    display: none !important;
  }
  /* Floating Loan Assistant on Phone */
  .ai-advisor-widget {
    bottom: 68px !important;
    right: 12px !important;
    z-index: 9999 !important;
  }
  .ai-advisor-launcher {
    padding: 7px 12px !important;
    gap: 8px !important;
  }
  .ai-avatar-ring {
    width: 32px !important;
    height: 32px !important;
    font-size: 14px !important;
  }
  .ai-launcher-title {
    font-size: 12px !important;
  }
  .ai-sparkle-tag, .ai-launcher-sub {
    display: none !important;
  }
  .ai-chat-window {
    position: fixed !important;
    inset: auto 8px 66px 8px !important;
    width: auto !important;
    max-width: calc(100vw - 16px) !important;
    height: calc(100dvh - 110px) !important;
    max-height: 540px !important;
    border-radius: 16px !important;
    z-index: 10002 !important;
  }
  /* Back-To-Top button on Phone */
  .back-to-top {
    bottom: 126px !important;
    right: 12px !important;
    width: 36px !important;
    height: 36px !important;
    font-size: 14px !important;
  }
}

/* --- H. FOOTER RESPONSIVENESS --- */
@media (min-width: 992px) {
  .footer-widget-area .col-lg-4 {
    flex: 0 0 33.333333% !important;
    max-width: 33.333333% !important;
    width: 33.333333% !important;
  }
}

@media (max-width: 991px) {
  .footer-widget-area .row > div {
    margin-bottom: 28px;
  }
  .footer-copyright .row {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
  .footer-nav ul {
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 14px;
  }
}

/* Extra Small Phones (< 380px) */
@media (max-width: 379px) {
  .site-branding .brand-logo img {
    height: 38px !important;
    max-width: 130px !important;
  }
  .hero-content h1 {
    font-size: 23px !important;
  }
  .mobile-bar-btn span {
    font-size: 9px !important;
  }
}
