/* ========================================================================
   COMPREHENSIVE RESPONSIVE CSS FOR DIGICOMPANY WEBSITE
   Author: DigiCompany Development Team
   Last Updated: 2025
   Description: Mobile-first responsive design for all pages
   ======================================================================== */

/* ========================================================================
   TABLE OF CONTENTS
   1. Base Responsive Utilities
   2. Header & Navigation (Mobile)
   3. Footer (Mobile)
   4. Homepage Sections
   5. Product Pages
   6. Forms (Contact & Demo)
   7. About & Team Pages
   8. Tablet Specific (768px - 1024px)
   9. Mobile Specific (320px - 767px)
   ======================================================================== */

/* ========================================================================
   1. BASE RESPONSIVE UTILITIES
   ======================================================================== */

/* Prevent horizontal scroll on mobile - CRITICAL FIX */
html {
    overflow-x: hidden !important;
    width: 100% !important;
}

body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure all elements use border-box sizing */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Prevent specific containers from causing overflow */
.container-fluid {
    max-width: 100vw;
    overflow-x: hidden;
}

/* Responsive container adjustments */
@media (max-width: 767px) {
    .container-fluid {
        padding-left: 15px !important;
        padding-right: 15px !important;
        max-width: 100vw !important;
    }
    
    .container {
        max-width: 100% !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    .row {
        margin-right: 0 !important;
        margin-left: 0 !important;
        padding: 20px 0 !important;
        max-width: 100% !important;
    }
    
    /* Fix for inline padding styles */
    .row[style*="padding"] {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    /* Remove excessive padding on mobile */
    .pl-5, .px-5 {
        padding-left: 15px !important;
    }

    .pr-5, .px-5 {
        padding-right: 15px !important;
    }

    .pt-5 {
        padding-top: 20px !important;
    }

    .pb-5 {
        padding-bottom: 20px !important;
    }

    .mt-5, .my-5 {
        margin-top: 30px !important;
    }

    .mb-5, .my-5 {
        margin-bottom: 30px !important;
    }
}

/* Responsive typography */
@media (max-width: 767px) {
    h1 {
        font-size: 1.75rem !important;
        line-height: 1.3 !important;
    }

    h2 {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
        padding: 1.5rem 0 0.5rem 0 !important;
    }

    h3 {
        font-size: 1.3rem !important;
    }

    h4 {
        font-size: 1.1rem !important;
    }

    h5 {
        font-size: 1rem !important;
    }

    p, .corporate-text {
        font-size: 0.95rem !important;
        line-height: 1.5rem !important;
    }
}

/* ========================================================================
   2. HEADER & NAVIGATION (MOBILE)
   ======================================================================== */

@media (max-width: 991px) {
    /* Navbar adjustments */
    .navbar {
        padding: 10px 15px;
    }

    .navbar-brand img {
        max-width: 150px;
        padding-left: 0 !important;
    }

    /* Mobile menu styling */
    .navbar-collapse {
        background-color: #fff;
        padding: 20px;
        margin-top: 10px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        border-radius: 8px;
    }

    .navbar-nav {
        flex-direction: column !important;
        width: 100%;
    }

    .navbar-nav li {
        width: 100%;
        margin-bottom: 10px;
    }

    .navbar-nav .nav-link {
        padding: 12px 0;
        font-size: 1rem;
        border-bottom: 1px solid #f0f0f0;
    }

    /* Dropdown menus on mobile */
    .dropdown-menu {
        position: static !important;
        float: none;
        width: 100%;
        margin: 0 !important;
        border: none;
        box-shadow: none;
        background-color: #f8f9fa;
        padding-left: 20px;
    }

    .dropdown-item {
        padding: 10px 15px;
        font-size: 0.95rem;
    }

    /* Mobile buttons */
    .navbar .btn {
        width: 100%;
        margin-top: 10px;
        padding: 12px;
    }
    
    /* Fix: Add spacing between Try It and Login buttons in hamburger menu */
    .navbar-nav li.nav-item.dropdown {
        margin-bottom: 15px !important;
    }
    
    .navbar-nav li.nav-item.dropdown:last-child {
        margin-bottom: 0 !important;
    }

    /* Fixed navbar on mobile */
    .navbar.fixed-top {
        position: fixed;
        top: 0;
        width: 100%;
        z-index: 1030;
    }

    .top {
        height: 70px; /* Adjust for fixed navbar */
    }
}

@media (max-width: 767px) {
    .navbar-brand img {
        max-width: 120px;
    }
}

/* ========================================================================
   3. FOOTER (MOBILE)
   ======================================================================== */

@media (max-width: 991px) {
    footer .row {
        padding: 20px 15px !important;
    }

    footer .row > div[class*="col"] {
        margin-bottom: 30px;
        padding-left: 15px !important;
    }

    footer .footer-logo {
        width: 180px !important;
        max-width: 80% !important;
        margin-bottom: 20px;
    }

    footer .office-address {
        font-size: 0.9rem;
    }

    footer .office-text {
        margin-top: 15px;
        font-weight: 600;
    }

    footer h5 {
        margin-top: 25px;
        margin-bottom: 15px;
    }

    footer ul {
        padding-left: 20px !important;
        margin-left: 0 !important;
    }

    footer .request-demo-btn {
        margin-top: 20px !important;
        margin-bottom: 20px !important;
    }

    footer .request-demo-btn .btn {
        width: 100%;
        padding: 12px;
    }

    footer .copyright {
        margin-top: 20px;
        padding-top: 20px;
    }
}

@media (max-width: 767px) {
    footer .col-sm-3, 
    footer .col-sm-4,
    footer .col-sm-2 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
}

/* ========================================================================
   4. HOMEPAGE SECTIONS
   ======================================================================== */

/* Banner Section */
@media (max-width: 991px) {
    .banner .row {
        flex-direction: column-reverse;
    }

    .banner .col-sm-5,
    .banner .col-sm-7 {
        width: 100%;
        max-width: 100%;
        padding: 20px 15px;
        text-align: center;
    }

    .banner h1 {
        font-size: 1.5rem !important;
        margin-top: 20px;
    }

    .banner p {
        font-size: 1rem !important;
        line-height: 1.6rem !important;
    }

    .banner img {
        max-width: 100%;
        height: auto;
        margin-bottom: 20px;
    }
}

/* Corporate Success Section */
@media (max-width: 991px) {
    .container-corporate-success .row {
        flex-direction: column;
    }

    .container-corporate-success .col-sm-3 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        border-right: none !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.3);
        padding: 30px 20px !important;
    }

    .container-corporate-success .col-sm-3:last-child {
        border-bottom: none;
    }

    .custom-col-line::after {
        display: none;
    }

    .corporate-text {
        font-size: 1.4rem !important;
    }

    .small-image {
        width: 80px !important;
        height: auto !important;
    }
}

