/* ==========================================================
   RESPONSIVE.CSS - Complete Cross-Device Optimization
   Covers: 320px to 2560px+ | Mobile-First Approach
   ========================================================== */

/* ---------- CSS Variables & Breakpoint Reference ----------
   2XL (Large Desktop):  >=1920px
   XL  (Desktop):        1600-1919px
   LG  (Laptop):         1366-1599px
   MD  (Small Laptop):   1024-1365px
   SM  (Tablet):         768-1023px (Bootstrap md breakpoint)
   XS  (Mobile):         576-767px
   XXS (Small Mobile):   360-575px
   XXXS (Tiny):          <360px
   -------------------------------------------------------- */

/* ---------- 1. FLUID TYPOGRAPHY (Mobile-First) ---------- */
html { font-size: 14px; }
@media (min-width: 576px) { html { font-size: 15px; } }
@media (min-width: 768px) { html { font-size: 15.5px; } }
@media (min-width: 1200px) { html { font-size: 16px; } }
@media (min-width: 1600px) { html { font-size: 17px; } }
@media (min-width: 1920px) { html { font-size: 18px; } }

h1, .h1 { font-size: clamp(1.75rem, 5vw, 3.5rem); }
h2, .h2 { font-size: clamp(1.4rem, 3.5vw, 2.5rem); }
h3, .h3 { font-size: clamp(1.15rem, 2.5vw, 1.75rem); }
h4, .h4 { font-size: clamp(1rem, 2vw, 1.35rem); }
h5, .h5 { font-size: clamp(0.9rem, 1.5vw, 1.1rem); }
h6, .h6 { font-size: clamp(0.8rem, 1.2vw, 0.95rem); }
p, .text-content { font-size: clamp(0.85rem, 1.1vw, 1rem); }

/* ---------- 2. RESPONSIVE CONTAINER ---------- */
.container { padding-left: max(12px, 3vw); padding-right: max(12px, 3vw); }
@media (min-width: 1920px) { .container { max-width: 1600px; } }
@media (min-width: 1600px) and (max-width: 1919px) { .container { max-width: 1400px; } }

/* ---------- 3. RESPONSIVE GAPS ---------- */
.gap-responsive { gap: clamp(8px, 2vw, 24px); }

/* Tablet to Laptop (992-1199px) - scrollable nav + mobile toggle fallback */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .main-nav { justify-content: flex-start; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -ms-overflow-style: none; }
    .main-nav::-webkit-scrollbar { display: none; }
    .main-nav .nav-link { padding: 6px 8px !important; font-size: 0.75rem; white-space: nowrap; gap: 3px !important; }
    .main-nav .nav-link i { font-size: 0.7rem; }
    .main-nav .nav-arrow { font-size: 7px; }
    .main-nav-list { gap: 1px; flex-wrap: nowrap; }
    .header-actions .action-btn { width: 30px; height: 30px; font-size: 0.8rem; }
    .site-logo img { height: 30px; }
    .site-logo-text { font-size: 15px; }
    .mega-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
    .mega-card { padding: 12px; }
    .mega-card h4 { font-size: 0.85rem; }
    .mega-card p { font-size: 0.75rem; }
    .mega-card-img { height: 100px; }
    .mega-dropdown { padding: 20px !important; }
    .mega-header h3 { font-size: 1.1rem; }
    .software-menu-group-title { font-size: 0.85rem; }
    .software-menu-list a { font-size: 0.8rem; padding: 4px 0; }
    .top-bar { font-size: 12px; }
}
@media (min-width: 1200px) and (max-width: 1439.98px) {
    .main-nav { justify-content: flex-start; }
    .main-nav .nav-link { padding: 6px 8px !important; font-size: 0.75rem; white-space: nowrap; gap: 3px !important; }
    .main-nav .nav-link i { font-size: 0.7rem; }
    .main-nav .nav-arrow { font-size: 7px; }
    .main-nav-list { gap: 1px; flex-wrap: nowrap; }
}

