/* ==========================================================================
   SUNRISE FINTECH - UNIVERSAL RESPONSIVE STYLESHEET
   Comprehensive responsive framework for:
   - Large Desktop (> 1200px)
   - Desktop / Laptop (992px - 1199px)
   - Tablet (768px - 991px)
   - Mobile (480px - 767px)
   - Small Mobile (380px - 479px)
   - Extra Small Mobile (320px - 379px)
   ========================================================================== */

/* ─── Global Base Responsive Rules ─── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --nav-height: 64px;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
}

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

input,
select,
textarea,
button {
  max-width: 100%;
}

/* Ensure mobile Safari doesn't zoom in on input focus */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="password"],
  input[type="date"],
  input[type="search"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* Universal Table Responsiveness */
table {
  max-width: 100%;
  border-collapse: collapse;
}

.table-responsive,
.table-wrap,
.table-container,
.ucc-full-details,
.table-scroll,
.result-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}

/* ─── Breakpoint: Large Desktop (> 1200px) ─── */
@media (min-width: 1201px) {
  .container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 32px;
  }
}

/* ─── Breakpoint: Laptop / Desktop (992px - 1200px) ─── */
@media (max-width: 1200px) {
  .container {
    max-width: 100%;
    padding: 0 28px;
  }

  .grid-4,
  .form-grid.col-5,
  .form-grid.col-4 {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .calc-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .admin-grid-top {
    grid-template-columns: 1fr;
  }
}

/* ─── Breakpoint: Tablet (768px - 991px) ─── */
@media (max-width: 991px) {
  :root {
    --nav-height: 58px;
  }

  .container {
    padding: 0 22px;
  }

  section {
    padding: 60px 0;
  }

  /* Navigation Drawer & Hamburger */
  .nav-links {
    display: none !important;
  }

  .hamburger,
  .mobile-menu-btn {
    display: flex !important;
    flex-direction: column;
    justify-content: space-around;
    width: 40px;
    height: 40px;
    padding: 8px 6px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    z-index: 10001;
  }

  .menu-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #6c5dd3;
    color: #ffffff;
    font-size: 20px;
    border: none;
    cursor: pointer;
    z-index: 10001;
  }

  .hamburger span {
    display: block;
    width: 100%;
    height: 2.5px;
    background: #1b1464;
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
  }

  /* White hamburger bars when on dark topbar */
  .topbar .hamburger span,
  .topbar-inner .hamburger span {
    background: #ffffff !important;
  }

  /* Animate hamburger to X when active / open */
  .hamburger.active span:nth-child(1),
  .hamburger.open span:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
  }
  .hamburger.active span:nth-child(2),
  .hamburger.open span:nth-child(2) {
    opacity: 0;
  }
  .hamburger.active span:nth-child(3),
  .hamburger.open span:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
  }

  .nav-inner {
    height: var(--nav-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 10000;
  }

  /* Mobile menu drawer: hidden by default */
  .mobile-menu {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    width: 100%;
    max-height: calc(100vh - var(--nav-height));
    background: #ffffff;
    padding: 20px 24px 36px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: none;
    flex-direction: column;
    gap: 8px;
    border-bottom: 1px solid #e2e8f0;
    box-sizing: border-box;
  }

  /* When open / active */
  .mobile-menu.open,
  .mobile-menu.active,
  .mobile-menu.is-open {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: none !important;
  }

  .mobile-menu a {
    color: #1e293b;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    padding: 12px 16px;
    border-radius: 8px;
    display: block;
    transition: background-color 0.2s, color 0.2s;
  }

  .mobile-menu a:hover {
    background-color: #f1f5f9;
    color: #2563eb;
  }

  .mobile-menu .mob-cta,
  .mobile-menu .nav-cta {
    background: #272088;
    color: #ffffff !important;
    text-align: center;
    margin-top: 10px;
    font-weight: 700;
  }

  /* Grids & Cards */
  .grid-3,
  .grid-4,
  .form-grid.col-3,
  .form-grid.col-4,
  .form-grid.col-5 {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }

  .intro-panel,
  .contact-layout,
  .about-hero-grid,
  .services-overview-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  /* KYC Hub on Tablet */
  .kyc-hub-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .kyc-banner {
    max-width: 320px;
    margin-top: 18px;
    align-self: center;
  }

  .kyc-action-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

/* ─── Breakpoint: Mobile (480px - 767px) ─── */
@media (max-width: 767px) {
  .container {
    padding: 0 16px;
  }

  section {
    padding: 48px 0;
    scroll-margin-top: 70px;
  }

  .page-hero {
    padding: 90px 0 40px;
  }

  .page-hero h1,
  .hero-title,
  .section-title h2 {
    font-size: clamp(24px, 5.5vw, 34px);
    line-height: 1.25;
  }

  /* Form grids collapse to single column */
  .form-grid.col-2,
  .form-grid.col-3,
  .form-grid.col-4,
  .form-grid.col-5,
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }

  .col-span-2,
  .col-span-3,
  .col-span-4 {
    grid-column: span 1 !important;
  }

  .field {
    min-width: 0 !important;
    width: 100%;
  }

  .field label {
    font-size: 13px;
  }

  /* KYC Specific Mobile Styles */
  .stepper-bar {
    padding: 12px 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .stepper-inner {
    display: flex;
    flex-wrap: nowrap;
    min-width: max-content;
    gap: 8px;
    justify-content: flex-start;
  }

  .step-item {
    padding: 6px 10px;
    flex-shrink: 0;
  }

  .step-info {
    display: none;
  }

  .step-connector {
    width: 16px;
    flex-shrink: 0;
  }

  .kyc-hub-trust {
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .kyc-trust-div {
    display: none;
  }

  .kyc-trust-item {
    font-size: 12px;
  }

  .kyc-banner {
    display: none;
  }

  .mandate-panel-body {
    padding: 14px 10px;
  }

  .form-actions {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .action-left,
  .action-right {
    width: 100%;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
  }

  .action-right .btn,
  .action-left .btn {
    flex: 1 1 auto;
    min-width: 110px;
    justify-content: center;
  }

  .client-inline-search {
    flex-wrap: wrap;
    width: 100%;
  }

  .client-inline-search input {
    flex: 1 1 180px;
    min-width: 0;
  }

  .scheme-details-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
  }

  .scheme-details-grid > div[style*="grid-column:span"] {
    grid-column: span 2 !important;
  }

  /* Modals on Mobile */
  .client-check-modal,
  .modal-dialog,
  .popup-card {
    width: calc(100vw - 24px) !important;
    max-width: 100% !important;
    margin: 12px auto !important;
    padding: 18px 14px !important;
    max-height: calc(100vh - 28px);
    overflow-y: auto;
  }

  .client-check-actions {
    flex-direction: column;
    gap: 10px;
  }

  .client-check-actions .btn {
    width: 100%;
  }

  /* Buttons & CTAs */
  .hero-buttons,
  .cta-buttons {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .hero-buttons .btn,
  .cta-buttons .btn,
  .hero-buttons a,
  .cta-buttons a {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

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

  .footer-bottom-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }

  /* Calculators */
  .calc-card {
    padding: 16px 12px;
    border-radius: 12px;
  }

  .calc-metrics {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .calc-chart {
    width: min(340px, 100%) !important;
    margin: 0 auto;
  }
}

/* ─── Breakpoint: Small Mobile (380px - 479px) ─── */
@media (max-width: 479px) {
  :root {
    --nav-height: 54px;
  }

  .container {
    padding: 0 14px;
  }

  .nav-inner {
    padding: 0 14px;
  }

  .logo-img,
  .logo img {
    max-width: 130px;
    height: auto;
  }

  .kyc-hub-title {
    font-size: 24px;
  }

  .kyc-hub-sub {
    font-size: 13px;
  }

  .kyc-action-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .kyc-action-card {
    padding: 14px 16px;
    font-size: 14px;
  }

  .ucc-display-row {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }

  .ucc-display-item {
    padding: 10px;
  }

  .topbar-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
  }

  .topbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .scheme-details-grid {
    grid-template-columns: 1fr !important;
  }

  .scheme-details-grid > div[style*="grid-column:span"] {
    grid-column: span 1 !important;
  }

  .inv-type-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .inv-tab {
    flex: 1 1 calc(50% - 6px);
    text-align: center;
    padding: 8px 10px;
    font-size: 13px;
  }

  .toast {
    left: 10px;
    right: 10px;
    bottom: 16px;
    font-size: 13px;
  }

  .numbers-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .number-big {
    font-size: 32px;
  }
}

/* ─── Breakpoint: Extra Small Mobile (320px - 379px) ─── */
@media (max-width: 379px) {
  .container {
    padding: 0 10px;
  }

  .nav-inner {
    padding: 0 10px;
  }

  .logo-img,
  .logo img {
    max-width: 110px;
  }

  .btn {
    padding: 8px 14px;
    font-size: 13px;
  }

  .step-num {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }

  .client-check-modal {
    padding: 14px 10px !important;
  }

  .client-check-head h2 {
    font-size: 18px;
  }

  .mandate-panel-title {
    font-size: 14px;
  }

  .inv-tab {
    flex: 1 1 100%;
    font-size: 12px;
  }

  .file-drop {
    padding: 16px 8px;
    font-size: 12px;
  }

  .calc-card {
    padding: 12px 8px;
  }

  .calc-callout-value {
    font-size: 12px;
  }

  .calc-callout-label {
    font-size: 8.5px;
  }
}

/* ─── Print Responsiveness ─── */
@media print {
  .stepper-bar,
  .nav-inner,
  .mobile-menu,
  .form-actions,
  .footer,
  .btn {
    display: none !important;
  }

  .main-content {
    padding: 0;
    margin: 0;
  }

  .form-section {
    display: block !important;
  }
}