/* Laws We Cover Section */
/* Desktop: add left margin for alignment */
.laws-container {
    margin-left: 40px;
}

@media (max-width: 991px) {
    /* Mobile: remove left margin to prevent overflow */
    .laws-container {
        margin-left: 0 !important;
        padding-left: 0 !important;
    }
    
    .laws .law {
        flex-direction: column !important;
        align-items: center;
    }

    .laws .card {
        width: 90% !important;
        max-width: 350px !important;
        margin: 15px auto !important;
    }
    
    /* Fix for m-5 margins causing overflow */
    .laws .card.m-5 {
        margin: 15px 10px !important;
    }

    .laws .width-responsive {
        width: 100% !important;
        max-width: 100% !important;
    }

    .laws .custom-col-2 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

@media (max-width: 585px) {
    .laws {
        margin-left: 0 !important;
        padding: 0 10px;
    }

    .laws .text-center {
        margin-left: 0 !important;
    }

    .laws .card {
        width: 95% !important;
        margin: 10px auto !important;
    }
    
    /* Override Bootstrap m-5 margins completely on small screens */
    .laws .card.m-5 {
        margin: 10px 5px !important;
    }
}

/* Critical fix for all pages - prevent excessive margins */
@media (max-width: 767px) {
    /* Override large Bootstrap margins that cause overflow */
    .m-5 {
        margin: 1rem !important;
    }
    
    .mx-5, .m-5 {
        margin-left: 0.5rem !important;
        margin-right: 0.5rem !important;
    }
    
    .my-5, .m-5 {
        margin-top: 1rem !important;
        margin-bottom: 1rem !important;
    }
    
    /* Specific fix for cards with large margins */
    .card.m-5 {
        margin: 1rem 0.5rem !important;
        width: calc(100% - 1rem) !important;
        max-width: calc(100vw - 2rem) !important;
    }
    
    /* Ensure text-center divs don't have excessive left margin */
    .text-center[style*="margin-left"] {
        margin-left: 0 !important;
    }
}

/* Products Section */
@media (max-width: 991px) {
    .container-info-2 .row {
        flex-direction: column;
    }

    .container-info-2 .col-sm-6,
    .container-info-2 .col-sm-4 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        margin-bottom: 20px;
    }
    
    /* Fix: Products section columns on mobile */
    .container-info-2 .col-sm-3 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        margin-bottom: 25px !important;
        padding: 15px !important;
    }
    
    /* Fix: Ensure text wraps properly and doesn't overflow white boxes */
    .container-info-2 .col-sm-3 p {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
        max-width: 100% !important;
        padding: 10px 15px !important;
        font-size: 1rem !important;
        line-height: 1.6 !important;
    }
    
    .container-info-2 .inner-image {
        max-width: 200px !important;
        height: auto !important;
        margin: 0 auto 15px auto !important;
        display: block !important;
    }

    .product-section {
        padding: 20px 10px !important;
    }

    .card-overlay {
        padding: 20px 15px !important;
        margin-bottom: 15px !important;
    }

    .background-image {
        height: auto !important;
        min-height: 100%;
    }
}

