/* 
  ----------------------------------------------------------------
  RESPONSIVE STYLES
  Author: Habibur Rahman
  ----------------------------------------------------------------
*/

/* ==========================================================================
   GLOBAL FIXES
   ========================================================================== */
html,
body {
  overflow-x: hidden !important;
  width: 100% !important;
  position: relative;
  margin: 0;
  padding: 0;
}

/* ==========================================================================
   TABLETS & SMALL DESKTOPS (max-width: 991.98px)
   ========================================================================== */
@media (max-width: 991.98px) {
  .navbar {
    padding: 15px 0 !important;
  }

  .display-3 {
    font-size: 3rem !important;
  }

  .display-4 {
    font-size: 2.5rem !important;
  }

  .lead {
    font-size: 1.1rem !important;
  }

  .lead.mb-5 {
    margin-bottom: 2rem !important;
  }

  .section-padding {
    padding: 80px 0;
  }

  .btn-premium {
    padding: 10px 24px !important;
    font-size: 0.95rem !important;
  }

  /* Mobile Menu Toggler Animation (Hamburger to Close Icon) */
  .navbar-toggler {
    width: 45px;
    height: 38px;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--clr-accent) !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
  }

  .navbar-toggler-icon {
    background-image: none !important;
    /* Hide Bootstrap default SVG */
    width: 25px;
    height: 2px;
    background-color: var(--clr-white) !important;
    display: block;
    position: relative;
    transition: background-color 0.3s ease-in-out;
  }

  .navbar-toggler-icon::before,
  .navbar-toggler-icon::after {
    content: "";
    position: absolute;
    width: 25px;
    height: 2px;
    background-color: var(--clr-white) !important;
    left: 0;
    transition: transform 0.3s ease-in-out, top 0.3s ease-in-out;
  }

  .navbar-toggler-icon::before {
    top: -7px;
  }

  .navbar-toggler-icon::after {
    top: 7px;
  }

  /* Open / Active state */
  .navbar-toggler.is-open .navbar-toggler-icon {
    background-color: transparent !important;
    /* Hide middle bar */
  }

  .navbar-toggler.is-open .navbar-toggler-icon::before {
    top: 0;
    transform: rotate(45deg);
  }

  .navbar-toggler.is-open .navbar-toggler-icon::after {
    top: 0;
    transform: rotate(-45deg);
  }

  /* Navigation & Offcanvas */
  .offcanvas {
    background: #ffffff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-left: 1px solid var(--clr-border) !important;
    width: 300px !important;
    height: 100vh !important;
    top: 0 !important;
    right: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    z-index: 9999 !important;
  }

  .offcanvas-header {
    padding: 25px;
  }

  .offcanvas-body {
    padding: 25px;
  }

  .navbar-nav {
    align-items: flex-start !important;
    gap: 0;
  }

  .navbar-collapse {
    max-height: 80vh;
    overflow-y: auto;
    background: var(--clr-bg);
    padding: 20px;
    border-radius: 20px;
    margin-top: 10px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--clr-border);
    scrollbar-width: none;
  }

  .nav-item {
    width: 100%;
  }

  .nav-link {
    font-size: 1.1rem;
    font-weight: 600;
    width: 100%;
    padding: 12px 0 !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    color: var(--clr-primary) !important;
    margin: 0;
  }

  .nav-link:hover,
  .nav-link.active {
    color: var(--clr-accent) !important;
  }

  .btn-nav {
    margin-left: 0;
    margin-top: 20px;
    width: 100%;
    text-align: center;
    justify-content: center;
    color: var(--clr-white) !important;
    transition: all 0.3s ease;
  }

  /* Mobile Mega Menu */
  .mega-menu {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    transform: none !important;
    left: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: none !important;
    /* Hidden by default on mobile */
    margin: 10px 0 !important;
    padding: 10px 15px !important;
    box-shadow: none !important;
    background: var(--clr-bg-soft) !important;
    border-radius: 15px !important;
    border: 1px solid var(--clr-border) !important;
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }

  .mega-menu.show {
    display: block !important;
  }

  .mega-menu-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 15px 0 !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03) !important;
    border-radius: 0 !important;
    background: transparent !important;
  }

  .mega-menu-item:last-child {
    border-bottom: none !important;
  }

  .mega-menu-icon {
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
    font-size: 1rem !important;
    background: var(--clr-bg-soft) !important;
    border-radius: 8px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--clr-accent);
  }

  .mega-menu-title {
    font-size: 0.95rem !important;
    margin-bottom: 0 !important;
    color: var(--clr-primary) !important;
    font-weight: 600;
  }

  .mega-menu-item.active .mega-menu-icon {
    background: var(--clr-accent) !important;
    color: var(--clr-white) !important;
  }

  .mega-menu-item.active .mega-menu-title {
    color: var(--clr-accent) !important;
  }

  .mega-menu-desc {
    display: block !important;
    font-size: 0.75rem !important;
    opacity: 0.7 !important;
    line-height: 1.3 !important;
    white-space: normal !important;
  }

  /* Hero Section */
  .hero {
    text-align: center;
    padding-top: 120px;
  }

  .hero-glow {
    display: none !important;
  }

  .hero .hero-content {
    margin-bottom: 50px;
  }

  .hero-ctas {
    justify-content: center;
  }

  /* Hero Impact Redesign Fixes */
  .hero-impact {
    padding-top: 150px;
    padding-bottom: 60px;
  }

  .hero-impact h1 {
    font-size: 3.5rem;
    line-height: 1.1 !important;
    letter-spacing: -2px !important;
  }

  .hero-bg-text {
    font-size: 40vw !important;
    opacity: 0.01 !important;
  }

  .floating-card {
    display: none !important;
  }

  .hero-impact-stats {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 1.5rem !important;
    padding-top: 0 !important;
    margin-top: 3.5rem !important;
  }

  .impact-stat-item {
    flex: 1 1 calc(33.333% - 1rem) !important;
    min-width: 200px !important;
    max-width: 300px !important;
  }

  /* Service & About Hero Responsive Centering */
  .service-hero,
  section.bg-soft.mt-5 {
    padding-top: 150px;
    padding-bottom: 80px;
    text-align: center !important;
  }

  section.bg-soft.mt-5 {
    margin-top: 0 !important;
  }

  main.section-padding.mt-5 {
    margin-top: 2rem !important;
  }

  .service-hero h1,
  .service-hero p,
  section.bg-soft.mt-5 h1,
  section.bg-soft.mt-5 p {
    text-align: center !important;
  }

  .service-hero .d-flex.flex-wrap,
  section.bg-soft.mt-5 .d-flex.flex-wrap {
    justify-content: center !important;
  }

  .service-hero img {
    height: 300px;
    width: 100%;
    object-fit: cover;
    border-radius: 15px !important;
  }

  .hero-floating-code {
    display: none;
  }

  .engineering-hub {
    padding: 50px 30px;
    margin-top: -30px;
  }

  .pricing-table .pricing-card.popular {
    transform: none;
  }

  .pricing-card {
    padding: 30px 20px;
  }

  .process-card {
    padding: 30px 20px;
  }

  /* Footer */
  .footer {
    padding-top: 50px;
    padding-bottom: 20px;
    text-align: center;
  }

  .footer .row.mb-100 {
    margin-bottom: 30px;
  }

  .footer-logo {
    display: inline-block;
    margin-bottom: 15px;
  }

  .footer-logo img {
    height: 30px;
    width: auto;
  }

  .footer p.pe-lg-5 {
    padding-right: 0;
    margin-bottom: 20px;
    font-size: 0.9rem;
  }

  .footer .d-flex.gap-3.mt-4 {
    justify-content: center;
    margin-bottom: 30px;
    margin-top: 15px;
  }

  .footer-title {
    margin-bottom: 15px;
    font-size: 1.1rem;
    margin-top: 20px;
  }

  .footer-links {
    padding-left: 0;
    margin-bottom: 20px;
  }

  .footer-links li {
    margin-bottom: 8px;
  }

  .footer-bottom {
    padding-top: 25px;
    margin-top: 20px;
  }

  .footer-bottom p {
    font-size: 0.85rem;
  }

  .footer-bottom .text-md-end {
    text-align: center;
    margin-top: 15px;
  }

  .footer-bottom-links {
    justify-content: center;
    gap: 20px;
  }

  .footer-bottom-links a {
    font-size: 0.85rem;
  }
}