/* ---------- 5. RESPONSIVE HERO ---------- */
@media (max-width: 767.98px) {
    .hero-premium { padding: 100px 0 40px; min-height: auto; }
    .hero-premium h1 { font-size: clamp(1.5rem, 6vw, 2rem); }
    .hero-dashboard-card { display: none; }
    .hero-premium-actions { flex-direction: column; gap: 10px; }
    .hero-premium-actions .btn { width: 100%; }
    .hero-premium-actions .btn-lg { padding: 12px 24px; font-size: 0.95rem; }
    .hero-search-box { flex-direction: column; gap: 8px; }
    .hero-search-box .search-select { width: 100%; }
    .hero-stats-premium { flex-direction: column; gap: 16px; }
    .hero-stat-item { text-align: center; }
}
@media (max-width: 575.98px) {
    .hero-premium { padding: 80px 0 30px; }
    .hero-float-icon { display: none !important; }
    .hero-dashboard-preview { display: none; }
}

/* ---------- 6. RESPONSIVE MEGA MENU ---------- */
@media (max-width: 1199.98px) {
    .mega-dropdown:not(.services-mega):not(.portfolio-mega) { 
        min-width: 90vw !important;
        max-width: 95vw !important;
    }
}
@media (max-width: 767.98px) {
    .mega-dropdown { position: static !important; transform: none !important; box-shadow: none; border-radius: 0; min-width: auto !important; }
    .mega-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
    .mega-card-img { height: 80px; }
    .mega-header { flex-direction: column; gap: 8px; text-align: center; }
}
@media (max-width: 575.98px) {
    .mega-grid { grid-template-columns: 1fr !important; }
}

/* ---------- 7. RESPONSIVE SECTIONS ---------- */
.section { padding: clamp(40px, 8vw, 100px) 0; }
.section-title { font-size: clamp(1.3rem, 4vw, 2.2rem); }
.section-subtitle { font-size: clamp(0.85rem, 1.5vw, 1.1rem); }
@media (max-width: 767.98px) {
    .section-title { margin-bottom: 24px; }
    .page-header-premium { padding: 80px 0 30px; }
    .page-header-premium h1 { font-size: clamp(1.4rem, 5vw, 1.8rem); }
}

/* ---------- 8. RESPONSIVE CARDS ---------- */
.industry-card, .software-card, .pricing-card, .blog-card {
    margin-bottom: clamp(12px, 2vw, 24px);
}
@media (max-width: 767.98px) {
    .industry-card-3d { transform: none !important; }
    .pricing-card-premium.featured { transform: none; }
    .pricing-card-premium.featured:hover { transform: translateY(-4px); }
    .pricing-card-premium .card-body { padding: 1.5rem; }
}
@media (min-width: 1200px) and (max-width: 1365px) {
    .industry-card-3d .card-body { padding: 1.25rem; }
    .industry-card-3d h5 { font-size: 0.95rem; }
}

/* ---------- 9. RESPONSIVE FORMS ---------- */
@media (max-width: 767.98px) {
    .form-premium .form-control,
    .form-premium .form-select { padding: 12px 16px; font-size: 16px; height: auto; }
    .form-premium .btn { padding: 12px 24px; font-size: 16px; width: 100%; }
    .input-group .btn { padding: 12px 16px; }
}
@media (max-width: 575.98px) {
    form .row > [class*="col-"] { margin-bottom: 12px; }
}

/* ---------- 10. RESPONSIVE TABLES ---------- */
.table-responsive-stack {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -12px;
    padding: 0 12px;
}
.table-responsive-stack::-webkit-scrollbar { height: 4px; }
.table-responsive-stack::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
@media (max-width: 767.98px) {
    .table { font-size: 0.8rem; }
    .table td, .table th { padding: 8px 10px; white-space: nowrap; }
    .table .btn-sm { padding: 4px 8px; font-size: 0.75rem; }
}

/* Card-based table fallback for very small screens */
@media (max-width: 575.98px) {
    .table-card-view thead { display: none; }
    .table-card-view tbody tr {
        display: block;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 12px;
        margin-bottom: 12px;
        background: #fff;
    }
    .table-card-view tbody tr td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border: none;
        white-space: normal;
        gap: 8px;
    }
    .table-card-view tbody tr td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        color: #64748b;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .table-card-view td:last-child { border-bottom: none; }
}

/* ---------- 11. RESPONSIVE STAT CARDS ---------- */
@media (max-width: 767.98px) {
    .stat-card-premium { padding: 1rem; }
    .stat-card-premium .stat-number { font-size: clamp(1.25rem, 4vw, 1.75rem); }
}
@media (max-width: 575.98px) {
    .stats-row .col-6 { margin-bottom: 12px; }
}