/* Clients Section */
@media (max-width: 991px) {
    .client-logos {
        flex-wrap: wrap;
        justify-content: center !important;
    }

    .client-logos img {
        width: 120px !important;
        height: auto !important;
        margin: 10px !important;
    }
    
    /* Fix: Stack client logos vertically on mobile instead of side-by-side */
    .carousel-item .row {
        flex-direction: column !important;
        align-items: center !important;
    }
    
    .carousel-item .row .col-4 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        margin-bottom: 20px !important;
        text-align: center !important;
    }
    
    /* Ensure carousel images fit properly on mobile */
    .carousel-item .row .col-4 img {
        max-width: 250px !important;
        width: auto !important;
        height: auto !important;
        margin: 0 auto !important;
        display: block !important;
    }
    
    /* Fix carousel height for stacked logos */
    .carousel-inner .rows {
        min-height: auto !important;
    }
    
    /* Add spacing between stacked logos */
    .sliding .carousel-item .row .col-4:last-child {
        margin-bottom: 0 !important;
    }
}

/* Stats Section */
@media (max-width: 991px) {
    .stats-section .row {
        flex-direction: column;
    }

    .stats-section .col-sm-3 {
        width: 100% !important;
        margin-bottom: 30px;
        text-align: center;
    }

    .stats-section h1 {
        font-size: 2.5rem !important;
    }
}

/* Testimonials */
@media (max-width: 991px) {
    .testimonial-card {
        margin: 10px auto !important;
        max-width: 90%;
    }

    .carousel-indicators {
        bottom: -30px;
    }
}

/* Recent Upgrades */
@media (max-width: 991px) {
    .recent-upgrades .row {
        flex-direction: column-reverse;
    }

    .recent-upgrades .col-sm-6 {
        width: 100% !important;
        padding: 20px 15px;
    }

    .recent-upgrades img {
        max-width: 100%;
        height: auto;
    }
}

