/* ==========================================================================
   ROYALIX TECHNOLOGY - RESPONSIVE STYLESHEET
   Flawless responsive design across ALL device screen widths:
   Desktop (>1280px), Laptop (1280px), Tablet Landscape (1024px),
   Tablet Portrait (768px), Large Mobile (600px), Mobile (480px),
   Samsung Galaxy S20 Ultra & Pixel (412px), Small Android (360px), iPhone SE (320px)
   ========================================================================== */

/* --------------------------------------------------------------------------
   GLOBAL OVERFLOW & FLUID BASE
   -------------------------------------------------------------------------- */
html, body {
  overflow-x: hidden !important;
  max-width: 100% !important;
  width: 100% !important;
}

*, *::before, *::after {
  box-sizing: border-box;
}

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

/* Ensure grid & flex children can shrink below content size */
.solutions-cards-grid > *,
.ecosystem-steps-grid > *,
.stats-grid > *,
.footer-grid > *,
.deep-dive-feature-cards > *,
.calc-checkboxes-grid > *,
.industries-grid > *,
.process-steps-grid > *,
.testimonials-grid > *,
.wa-features-grid > *,
.admin-kpi-grid > * {
  min-width: 0;
}

/* Prevent text clipping / overflow in mono code blocks */
[style*="font-family: var(--font-mono)"],
code, pre, .font-mono {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* --------------------------------------------------------------------------
   BREAKPOINT 1: Extra Large Screens / Small Laptops (Max 1280px)
   -------------------------------------------------------------------------- */
@media (max-width: 1280px) {
  :root {
    --dash-scale: 0.42;
  }

  .container {
    padding-left: 2rem;
    padding-right: 2rem;
  }

  .footer-grid {
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 2rem;
  }

  .ecosystem-steps-grid {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .industries-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* --------------------------------------------------------------------------
   BREAKPOINT 2: Large Tablets & Small Laptops (Max 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  :root {
    --dash-scale: 0.38;
  }

  /* Turn off backdrop-filter on header to prevent trapping fixed mobile drawer */
  .site-header {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: #FFFFFF !important;
  }

  .site-header.scrolled {
    background: #0B0F19 !important;
  }

  /* Core Grids Stack to Single Column */
  .hero-grid,
  .deep-dive-grid,
  .deep-dive-grid.reverse,
  .whatsapp-grid,
  .calc-card-grid,
  .contact-grid {
    grid-template-columns: 1fr !important;
    gap: 3rem;
  }

  /* Reset order for reverse layout so text appears first, visual appears second */
  .deep-dive-grid.reverse > *:first-child {
    order: 1 !important;
  }
  .deep-dive-grid.reverse > *:last-child {
    order: 2 !important;
  }

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

  .hero-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .hero-cta-group,
  .hero-highlights {
    justify-content: center;
  }

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

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

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

  .industries-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .workflow-nodes-flow {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .workflow-connector-arrow {
    transform: rotate(90deg);
    padding: 0.5rem 0;
  }

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

  .admin-preview-layout {
    grid-template-columns: 200px 1fr;
  }

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

  .cd-kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .cd-mid-grid {
    grid-template-columns: 1fr;
    height: auto;
  }

  .wa-pipeline-grid {
    grid-template-columns: 1fr auto 1fr auto 1fr;
    gap: 0.75rem;
  }

  .wa-pipeline-arrow:nth-of-type(n+3) {
    display: none;
  }

  .calc-card-grid {
    padding: 2rem;
  }
}

/* --------------------------------------------------------------------------
   BREAKPOINT 3: Tablets Portrait & Large Mobile (Max 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --dash-scale: 0.34;
  }

  /* Spacing & Typography */
  .section {
    padding: 3.5rem 0;
  }

  .section-title {
    font-size: 2rem;
  }

  .section-subtitle {
    font-size: 1rem;
  }

  /* Header & Navigation */
  .top-announcement {
    display: none;
  }

  .site-header {
    height: 70px;
  }

  .brand-logo img {
    height: 48px !important;
    width: auto !important;
  }

  .brand-title, .brand-name-text {
    font-size: 1.1rem !important;
  }

  /* Mobile Navigation Drawer: Full Viewport, Clean Inset Padding */
  .main-nav {
    position: fixed !important;
    top: 70px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: calc(100vh - 70px) !important;
    background: #080C14 !important;
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 2rem 1.75rem !important;
    gap: 1.25rem !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    z-index: 99999 !important;
    box-sizing: border-box !important;
    margin: 0 !important;
  }

  .main-nav.mobile-active {
    transform: translateX(0) !important;
  }

  .main-nav .nav-link {
    color: #F8FAFC !important;
    font-size: 1.15rem !important;
    width: 100% !important;
    border-bottom: 1px solid rgba(255,255,255,0.1) !important;
    padding: 0.75rem 0 !important;
    margin: 0 !important;
    text-align: left !important;
    justify-content: flex-start !important;
    box-sizing: border-box !important;
  }

  .dropdown-menu {
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    box-shadow: none;
    border: none;
    background: transparent;
    padding-left: 1rem;
    display: none;
  }

  .nav-dropdown:hover .dropdown-menu,
  .nav-dropdown:active .dropdown-menu {
    display: flex;
  }

  .dropdown-item {
    color: var(--color-light-300);
  }

  .mobile-toggle {
    display: block;
  }

  .site-header.scrolled .mobile-toggle {
    color: var(--color-white);
  }

  .header-actions .btn-primary,
  .header-actions .btn-red {
    display: none;
  }

  /* Grid Layouts Flattening */
  .solutions-cards-grid,
  .ecosystem-steps-grid,
  .stats-grid,
  .deep-dive-feature-cards,
  .dash-top-metrics,
  .dash-modules-grid,
  .footer-grid,
  .calc-checkboxes-grid,
  .features-matrix,
  .admin-preview-layout,
  .process-steps-grid,
  .testimonials-grid,
  .form-row-2col {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }

  .industries-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem;
  }

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

  .hero-description {
    font-size: 1rem;
  }

  .hero-section {
    padding: 3rem 0 4rem 0;
  }

  .dash-metric-card,
  .dash-module-item,
  .ecosystem-step-card,
  .solution-card,
  .stat-item {
    padding: 1.25rem;
  }

  .floating-badge {
    display: none;
  }

  .admin-preview-sidebar {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }

  .calc-summary-panel {
    margin-top: 1.5rem;
  }

  .calc-card-grid {
    padding: 1.5rem;
  }

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

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

  .cd-mid-grid {
    grid-template-columns: 1fr;
    height: auto;
  }

  .wa-pipeline-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
  }

  .wa-pipeline-arrow {
    display: none !important;
  }

  .phone-mockup-frame {
    max-width: 320px;
    margin: 0 auto;
  }

  .whatsapp-screen {
    height: 460px;
  }

  .whatsapp-section,
  .contact-section {
    padding: 3.5rem 0;
  }

  .contact-form-card {
    padding: 1.75rem 1.5rem !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .modal-dialog-box {
    max-width: 95vw;
    padding: 1.5rem !important;
  }

  .toast-container {
    right: 1rem;
    left: 1rem;
    bottom: 1rem;
  }

  .toast {
    min-width: auto;
    max-width: 100%;
    width: 100%;
  }

  .workflow-canvas-card {
    padding: 1.5rem;
  }

  .admin-preview-wrapper {
    border-radius: var(--radius-lg);
  }

  .admin-preview-topbar {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .admin-preview-content {
    padding: 1rem;
  }

  .admin-table-custom {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .deep-dive-visual-card {
    padding: 1.5rem;
  }

  .visual-data-grid {
    grid-template-columns: 1fr;
  }

  .hero-highlights {
    gap: 1rem;
    flex-direction: column;
    align-items: center;
  }

  .section-title-wrap {
    margin-bottom: 2.5rem;
  }

  .footer-bottom-bar {
    flex-direction: column !important;
    text-align: center;
    gap: 1rem !important;
  }

  .floating-whatsapp-trigger {
    width: 52px;
    height: 52px;
    font-size: 1.75rem;
    bottom: 1.5rem;
    right: 1.5rem !important;
    left: auto !important;
  }

  .scenario-pills-wrap {
    justify-content: center;
  }

  .solution-card-footer {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .deep-dive-visual-card [style*="display: flex"][style*="justify-content: space-between"] {
    flex-wrap: wrap !important;
    gap: 0.25rem;
  }

  .deep-dive-visual-card [style*="font-family: var(--font-mono)"] span {
    word-break: break-all;
  }

  .stat-number {
    font-size: 2rem;
  }

  .gallery-grid img,
  .testimonial-img {
    max-width: 100%;
    height: auto;
  }
}

/* --------------------------------------------------------------------------
   BREAKPOINT 4: Small Tablets & Large Phones (Max 600px)
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
  :root {
    --dash-scale: 0.30;
  }

  .container {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .section-title {
    font-size: 1.75rem;
  }

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

  .solutions-cards-grid {
    grid-template-columns: 1fr !important;
  }

  .calc-card-grid {
    padding: 1.25rem;
  }

  .calc-price-display {
    font-size: 2.25rem;
  }

  .cd-kpi-grid,
  .cd-quick-links,
  .admin-kpi-grid,
  .form-row-2col,
  .wa-features-grid {
    grid-template-columns: 1fr !important;
  }

  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem;
  }

  .solution-pricing-lbl strong {
    font-size: 1rem;
  }

  .phone-mockup-frame {
    max-width: 290px;
    padding: 8px;
    border-radius: 36px;
  }

  .whatsapp-screen {
    height: 400px;
    border-radius: 28px;
  }

  .wa-message-bubble {
    max-width: 92%;
    font-size: 0.75rem;
  }

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

  .stat-number {
    font-size: 1.75rem;
  }

  .contact-form-card {
    padding: 1.25rem;
  }

  .deep-dive-feature-cards {
    grid-template-columns: 1fr !important;
  }

  [style*="display: flex"][style*="gap: 1rem"] {
    flex-wrap: wrap !important;
  }
}

/* --------------------------------------------------------------------------
   BREAKPOINT 5: Small Smart Phones (Max 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  :root {
    --dash-scale: 0.27;
  }

  .section {
    padding: 2.5rem 0;
  }

  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .section-title,
  .hero-title {
    font-size: 1.65rem;
    line-height: 1.2;
  }

  /* Full Width Touch-Friendly Buttons */
  .hero-cta-group {
    flex-direction: column;
    width: 100%;
    gap: 0.75rem;
  }

  .hero-cta-group .btn,
  .deep-dive-section .btn,
  .deep-dive-grid .btn {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
  }

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

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

  .dashboard-inner {
    padding: 1rem;
  }

  .dash-metric-card .metric-val {
    font-size: 1.1rem;
  }

  .solutions-filter-bar {
    flex-direction: column;
    width: 100%;
  }

  .filter-btn {
    width: 100%;
    text-align: center;
  }

  .modal-dialog {
    margin: 0.5rem;
    width: auto;
  }

  .modal-content,
  .modal-dialog-box {
    padding: 1.25rem !important;
  }

  .modal-modules-list {
    grid-template-columns: 1fr !important;
  }

  .faq-header {
    padding: 1rem 1.25rem;
  }

  .faq-header h4 {
    font-size: 0.9375rem;
  }

  .faq-content {
    padding: 0 1.25rem 1rem 1.25rem;
    font-size: 0.875rem;
  }

  .btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
  }

  .btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }

  .hero-section {
    padding: 2rem 0 3rem 0;
  }

  .hero-description {
    font-size: 0.9375rem;
  }

  .hero-pill-badge,
  .section-badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.85rem;
  }

  .ecosystem-step-card,
  .solution-card {
    padding: 1.5rem 1rem;
  }

  .workflow-canvas-card,
  .workflow-node-box {
    padding: 1rem;
  }

  .phone-mockup-frame {
    max-width: 270px;
    padding: 6px;
    border-radius: 32px;
    border-width: 3px;
  }

  .whatsapp-screen {
    height: 360px;
    border-radius: 26px;
  }

  .deep-dive-visual-card [style*="font-family"] {
    font-size: 0.6875rem !important;
  }

  .toast-container {
    right: 0.5rem;
    left: 0.5rem;
    bottom: 0.75rem;
  }

  .stat-number {
    font-size: 1.5rem;
  }

  .calc-price-display {
    font-size: 2rem;
  }

  .calc-summary-panel {
    padding: 1.25rem;
  }

  .contact-form-card {
    padding: 1.5rem 1.15rem !important;
    border-radius: var(--radius-lg) !important;
  }

  .floating-whatsapp-trigger {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    bottom: 1rem;
    right: 1rem !important;
    left: auto !important;
  }
}

/* --------------------------------------------------------------------------
   BREAKPOINT 6: Specific Optimization for 412px (Samsung Galaxy S20 Ultra, Google Pixel)
   -------------------------------------------------------------------------- */
@media (max-width: 412px) {
  :root {
    --dash-scale: 0.25;
  }

  .container {
    padding-left: 0.875rem;
    padding-right: 0.875rem;
  }

  .contact-form-card {
    padding: 1.25rem 1rem !important;
  }

  .section-title {
    font-size: 1.55rem;
  }

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

  .dashboard-preview-wrapper {
    max-width: 300px;
  }

  .phone-mockup-frame {
    max-width: 260px;
  }

  .whatsapp-screen {
    height: 350px;
  }
}

/* --------------------------------------------------------------------------
   BREAKPOINT 7: Extra Small Phones (Max 360px) — Small Android Devices
   -------------------------------------------------------------------------- */
@media (max-width: 360px) {
  :root {
    --dash-scale: 0.22;
  }

  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .hero-title,
  .section-title {
    font-size: 1.4rem;
  }

  .hero-description {
    font-size: 0.875rem;
  }

  .btn {
    padding: 0.65rem 1rem;
    font-size: 0.8125rem;
  }

  .btn-lg {
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
  }

  .dashboard-preview-wrapper {
    max-width: 264px;
  }

  .phone-mockup-frame {
    max-width: 240px;
    padding: 5px;
    border-radius: 28px;
    border-width: 2px;
  }

  .whatsapp-screen {
    height: 320px;
    border-radius: 23px;
  }

  .wa-message-bubble {
    font-size: 0.6875rem;
    padding: 0.5rem 0.625rem;
  }

  .stat-number {
    font-size: 1.35rem;
  }

  .solution-card {
    padding: 1.25rem 1rem;
  }

  .solution-card-title {
    font-size: 1.15rem;
  }

  .faq-header h4 {
    font-size: 0.875rem;
  }

  .calc-price-display {
    font-size: 1.75rem;
  }

  .contact-form-card {
    padding: 1.25rem 0.85rem !important;
  }

  .floating-whatsapp-trigger {
    width: 44px;
    height: 44px;
    font-size: 1.35rem;
    bottom: 0.75rem;
    right: 0.75rem !important;
    left: auto !important;
  }
}

/* --------------------------------------------------------------------------
   BREAKPOINT 8: Tiny Screens (Max 320px) — iPhone SE 1st Gen, Smallest Foldables
   -------------------------------------------------------------------------- */
@media (max-width: 320px) {
  :root {
    --dash-scale: 0.20;
  }

  .container {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .hero-title,
  .section-title {
    font-size: 1.25rem;
  }

  .dashboard-preview-wrapper {
    max-width: 240px;
  }

  .phone-mockup-frame {
    max-width: 220px;
  }

  .whatsapp-screen {
    height: 290px;
  }
}

/* --------------------------------------------------------------------------
   PRINT STYLES
   -------------------------------------------------------------------------- */
@media print {
  .site-header,
  .top-announcement,
  .floating-whatsapp-trigger,
  .toast-container,
  .mobile-toggle {
    display: none !important;
  }

  .section {
    padding: 1rem 0;
    break-inside: avoid;
  }
}
