/**
 * P4 Books - 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;
    }
}

/* ============================================
   COMPARISON TABLES - MOBILE RESPONSIVE
   ============================================ */

/* Make comparison tables horizontally scrollable on mobile */
.comparison-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobile: Small phones (320px - 575px) */
@media (max-width: 575px) {
    /* Comparison table mobile adjustments */
    .comparison-table table {
        min-width: 500px;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 0.5rem !important;
        font-size: 0.85rem !important;
    }

    .comparison-table th:first-child {
        min-width: 150px;
    }

    /* Reduce check icon sizes on mobile */
    .check-yes,
    .check-no,
    .check-partial {
        font-size: 1rem !important;
    }

    /* Fix section min-heights on mobile */
    section[style*="min-height"] {
        min-height: auto !important;
    }

    /* Advantage cards - stack on mobile */
    .advantage-card {
        margin-bottom: 1rem;
    }

    /* Winner badge smaller on mobile */
    .winner-badge {
        font-size: 0.6rem !important;
        padding: 0.15rem 0.4rem !important;
    }
}

/* Tablet: 576px - 767px */
@media (min-width: 576px) and (max-width: 767px) {
    .comparison-table th,
    .comparison-table td {
        padding: 0.6rem !important;
        font-size: 0.9rem !important;
    }

    .check-yes,
    .check-no,
    .check-partial {
        font-size: 1.1rem !important;
    }
}

/* ============================================
   FOOTER REDESIGN - P4 Blue Gradient
   ============================================ */

.footer-redesign {
    background: linear-gradient(135deg, #0A5FAD 0%, #073d73 100%);
    color: #FFFFFF;
    position: relative;
}

.footer-content {
    padding: 4rem 0 2rem;
}

/* Column Headings */
.footer-redesign h4 {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    color: #FFFFFF;
}

/* Reset list styles */
.footer-redesign ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-redesign li {
    margin-bottom: 0.5rem;
}

/* Links */
.footer-redesign a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 2;
    transition: color 0.3s ease;
}

.footer-redesign a:hover {
    color: #FBAD48;
}

/* Logo */
.footer-logo {
    height: 120px;
    max-width: 100%;
    margin-bottom: 1.5rem;
}

/* Description */
.footer-description {
    font-size: 0.875rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1.5rem;
    max-width: 350px;
}

/* Social Icons */
.social-icons {
    display: flex;
    gap: 0.5rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.social-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-size: 1.125rem;
    transition: all 0.3s ease;
    text-decoration: none;
}

.social-icon:hover {
    background: #FBAD48;
    color: #FFFFFF;
    transform: translateY(-2px);
}

/* Language Switcher */
.footer-lang-switcher {
    margin-top: 1.5rem;
}

.footer-lang-switcher .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.3);
    color: #FFFFFF;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.footer-lang-switcher .btn-outline-light.active {
    background: #FFFFFF;
    color: #0A5FAD;
    border-color: #FFFFFF;
}

.footer-lang-switcher .btn-outline-light:hover {
    border-color: #FBAD48;
    color: #FBAD48;
    background: transparent;
}

.footer-lang-switcher .btn-outline-light.active:hover {
    background: #FFFFFF;
    color: #0A5FAD;
}

/* Contact Info Items */
.contact-info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.contact-info-item i {
    color: #FBAD48;
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

/* Bottom Bar */
.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem 0;
}

.footer-bottom p {
    margin: 0;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Bottom Bar Links (Grupo Barrdega) */
.footer-bottom a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-bottom a:hover {
    color: #FBAD48;
    text-decoration: none;
}

/* Back to Top Button (Desktop) */
.back-to-top-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1.5rem;
    border-radius: 0.375rem;
    background: transparent;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
}

.back-to-top-btn:hover {
    background: #FBAD48;
    border-color: #FBAD48;
    color: #FFFFFF;
    transform: translateY(-2px);
}

