/* 
  B4U LOANS - Responsive Breakpoints Stylesheet
  Improved: mobile-first fixes, extra breakpoints, overflow/box-sizing safety
*/

/* ---------- Global safety net (prevents horizontal scroll & sizing bugs) ---------- */
* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

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

/* Hamburger hidden on desktop by default; shown again at 768px below */
.hamburger {
  display: none;
}

/* ---------- Large tablets / small laptops ---------- */
@media (max-width: 1024px) {
  .container {
    padding-left: 20px;
    padding-right: 20px;
  }

  .hero-title {
    font-size: 2.5rem;
    line-height: 1.25;
  }

  .hero-grid {
    gap: 30px;
  }

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

  .founder-card {
    grid-template-columns: 1fr;
  }

  .founder-img-placeholder {
    min-height: 250px;
  }

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

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

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- Tablets / large phones ---------- */
@media (max-width: 768px) {
  .section {
    padding: 60px 0;
  }

  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .top-bar-info span {
    display: none;
  }

  .hamburger {
    display: block;
  }

  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(280px, 80vw);
    height: 100vh;
    background-color: var(--bg-card);
    flex-direction: column;
    align-items: flex-start;
    padding: 80px 30px 30px 30px;
    gap: 20px;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease;
    z-index: 999;
    overflow-y: auto;
  }

  .nav-menu.active {
    right: 0;
  }

  /* IMPORTANT: .hamburger lives INSIDE .nav-actions in the HTML,
     so we must NOT hide the whole .nav-actions div (that was hiding
     the hamburger button itself, leaving no way to open the menu).
     Instead, turn nav-actions into a flex row and hide only the
     "Apply Now" button inside it, keeping the hamburger visible. */
  .nav-actions {
    display: flex;
    align-items: center;
  }

  .nav-actions > .btn {
    display: none;
  }

  .hamburger {
    display: block;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary-navy, #1e293b);
    cursor: pointer;
    z-index: 1000;
  }

  .mobile-cta {
    display: block;
    width: 100%;
    margin-top: 15px;
  }

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

  .hero-content {
    text-align: center;
    margin: 0 auto;
  }

  .hero-title {
    font-size: 2.1rem;
  }

  .hero-buttons {
    justify-content: center;
    flex-wrap: wrap;
  }

  .hero-stat-card {
    position: static;
    bottom: auto;
    left: auto;
    right: auto;
    margin-top: 20px;
    width: 100%;
  }

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

  .mission-vision-grid {
    grid-template-columns: 1fr;
  }

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

  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }

  .calculator-box {
    padding: 25px;
  }

  .policy-content {
    padding: 25px;
  }

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

  .footer-bottom {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  /* Tables often overflow on mobile - make them scrollable instead of squished */
  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ---------- Small phones ---------- */
@media (max-width: 480px) {
  .hero-title {
    font-size: 1.8rem;
  }

  .hero-subtitle,
  .hero-description {
    font-size: 0.95rem;
  }

  .section-header h2 {
    font-size: 1.75rem;
  }

  .section-header p {
    font-size: 0.95rem;
  }

  .btn-lg {
    width: 100%;
  }

  .hero-buttons {
    flex-direction: column;
    width: 100%;
  }

  .hero-buttons .btn {
    width: 100%;
  }

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

  .calculator-box {
    padding: 18px;
  }

  .policy-content {
    padding: 18px;
  }

  .floating-actions {
    bottom: 15px;
    right: 15px;
  }

  .float-btn {
    width: 46px;
    height: 46px;
    font-size: 1.2rem;
  }

  /* Logo/nav brand shrink so it doesn't overlap hamburger */
  .logo,
  .nav-brand {
    font-size: 1.1rem;
  }
}

/* ---------- Extra-small phones (very old / narrow devices) ---------- */
@media (max-width: 360px) {
  .hero-title {
    font-size: 1.5rem;
  }

  .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  .calculator-box,
  .policy-content {
    padding: 14px;
  }

  .float-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}

/* =================================
   EMI CALCULATOR - RESPONSIVE FIX
================================= */

/* Prevent calculator overflow */
.calculator-box,
.calculator-box * {
  box-sizing: border-box;
}

.calculator-box {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.calc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 30px;
  width: 100%;
  min-width: 0;
}

.calc-inputs,
.calc-results {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

/* Input fields */
.calc-inputs .form-group {
  width: 100%;
  min-width: 0;
}

.calc-inputs .form-input,
.calc-inputs .range-slider {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.calc-inputs .form-input {
  box-sizing: border-box;
}

/* Labels and values */
.calc-inputs .form-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.calc-inputs .form-label {
  min-width: 0;
}

.calc-inputs .form-value-display {
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: right;
}

/* Results */
.calc-results {
  overflow-wrap: anywhere;
}

.calc-results .result-value,
.calc-results .result-value-sub {
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* =================================
   TABLET
================================= */

@media (max-width: 900px) {
  .calculator-box {
    padding: 24px;
  }

  .calc-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .calc-results {
    padding: 22px;
  }
}

/* =================================
   MOBILE
================================= */

@media (max-width: 600px) {
  .calculator-box {
    padding: 16px;
    border-radius: 12px;
  }

  .calc-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }

  .calc-inputs .form-label-row {
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 8px;
  }

  .calc-inputs .form-label {
    flex: 1;
    font-size: 13px;
  }

  .calc-inputs .form-value-display {
    flex: 0 1 auto;
    font-size: 13px;
    white-space: normal;
  }

  .calc-inputs .form-input {
    padding: 11px;
    font-size: 14px;
  }

  /* Stack both buttons */
  .calc-inputs > div[style*="display: flex"] {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }

  .calc-inputs > div[style*="display: flex"] .btn {
    flex: none !important;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    justify-content: center;
    white-space: normal;
    text-align: center;
  }

  .calc-results {
    padding: 16px;
  }

  .calc-results .result-item {
    padding: 15px 0;
  }

  .calc-results .result-label {
    font-size: 13px;
    line-height: 1.6;
  }

  .calc-results .result-value {
    font-size: 25px;
  }

  .calc-results .result-value-sub {
    font-size: 17px;
  }

  .calc-results .calc-disclaimer {
    font-size: 11px;
    line-height: 1.7;
  }
}

/* =================================
   SMALL MOBILE
================================= */

@media (max-width: 360px) {
  .calculator-box {
    padding: 12px;
  }

  .calc-inputs .form-label-row {
    gap: 5px;
  }

  .calc-inputs .form-label,
  .calc-inputs .form-value-display {
    font-size: 12px;
  }

  .calc-results {
    padding: 12px;
  }

  .calc-results .result-value {
    font-size: 22px;
  }

  .calc-results .result-value-sub {
    font-size: 15px;
  }
}