/* ==========================================================================
   LANDSCAPE PHONES (max-width: 767.98px)
   ========================================================================== */
@media (max-width: 767.98px) {
  .display-3 {
    font-size: 2.5rem !important;
  }

  .display-4 {
    font-size: 2.1rem !important;
  }

  .lead {
    font-size: 1rem !important;
  }

  .lead.mb-5 {
    margin-bottom: 1.75rem !important;
  }

  .section-title {
    font-size: 2.5rem;
  }

  .hero h1 {
    font-size: 3.5rem;
  }

  .hero-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 20px;
    border-radius: 20px;
  }

  .stat-item {
    width: 100%;
    margin: 0;
    border-right: none;
    padding-right: 0;
    text-align: center;
  }

  .hero-impact h1 {
    font-size: 2.8rem;
  }

  .hero-impact-stats {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 1.2rem !important;
    padding-top: 0 !important;
  }

  .impact-stat-item {
    flex: 1 1 calc(50% - 1rem) !important;
    min-width: 160px !important;
    max-width: 240px !important;
    padding: 1.2rem 1rem !important;
  }

  .impact-stat-num {
    font-size: 1.8rem !important;
  }

  .impact-stat-icon {
    width: 40px !important;
    height: 40px !important;
    font-size: 1rem !important;
    margin-bottom: 0.8rem !important;
  }
}