/* ---------- 12. RESPONSIVE FOOTER ---------- */
@media (max-width: 767.98px) {
    .footer-main { padding: 40px 0 20px; }
    .footer-widget { margin-bottom: 24px; }
    .footer-widget h4 { margin-bottom: 12px; }
    .footer-logo { font-size: 1rem; }
    .footer-bottom { text-align: center; }
    .footer-bottom .text-end { text-align: center !important; margin-top: 8px; }
    .footer-bottom-links { justify-content: center; flex-wrap: wrap; }
    .footer-contact-info p { font-size: 0.85rem; }
}
@media (max-width: 575.98px) {
    .footer-widget h4 { font-size: 0.95rem; }
    .footer-links li { margin-bottom: 6px; }
    .footer-links a { font-size: 0.85rem; }
    .newsletter-form .input-group { flex-direction: column; gap: 8px; }
    .newsletter-form .input-group .form-control { border-radius: 8px !important; }
    .newsletter-form .input-group .btn { border-radius: 8px !important; width: 100%; }
}

/* ---------- 13. RESPONSIVE SECTION PADDING ---------- */
@media (max-width: 991.98px) {
    .section { padding: 48px 0; }
}
@media (max-width: 767.98px) {
    .section { padding: 40px 0; }
}
@media (min-width: 1600px) {
    .section { padding: 100px 0; }
}
@media (min-width: 1920px) {
    .section { padding: 120px 0; }
}

/* ---------- 14. RESPONSIVE BUTTONS ---------- */
@media (max-width: 767.98px) {
    .btn { padding: 10px 20px; font-size: 0.9rem; }
    .btn-lg { padding: 14px 28px; font-size: 1rem; }
    .btn-sm { padding: 6px 14px; font-size: 0.8rem; }
    .btn-block-mobile { display: block; width: 100%; }
}
@media (min-width: 768px) and (max-width: 991.98px) {
    .btn { padding: 10px 18px; }
}

/* ---------- 15. RESPONSIVE TOOLBAR / TOP BAR ---------- */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .top-bar-link { font-size: 11px; margin-right: 10px; }
    .top-bar-dropdown-toggle { font-size: 11px; padding: 2px 8px; }
}

/* ---------- 16. RESPONSIVE BACK TO TOP ---------- */
@media (max-width: 991.98px) {
    .back-to-top { bottom: 80px; right: 16px; width: 40px; height: 40px; font-size: 0.9rem; }
}
@media (min-width: 1920px) {
    .back-to-top { bottom: 40px; right: 40px; width: 52px; height: 52px; font-size: 1.2rem; }
}

/* ---------- 17. RESPONSIVE MOBILE MENU IMPROVEMENTS ---------- */
@media (max-width: 575.98px) {
    .mobile-menu { width: 85vw; max-width: 320px; }
    .mobile-menu-header { padding: 12px 16px; }
    .mobile-menu-body { padding: 12px 16px; }
    .mobile-nav-list > li > a { padding: 10px 12px; font-size: 0.9rem; }
    .mobile-sub-list a { padding: 8px 12px 8px 36px; font-size: 0.85rem; }
    .mobile-menu-footer { padding: 12px 16px 20px; }
    .mobile-search-group input { font-size: 14px; padding: 10px 12px; }
}
@media (max-width: 360px) {
    .mobile-menu { width: 100vw; max-width: none; }
    .mobile-logo span { font-size: 0.9rem; }
}

/* ---------- 18. RESPONSIVE PRELOADER ---------- */
@media (max-width: 767.98px) {
    #preloader .loader span { font-size: 1rem; }
    #preloader .spinner { width: 36px; height: 36px; border-width: 3px; }
}

/* ---------- 19. RESPONSIVE SEARCH OVERLAY ---------- */
@media (max-width: 767.98px) {
    .search-overlay .search-container { padding: 60px 16px; }
    .search-overlay .search-input { font-size: 1.1rem; }
    .search-overlay .search-submit-btn { padding: 12px 20px; font-size: 0.9rem; }
}
@media (max-width: 575.98px) {
    .search-overlay .search-input-group { flex-direction: column; gap: 8px; }
    .search-overlay .search-input-icon { display: none; }
    .search-overlay .search-submit-btn { width: 100%; border-radius: 8px !important; }
}

/* ---------- 20. RESPONSIVE IMAGES ---------- */
img.fluid, .img-fluid { max-width: 100%; height: auto; }
@media (max-width: 767.98px) {
    .mega-card-img img,
    .industry-card img,
    .software-card img { width: 100%; height: auto; object-fit: cover; }
}
@media (min-width: 1920px) {
    .mega-card-img { height: 140px; }
}

