/**
 * P4 Warehouse - 100% Responsive Compliance
 * ==========================================
 * Comprehensive responsive breakpoints and optimizations
 * for all screen sizes from 320px to 4K displays
 *
 * Breakpoints:
 * - 320px: Small phones (iPhone SE, Galaxy S series)
 * - 480px: Larger phones (landscape)
 * - 576px: Small tablets / large phones
 * - 768px: Tablets (iPad portrait)
 * - 1024px: Tablets landscape / small laptops
 * - 1200px: Desktop
 * - 1440px: Large desktop
 * - 1920px: Full HD displays
 *
 * Version: 1.0.0
 * Last Updated: January 2026
 */

/* ============================================
   RESPONSIVE BREAKPOINT SYSTEM
   ============================================ */

/*
 * Extra Small Devices (320px - 479px)
 * Small phones: iPhone SE, Galaxy S8, etc.
 */
@media (max-width: 479px) {
    /* Typography - Scale down for small screens */
    body {
        font-size: 14px !important;
    }

    .section-title,
    h1,
    .h1,
    .display-1 {
        font-size: var(--text-4xl-fluid) !important;
        line-height: 1.2 !important;
    }

    h2,
    .h2,
    .display-2 {
        font-size: var(--text-3xl-fluid) !important;
        line-height: 1.25 !important;
    }

    h3,
    .h3 {
        font-size: var(--text-2xl-fluid) !important;
    }

    h4,
    .h4 {
        font-size: var(--text-xl-fluid) !important;
    }

    h5,
    .h5 {
        font-size: var(--text-lg-fluid) !important;
    }

    /* Hero Section Adjustments */
    .hero-section {
        min-height: 70vh !important;
        padding: var(--space-12) 0 !important;
    }

    .hero-section h1 {
        font-size: 2rem !important;
        margin-bottom: 1rem !important;
    }

    .hero-section .fs-5 {
        font-size: 0.9rem !important;
    }

    /* Max-width fixes for very small screens */
    [style*="max-width: 600px"] {
        max-width: 100% !important;
        padding: 0 0.5rem !important;
    }

    /* Feature Icons - Responsive sizing */
    .feature-icon {
        width: var(--icon-lg) !important;
        height: var(--icon-lg) !important;
        font-size: 1.5rem !important;
    }

    /* Stats - Smaller on tiny screens */
    .stat-number {
        font-size: 2rem !important;
    }

    /* Section Spacing */
    .section-spacing {
        padding: 40px 0 !important;
    }

    /* Buttons - Full width on small screens */
    .btn-lg {
        padding: 0.75rem 1.5rem !important;
        font-size: 0.95rem !important;
        width: 100%;
        margin-bottom: 0.75rem;
    }

    .d-flex.gap-3 {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    /* Navigation */
    .navbar-brand img {
        height: 32px !important;
    }

    /* Cards */
    .card {
        margin-bottom: 1rem;
    }

    .feature-card {
        padding: 1.25rem !important;
    }

    /* Video Containers */
    .ratio.ratio-16x9 {
        margin-bottom: 1rem;
    }

    /* Container Padding */
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Client Logos */
    .client-logo {
        height: 40px !important;
    }

    /* Badge Premium */
    .badge-premium {
        font-size: 0.75rem !important;
        padding: 0.375rem 1rem !important;
    }
}

/*
 * Small Devices (480px - 575px)
 * Larger phones landscape
 */
@media (min-width: 480px) and (max-width: 575px) {
    .section-title {
        font-size: var(--text-5xl-fluid) !important;
    }

    .hero-section {
        min-height: 75vh !important;
    }

    .feature-icon {
        width: var(--icon-xl) !important;
        height: var(--icon-xl) !important;
    }

    .btn-lg {
        width: auto;
    }

    .stat-number {
        font-size: 2.5rem !important;
    }
}

/*
 * Medium Devices (576px - 767px)
 * Large phones / Small tablets
 */
@media (min-width: 576px) and (max-width: 767px) {
    .section-title {
        font-size: var(--text-5xl-fluid) !important;
    }

    .hero-section {
        min-height: 80vh !important;
    }

    .feature-icon {
        width: var(--icon-xl) !important;
        height: var(--icon-xl) !important;
    }

    .stat-number {
        font-size: 2.75rem !important;
    }

    .section-spacing {
        padding: 60px 0 !important;
    }

    /* Improve grid on small tablets */
    .col-6.col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/*
 * Tablets (768px - 1023px)
 * iPad portrait, Android tablets
 */
@media (min-width: 768px) and (max-width: 1023px) {
    .section-title {
        font-size: var(--text-6xl-fluid) !important;
    }

    .hero-section {
        min-height: 85vh !important;
    }

    .hero-section h1 {
        font-size: 3.5rem !important;
    }

    .feature-icon {
        width: var(--icon-2xl) !important;
        height: var(--icon-2xl) !important;
    }

    .stat-number {
        font-size: 3.25rem !important;
    }

    .section-spacing {
        padding: 80px 0 !important;
    }

    /* Optimize 3-column layouts for tablets */
    .col-lg-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    /* Client logos - 3 per row on tablets */
    .col-6.col-md-3 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
}

/*
 * Tablets Landscape / Small Laptops (1024px - 1199px)
 * iPad landscape, Surface, small laptops
 */
@media (min-width: 1024px) and (max-width: 1199px) {
    .container {
        max-width: 960px;
    }

    .section-title {
        font-size: var(--text-6xl-fluid) !important;
    }

    .hero-section h1 {
        font-size: 3.75rem !important;
    }

    .feature-icon {
        width: var(--icon-feature) !important;
        height: var(--icon-feature) !important;
    }

    .stat-number {
        font-size: 3.5rem !important;
    }

    .section-spacing {
        padding: 100px 0 !important;
    }
}

/*
 * Desktop (1200px - 1439px)
 * Standard desktop screens
 */
@media (min-width: 1200px) and (max-width: 1439px) {
    .container {
        max-width: 1140px;
    }

    .section-title {
        font-size: var(--text-7xl-fluid) !important;
    }

    .hero-section h1 {
        font-size: 4rem !important;
    }

    .feature-icon {
        width: 140px !important;
        height: 140px !important;
    }

    .section-spacing {
        padding: 120px 0 !important;
    }
}

/*
 * Large Desktop (1440px - 1919px)
 * Large monitors
 */
@media (min-width: 1440px) and (max-width: 1919px) {
    .container {
        max-width: 1320px;
    }

    .section-title {
        font-size: var(--text-7xl-fluid) !important;
    }

    .hero-section h1 {
        font-size: 4.5rem !important;
    }
}

/*
 * Full HD and Above (1920px+)
 * 4K displays, ultra-wide monitors
 */
@media (min-width: 1920px) {
    .container {
        max-width: 1536px;
    }

    .section-title {
        font-size: 5rem !important;
    }

    .hero-section h1 {
        font-size: 5rem !important;
    }

    /* Prevent excessive line lengths */
    .hero-section p {
        max-width: 700px !important;
    }

    /* Larger feature icons on huge screens */
    .feature-icon {
        width: 160px !important;
        height: 160px !important;
    }
}

/* ============================================
   RESPONSIVE IMAGES
   ============================================ */

/* Ensure all images are responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Logo responsive sizing */
.navbar-brand img {
    height: clamp(32px, 3vw, 40px);
}

/* Client logos */
.client-logo {
    height: clamp(40px, 4vw, 60px);
    width: auto;
}

/* ============================================
   RESPONSIVE CONTAINERS
   ============================================ */

/* Ensure proper padding on all screen sizes */
@media (max-width: 575px) {
    .container,
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (min-width: 576px) and (max-width: 767px) {
    .container,
    .container-fluid {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */

/* Text alignment utilities for different screens */
@media (max-width: 767px) {
    .text-md-start {
        text-align: center !important;
    }

    .text-md-center {
        text-align: center !important;
    }

    /* Stack flex items on mobile */
    .flex-md-row {
        flex-direction: column !important;
    }

    /* Full width cards on mobile */
    .card {
        margin-bottom: 1.5rem;
    }
}

/* ============================================
   RESPONSIVE SPACING
   ============================================ */

/* Adjust gaps and margins for mobile */
@media (max-width: 767px) {
    .mb-5 {
        margin-bottom: 2rem !important;
    }

    .mb-4 {
        margin-bottom: 1.5rem !important;
    }

    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    /* Reduce gap utilities */
    .gap-4 {
        gap: 1rem !important;
    }

    .gap-3 {
        gap: 0.75rem !important;
    }
}

/* ============================================
   RESPONSIVE NAVIGATION
   ============================================ */

/* Mobile menu improvements */
@media (max-width: 991px) {
    .navbar-collapse {
        margin-top: 1rem;
    }

    .navbar-nav {
        gap: 0.5rem;
    }

    .nav-item {
        text-align: center;
    }

    .nav-item .btn {
        width: 100%;
        margin-top: 0.5rem;
    }

    /* Language switcher on mobile */
    .btn-group {
        width: 100%;
        margin-top: 0.5rem;
    }

    .btn-group .btn {
        flex: 1;
    }
}

/* ============================================
   RESPONSIVE FORMS
   ============================================ */

@media (max-width: 767px) {
    .form-control,
    .form-select {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }

    .form-group,
    .mb-3 {
        margin-bottom: 1rem !important;
    }
}

/* ============================================
   RESPONSIVE VIDEOS
   ============================================ */

/* Ensure video embeds are responsive */
.ratio {
    position: relative;
    width: 100%;
}

.ratio::before {
    display: block;
    padding-top: var(--bs-aspect-ratio, 56.25%);
    content: "";
}

.ratio > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Adjust video layout on mobile */
@media (max-width: 991px) {
    .col-lg-8,
    .col-lg-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .video-card {
        margin-bottom: 1.5rem;
    }
}

/* ============================================
   RESPONSIVE TABLES
   ============================================ */

/* Make tables scroll horizontally on small screens */
@media (max-width: 767px) {
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 0.875rem;
    }

    table th,
    table td {
        white-space: nowrap;
        padding: 0.5rem;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Reduce animations on mobile for performance */
@media (max-width: 767px) {
    * {
        animation-duration: 0.5s !important;
    }

    [data-aos] {
        transition-duration: 0.4s !important;
    }

    /* Disable parallax on mobile */
    .parallax {
        background-attachment: scroll !important;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

/* Larger touch targets for mobile */
@media (hover: none) and (pointer: coarse) {
    a,
    button,
    .btn {
        min-height: 44px; /* iOS recommended touch target */
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .nav-link {
        padding: 0.75rem 1rem;
    }

    /* Remove hover effects on touch devices */
    .card:hover,
    .btn:hover,
    .feature-card:hover {
        transform: none !important;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    /* Hide non-essential elements */
    .navbar,
    .btn,
    .badge,
    footer,
    .modal,
    [data-aos],
    .cookie-consent {
        display: none !important;
    }

    /* Optimize for print */
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }

    .container {
        max-width: 100%;
    }

    /* Ensure content fits on page */
    .section-spacing {
        padding: 1rem 0 !important;
    }

    /* Page breaks */
    h1,
    h2,
    h3 {
        page-break-after: avoid;
    }

    img {
        page-break-inside: avoid;
    }
}