/* ==========================================================================
   PORTRAIT PHONES (max-width: 575.98px)
   ========================================================================== */
@media (max-width: 575.98px) {
  .display-3 {
    font-size: 2.1rem !important;
  }

  .display-4 {
    font-size: 1.8rem !important;
  }

  .lead {
    font-size: 0.95rem !important;
  }

  .lead.mb-5 {
    margin-bottom: 1.5rem !important;
  }

  .section-title {
    font-size: 2rem;
  }

  .hero h1 {
    font-size: 2.8rem;
  }

  .hero-impact-stats {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 1rem !important;
  }

  .impact-stat-item {
    flex: 1 1 calc(50% - 0.8rem) !important;
    min-width: 140px !important;
    max-width: 180px !important;
    padding: 1.2rem 0.6rem !important;
  }

  .impact-stat-num {
    font-size: 1.5rem !important;
  }

  .impact-stat-icon {
    width: 36px !important;
    height: 36px !important;
    font-size: 0.9rem !important;
    margin-bottom: 0.6rem !important;
  }

  .impact-stat-label {
    font-size: 0.65rem !important;
    letter-spacing: 1px !important;
  }

  /* Swiper Fix */
  .testimonial-slider {
    overflow: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  .swiper-wrapper {
    display: flex !important;
  }

  .engineering-hub .stat-num {
    font-size: 2.5rem;
  }

  .pain-point-card {
    padding: 30px 20px;
  }

  .blog-card {
    padding: 15px !important;
  }

  .blog-img img {
    height: 180px !important;
  }

  .blog-title {
    font-size: 1.15rem !important;
  }

  .blog-excerpt {
    font-size: 0.9rem !important;
    -webkit-line-clamp: 2 !important;
  }
}

/* ==========================================================================
   BLOG & GLOBAL RESPONSIVE FIXES (max-width: 991.98px)
   ========================================================================== */
@media (max-width: 991.98px) {

  /* Homepage Blog Stacking */
  #blog .row>div {
    width: 50% !important;
    flex: 0 0 50% !important;
    max-width: 50% !important;
  }

  #blog .d-flex.justify-content-between {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 30px !important;
  }

  #blog .section-padding {
    padding-bottom: 120px !important;
    /* Extra space for floating buttons */
  }

  .post-header h1.display-3 {
    font-size: 2.5rem !important;
    padding: 0 15px;
  }

  .blog-main-img {
    height: 350px !important;
  }

  .newsletter-premium-wrap {
    overflow: hidden !important;
  }

  .blog-content-wrap {
    padding: 30px 25px !important;
  }
}