/* ========================================================================
   5. PRODUCT PAGES (Compliance, Meetings, Registers, etc.)
   ======================================================================== */

@media (max-width: 991px) {
    /* Product hero sections */
    .product-hero {
        padding: 40px 20px !important;
    }

    .product-hero .row {
        flex-direction: column;
    }

    .product-hero .col-sm-6,
    .product-hero .col-sm-7,
    .product-hero .col-sm-5 {
        width: 100% !important;
        max-width: 100% !important;
        text-align: center;
        padding: 20px 15px;
    }

    .product-hero img {
        max-width: 100%;
        height: auto;
        margin: 20px 0;
    }

    /* Product features */
    .product-features .row {
        flex-direction: column;
    }

    .product-features .col-sm-4,
    .product-features .col-sm-6 {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 20px;
    }

    .feature-card {
        margin: 10px 0 !important;
        padding: 20px 15px !important;
    }

    /* Benefits section */
    .benefits-section .row {
        flex-direction: column;
    }

    .benefits-section .col-sm-4,
    .benefits-section .col-sm-6 {
        width: 100% !important;
        margin-bottom: 20px;
    }
}

/* ========================================================================
   6. FORMS (Contact & Demo)
   ======================================================================== */

@media (max-width: 991px) {
    /* Demo form container */
    .demo-container {
        flex-direction: column !important;
        margin: 0 !important;
        padding: 15px !important;
    }

    .demo-left-section,
    .demo-right-section {
        width: 100% !important;
        max-width: 100% !important;
        padding: 20px 15px !important;
        margin: 0 !important;
    }

    .demo-left-section {
        border-right: none !important;
        border-bottom: 2px solid #e0e0e0;
        padding-bottom: 30px !important;
    }

    /* Form fields */
    .form-group {
        margin-bottom: 20px;
    }

    .form-control {
        font-size: 16px !important; /* Prevents iOS zoom */
        padding: 12px;
    }

    textarea.form-control {
        min-height: 120px;
    }

    /* Form buttons */
    .form-group button,
    .form-group .btn {
        width: 100%;
        padding: 14px;
        font-size: 1rem;
    }

    /* Contact page specific */
    .contact-info {
        margin-bottom: 30px;
    }

    .contact-info .row {
        flex-direction: column;
    }

    .contact-info .col-sm-6 {
        width: 100% !important;
        margin-bottom: 20px;
    }
}

@media (max-width: 585px) {
    .demo-container {
        margin: 0 0.5rem !important;
    }

    .form-group label {
        font-size: 0.95rem;
    }
}

/* ========================================================================
   7. ABOUT & TEAM PAGES
   ======================================================================== */

@media (max-width: 991px) {
    /* About page */
    .about-section .row {
        flex-direction: column;
    }

    .about-section .col-sm-6 {
        width: 100% !important;
        max-width: 100% !important;
        padding: 20px 15px;
    }

    .about-section img {
        max-width: 100%;
        height: auto;
        margin: 20px 0;
    }

    /* Team page */
    .team-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .team-member-card {
        margin: 10px auto !important;
        max-width: 350px;
    }

    .team-member-card img {
        width: 100%;
        height: auto;
    }

    /* Founders section */
    .founders-section .row {
        flex-direction: column;
    }

    .founders-section .col-sm-6 {
        width: 100% !important;
        margin-bottom: 30px;
    }
}

/* ========================================================================
   8. TABLET SPECIFIC (768px - 1024px)
   ======================================================================== */

@media (min-width: 768px) and (max-width: 1024px) {
    /* Adjust columns for tablet */
    .col-sm-3 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    .col-sm-4 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    .col-sm-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* Navbar on tablet */
    .navbar-brand img {
        max-width: 160px;
    }

    /* Product cards on tablet */
    .laws .card {
        width: 45% !important;
        margin: 15px !important;
    }

    /* Stats on tablet */
    .stats-section .col-sm-3 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
}

/* ========================================================================
   9. MOBILE SPECIFIC (320px - 767px)
   ======================================================================== */