/* ---------- 21. RESPONSIVE SOFTWARE DETAIL ---------- */
@media (max-width: 991.98px) {
    .sw-detail-hero { padding: 100px 0 30px; }
    .sw-detail-hero h1 { font-size: clamp(1.4rem, 4vw, 1.8rem); }
    .sw-detail-hero .price-display .current { font-size: clamp(1.5rem, 4vw, 2rem); }
    .sw-tab-nav { 
        position: relative !important;
        top: 0 !important;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        display: flex;
        flex-wrap: nowrap;
    }
    .sw-tab-nav .nav-link { 
        white-space: nowrap;
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    .sw-tab-nav::-webkit-scrollbar { height: 3px; }
    .purchase-box { position: static !important; margin-bottom: 20px; }
}
@media (max-width: 575.98px) {
    .sw-detail-hero { padding: 80px 0 20px; }
    .sw-gallery .gallery-item { width: 100%; }
    .sw-features-grid { grid-template-columns: 1fr; }
}

/* ---------- 22. RESPONSIVE PRICING ---------- */
@media (max-width: 991.98px) {
    .pricing-card-premium.featured { transform: none; margin-top: 0; }
    .pricing-card-premium .price-display .amount { font-size: clamp(1.8rem, 4vw, 2.5rem); }
}
@media (max-width: 767.98px) {
    .pricing-card-premium .card-body { padding: 1.5rem; }
    .pricing-card-premium .pricing-features li { font-size: 0.85rem; padding: 6px 0; }
}

/* ---------- 23. RESPONSIVE CONTACT ---------- */
@media (max-width: 575.98px) {
    .contact-info-card { text-align: center; }
    .contact-info-card .d-flex { flex-direction: column; align-items: center; }
}

/* ---------- 24. RESPONSIVE BLOG ---------- */
@media (max-width: 767.98px) {
    .blog-card-premium .card-body { padding: 1.25rem; }
    .blog-card-premium h5 { font-size: 1rem; }
    .blog-card-premium .blog-meta { font-size: 0.8rem; flex-wrap: wrap; }
}
@media (max-width: 575.98px) {
    .blog-card .card-img-top { height: 180px; }
}

/* ---------- 25. RESPONSIVE TESTIMONIALS ---------- */
@media (max-width: 767.98px) {
    .testimonial-card-premium { padding: 1.5rem; }
    .testimonial-card-premium .testimonial-text { font-size: 0.9rem; }
    .testimonial-card-premium .testimonial-author { font-size: 0.85rem; }
}

/* ---------- 26. RESPONSIVE PARTNER SLIDER ---------- */
@media (max-width: 767.98px) {
    .trusted-section { padding: 48px 0 56px; }
    .partner-track { gap: 14px; }
    .partner-item-premium { min-width: 170px; padding: 10px 14px; }
    .partner-item-premium img { height: 24px; }
    .partner-outline { padding: 9px 16px; font-size: 13px; }
}

/* ---------- 27. RESPONSIVE ACCORDION ---------- */
@media (max-width: 767.98px) {
    .accordion-premium .accordion-button { padding: 14px 16px; font-size: 0.9rem; }
    .accordion-premium .accordion-body { padding: 12px 16px; font-size: 0.85rem; }
}

/* ---------- 28. RESPONSIVE CATEGORIES / FILTER SIDEBAR ---------- */
@media (max-width: 991.98px) {
    .filter-sidebar { margin-bottom: 24px; }
}

/* ---------- 29. RESPONSIVE PAGE HEADERS ---------- */
@media (max-width: 767.98px) {
    .page-header { padding: 80px 0 30px; }
    .page-header h1 { font-size: clamp(1.4rem, 5vw, 2rem); }
    .page-header .breadcrumb { font-size: 0.85rem; }
}
@media (min-width: 1920px) {
    .page-header { padding: 140px 0 60px; }
}

/* ---------- 30. RESPONSIVE DARK MODE CONSISTENCY ---------- */
@media (prefers-color-scheme: dark) {
    [data-theme="auto"] { --bg-primary: #0a0e27; --bg-secondary: #12163a; --text-primary: #f1f5f9; --text-secondary: #94a3b8; --border-color: #1e293b; }
}

/* ---------- 31. ACCESSIBILITY ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.skip-link { position: absolute; top: -100px; left: 0; background: var(--primary); color: #fff; padding: 8px 16px; z-index: 10000; transition: top .2s; }
.skip-link:focus { top: 0; }

/* ---------- 32. RESPONSIVE GRID UTILITY ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(8px, 2vw, 24px); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(8px, 2vw, 24px); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(8px, 2vw, 24px); }
@media (max-width: 991.98px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 767.98px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
@media (min-width: 768px) and (max-width: 1199.98px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }

/* ---------- 33. RESPONSIVE EMBED / MEDIA ---------- */
.media-wrapper { position: relative; width: 100%; max-width: 100%; }
.media-wrapper iframe,
.media-wrapper video,
.media-wrapper object,
.media-wrapper embed { width: 100%; height: auto; aspect-ratio: 16/9; }

/* ---------- 34. RESPONSIVE ALERTS ---------- */
@media (max-width: 767.98px) {
    .alert { padding: 12px 16px; font-size: 0.85rem; }
}

/* ---------- 35. PRINT STYLES ---------- */
@media print {
    .header, .header-top, .main-header, .footer, .back-to-top,
    .mobile-menu, .mobile-overlay, .search-overlay, #preloader,
    .support-nav, .admin-sidebar, .admin-header, .sidebar-toggle,
    .btn, .action-btn, .cart-btn, .user-menu {
        display: none !important;
    }
    body { background: #fff !important; color: #000 !important; }
    .admin-main { margin-left: 0 !important; }
    .container { max-width: 100% !important; padding: 0 !important; }
    a { color: #000 !important; text-decoration: underline !important; }
    img { max-width: 100% !important; page-break-inside: avoid; }
    h1, h2, h3, h4 { page-break-after: avoid; }
}

/* ---------- 36. LARGE DESKTOP ENHANCEMENTS (1920px+) ---------- */
@media (min-width: 1920px) {
    .hero-premium { min-height: 700px; padding: 160px 0 80px; }
    .hero-premium h1 { font-size: 3.5rem; }
    .hero-dashboard-card { width: 480px; height: 320px; }
    .mega-dropdown { padding: 32px !important; min-width: 900px; }
    .mega-grid { gap: 20px; }
    .footer-main { padding: 80px 0 40px; }
}

/* ---------- 37. XL DESKTOP (1600-1919px) ---------- */
@media (min-width: 1600px) and (max-width: 1919.98px) {
    .hero-premium h1 { font-size: 3rem; }
    .mega-dropdown { min-width: 800px; }
}

/* ---------- 38. SMALL LAPTOP (1024-1199px) ---------- */
@media (min-width: 1024px) and (max-width: 1199.98px) {
    .header-actions .action-btn { width: 32px; height: 32px; font-size: 0.8rem; }
    .mega-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .mega-card { padding: 10px; }
    .mega-card h4 { font-size: 0.8rem; }
    .mega-card p { font-size: 0.72rem; }
    .mega-card-img { height: 90px; }
    .software-menu-list a { font-size: 0.78rem; }
}

/* ---------- 39. TINY SCREENS (<360px) ---------- */
@media (max-width: 359.98px) {
    html { font-size: 12px; }
    .container { padding-left: 8px; padding-right: 8px; }
    .site-logo-text { display: none; }
    .header-actions { gap: 4px; }
    .action-btn { width: 28px; height: 28px; font-size: 0.75rem; }
    .btn { padding: 8px 14px; font-size: 0.8rem; }
    .page-header { padding: 60px 0 20px; }
    .card-body { padding: 12px; }
}

/* ---------- 40. RESPONSIVE STICKY HEADER REFINEMENTS ---------- */
@media (max-width: 767.98px) {
    .main-header { padding: 0; }
    .main-header .container { padding-top: 8px; padding-bottom: 8px; }
    .main-header.header-transparent { background: rgba(255,255,255,0.95); }
    [data-theme="dark"] .main-header.header-transparent { background: rgba(10,14,39,0.95); }
}

/* ---------- 41. RESPONSIVE SPACING UTILITIES ---------- */
@media (max-width: 767.98px) {
    .mb-responsive { margin-bottom: 16px; }
    .mt-responsive { margin-top: 16px; }
    .py-responsive { padding-top: 16px; padding-bottom: 16px; }
    .px-responsive { padding-left: 12px; padding-right: 12px; }
}
@media (min-width: 768px) and (max-width: 991.98px) {
    .mb-responsive { margin-bottom: 20px; }
    .mt-responsive { margin-top: 20px; }
}