@media (max-width: 767.98px) {

  /* Homepage Blog Stacking Mobile */
  #blog .row>div {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  .post-header h1.display-3 {
    font-size: 2rem !important;
  }

  .blog-main-img {
    height: 280px !important;
  }

  .blog-content-wrap {
    padding: 25px 20px !important;
  }

  .section-padding {
    padding: 60px 0;
  }
}

@media (max-width: 575.98px) {

  .hero-impact {
    padding-top: 120px;
    padding-bottom: 60px;
  }

  .hero-impact .avail-badge {
    margin-bottom: 1.5rem;
  }

  .hero-impact h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
  }

  .hero-impact .subtitle {
    margin: 0 auto 2rem;
    font-size: 1rem;
  }

  .service-hero img {
    height: auto;
  }

  .pricing-table .price-tag {
    font-size: 2.5rem;
  }

  .service-hero,
  section.bg-soft.mt-5 {
    padding-top: 120px;
    padding-bottom: 60px;
  }

  .post-header h1.display-3 {
    font-size: 1.6rem !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .blog-content-wrap {
    padding: 20px 15px !important;
    border-radius: 20px !important;
  }

  .blog-main-img {
    height: 200px !important;
    margin-bottom: 15px !important;
  }

  .blog-post-content {
    font-size: 1rem !important;
  }

  .blog-post-content h2 {
    font-size: 1.4rem !important;
  }

  .share-box {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 15px !important;
    padding-top: 30px !important;
  }

  .btn-whatsapp {
    --pulse-spread: 8px;
    font-size: 1.5rem;
  }

  .newsletter-premium-wrap {
    padding: 35px 15px !important;
    border-radius: 24px !important;
  }

  .newsletter-premium-wrap h2.display-5 {
    font-size: 1.8rem !important;
  }

  .newsletter-decoration-plane {
    font-size: 2rem !important;
  }

  .newsletter-premium-wrap .position-absolute.top-0.end-0 {
    padding: 1.5rem !important;
  }

  .contact-form-wrap {
    padding: 30px 20px;
    border-radius: 20px;
  }

  .form-control {
    padding: 12px 15px;
    border-radius: 10px;
    font-size: 15px;
  }

  /* Premium Portfolio Cards Mobile */
  .ppc-title {
    font-size: 1.2rem !important;
  }

  .ppc-result-box {
    padding: 15px !important;
  }

  /* Premium Pagination Mobile */
  .pagination-premium .page-link {
    width: 38px !important;
    height: 38px !important;
    font-size: 0.9rem !important;
    border-radius: 10px !important;
  }

  .pagination-premium .page-item {
    margin: 0 2px !important;
  }

  /* Footer & Social Mobile */

  .footer-copyright {
    margin-top: 30px;
    justify-content: center !important;
    gap: 10px !important;
    padding: 15px;
  }

  .social-icon-premium {
    width: 38px !important;
    height: 38px !important;
  }

  footer .d-flex.gap-2.mt-4 {
    gap: 15px !important;
  }

  /* Global Gaps & Spacing Mobile */
  .section-padding {
    padding: 60px 0;
  }

  .row.g-5 {
    --bs-gutter-y: 2rem !important;
  }

  .row.g-4 {
    --bs-gutter-y: 1rem !important;
    /* Reduced from 1.5rem */
  }

  .process-timeline-wrap {
    margin-top: 10px !important;
    padding-top: 0 !important;
  }

  .process-step-premium {
    margin-bottom: 0 !important;
    /* Ensure no extra margin */
  }

  .engineering-hub {
    border-radius: 20px;
  }

  .pricing-table .pricing-card {
    border-radius: 20px;
    padding: 40px 30px;
  }

  .section-label {
    font-size: 0.6rem;
  }

  .section-cta-premium {
    padding: 40px 20px;
    border-radius: 20px;
  }

  .faq-item {
    padding: 0;
  }

  .faq-item .accordion-button {
    font-size: 18px !important;
    line-height: 24px;
  }

}