@media (max-width: 767px) {
    /* All columns full width on mobile */
    [class*="col-"] {
        padding-left: 15px;
        padding-right: 15px;
    }

    .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, 
    .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, 
    .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* Images responsive */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Cards full width */
    .card {
        margin: 10px 0 !important;
    }

    /* Buttons full width */
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }

    /* Remove side margins */
    .ml-5, .mx-5 {
        margin-left: 15px !important;
    }

    .mr-5, .mx-5 {
        margin-right: 15px !important;
    }
    
    /* Additional fix: Ensure carousel items in clients section stack properly */
    .sliding .carousel-item .row {
        padding: 20px 15px !important;
    }
    
    .sliding .carousel-item .row .col-4 {
        padding: 15px 10px !important;
    }
    
    /* Fix: Products section container padding on small mobile */
    .container-info-2 .product-section {
        padding: 15px 10px !important;
    }
    
    .container-info-2 .col-sm-3 {
        padding: 10px !important;
    }
    
    .container-info-2 .col-sm-3 p {
        padding: 5px 10px !important;
        font-size: 0.95rem !important;
    }
}

/* Extra small devices (320px - 480px) */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    h1 {
        font-size: 1.5rem !important;
    }

    h2 {
        font-size: 1.3rem !important;
    }

    .container-fluid {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    /* Smaller padding for very small screens */
    .p-5 {
        padding: 15px !important;
    }
}

/* ========================================================================
   10. MOBILE APP POPUP
   ======================================================================== */

@media (max-width: 767px) {
    .mobile-app-popup {
        width: 95% !important;
        max-width: 95% !important;
        padding: 15px !important;
    }

    .mobile-app-inner {
        flex-direction: column !important;
    }

    .promo-text,
    .promo-image {
        width: 100% !important;
        text-align: center;
    }

    .promo-text h4 {
        font-size: 1.3rem !important;
    }

    .promo-text p {
        font-size: 0.95rem !important;
    }

    .promo-image img {
        max-width: 200px !important;
        margin-top: 20px;
    }
}

/* ========================================================================
   11. ADDITIONAL FIXES
   ======================================================================== */

/* Fix for modals on mobile */
@media (max-width: 767px) {
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .modal-content {
        border-radius: 8px;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 15px;
    }
}

/* Fix for tables on mobile */
@media (max-width: 767px) {
    .table-responsive {
        border: 0;
    }

    table {
        font-size: 0.85rem;
    }
}

/* Custom Alert Modal - Responsive */
@media (max-width: 767px) {
    #customAlertModal .modal-body {
        padding: 20px 15px;
    }

    #customAlertModal h2 {
        font-size: 1.3rem !important;
    }

    #customAlertModal p {
        font-size: 0.95rem !important;
    }

    #customAlertModal .modal-close-btn {
        padding: 10px 30px;
        font-size: 0.95rem;
    }
}

/* Landscape orientation fixes */
@media (max-width: 767px) and (orientation: landscape) {
    .navbar {
        padding: 5px 10px;
    }

    .top {
        height: 60px;
    }

    .banner {
        margin-top: 60px;
    }
}

/* Print styles - prevent breaking */
@media print {
    .navbar,
    .footer,
    .mobile-app-popup {
        display: none !important;
    }

    body {
        font-size: 12pt;
    }

    .container-fluid {
        width: 100%;
        max-width: 100%;
    }
}

/* ========================================================================
   12. SMOOTH SCROLLING & TRANSITIONS
   ======================================================================== */

@media (max-width: 991px) {
    /* Smooth collapse animations */
    .navbar-collapse {
        transition: all 0.3s ease-in-out;
    }

    /* Smooth card hover effects */
    .card {
        transition: transform 0.2s ease;
    }

    .card:active {
        transform: scale(0.98);
    }

    /* Smooth button press effect */
    .btn:active {
        transform: scale(0.96);
    }
}

/* ========================================================================
   END OF RESPONSIVE CSS
   ======================================================================== */