/* Back to Top Mobile (Fixed) */
.back-to-top-mobile {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    border-radius: 50%;
    background: rgba(10, 95, 173, 0.9);
    color: #FFFFFF;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.back-to-top-mobile.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top-mobile:hover {
    background: #FBAD48;
    transform: translateY(-2px);
}

/* Touch Device Optimizations for Footer */
@media (hover: none) and (pointer: coarse) {
    .social-icon:hover {
        transform: none;
    }

    .social-icon:active {
        background: #FBAD48;
        transform: scale(0.95);
    }

    .back-to-top-btn:hover {
        transform: none;
    }

    .back-to-top-btn:active {
        background: #FBAD48;
        transform: scale(0.98);
    }
}

/* Footer Responsive Breakpoints */

/* Tablet (768-1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .footer-content {
        padding: 3rem 0 1.5rem;
    }

    .footer-redesign h4 {
        margin-top: 1rem;
    }

    .footer-logo {
        height: 105px;
    }
}

/* Small Tablet (576-767px) */
@media (min-width: 576px) and (max-width: 767px) {
    .footer-content {
        padding: 2.5rem 0 1.25rem;
    }

    .footer-redesign h4 {
        margin-top: 1.75rem;
    }

    .footer-logo {
        height: 96px;
    }

    .social-icons {
        gap: 0.75rem;
    }
}

/* Mobile (480-575px) */
@media (min-width: 480px) and (max-width: 575px) {
    .footer-content {
        padding: 2rem 0 1rem;
    }

    .footer-bottom {
        text-align: center;
        padding: 1.5rem 0;
    }

    .footer-redesign h4 {
        margin-top: 2rem;
        font-size: 0.95rem;
    }

    .footer-description,
    .social-icons,
    .footer-lang-switcher {
        margin-left: auto;
        margin-right: auto;
        text-align: center;
        justify-content: center;
    }

    .contact-info-item {
        justify-content: center;
    }

    .footer-logo {
        height: 90px;
    }
}

/* Small Mobile (320-479px) */
@media (min-width: 320px) and (max-width: 479px) {
    .footer-content {
        padding: 1.5rem 0 0.75rem;
    }

    .footer-bottom {
        text-align: center;
        padding: 1.25rem 0;
    }

    .footer-bottom .row > div {
        margin-bottom: 1rem;
    }

    .footer-bottom .row > div:last-child {
        margin-bottom: 0;
    }

    .footer-redesign h4 {
        margin-top: 1.75rem;
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .footer-redesign a {
        font-size: 0.85rem;
        line-height: 2.2;
    }

    .footer-description {
        font-size: 0.8rem;
        margin-bottom: 1rem;
    }

    .social-icons {
        gap: 0.625rem;
        margin: 1.25rem 0;
    }

    .social-icon {
        width: 44px;
        height: 44px;
    }

    .footer-description,
    .social-icons,
    .footer-lang-switcher {
        margin-left: auto;
        margin-right: auto;
        text-align: center;
        justify-content: center;
    }

    .contact-info-item {
        justify-content: center;
        font-size: 0.85rem;
    }

    .footer-logo {
        height: 84px;
    }

    .footer-bottom p {
        font-size: 0.75rem;
    }

    .back-to-top-mobile {
        bottom: 15px;
        right: 15px;
        width: 48px;
        height: 48px;
    }
}

/* Extra Small (<320px) */
@media (max-width: 319px) {
    .footer-content {
        padding: 1rem 0 0.5rem;
    }

    .footer-redesign h4 {
        font-size: 0.85rem;
    }

    .footer-redesign a {
        font-size: 0.8rem;
    }

    .footer-logo {
        height: 76px;
    }
}

/* Focus Styles for Footer Accessibility */
.footer-redesign a:focus,
.social-icon:focus,
.footer-lang-switcher .btn-outline-light:focus,
.back-to-top-btn:focus,
.back-to-top-mobile:focus {
    outline: 2px solid #FBAD48;
    outline-offset: 2px;
}
