/**
 * SOLENACT - Responsive CSS
 * Styles personnalisés pour améliorer le responsive sur tous les appareils
 */

/* ============================================
   MOBILE FIRST - Base styles
   ============================================ */

/* Touch-friendly tap targets */
@media (max-width: 768px) {
    button, a, input[type="submit"], input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* Improve form inputs on mobile */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px !important; /* Prevent zoom on iOS */
        padding: 12px 16px;
    }

    /* Better spacing on mobile */
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Card spacing */
    .card-hover {
        margin-bottom: 16px;
    }

    /* Make sure images don't overflow */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Fix for sticky sidebar on mobile */
    .sticky {
        position: relative !important;
        top: auto !important;
    }

    /* Better modal display on mobile */
    .modal {
        max-width: 95vw;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* Improve table responsiveness */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

/* ============================================
   LANDSCAPE MODE - Mobile/Tablet
   ============================================ */

@media (max-width: 896px) and (orientation: landscape) {
    /* Reduce hero section height in landscape */
    .hero-section {
        padding-top: 40px !important;
        padding-bottom: 40px !important;
    }

    /* Adjust font sizes */
    h1 {
        font-size: 2rem !important;
    }

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

/* ============================================
   TABLET - iPad, Android Tablets
   ============================================ */

@media (min-width: 768px) and (max-width: 1024px) {
    /* Grid adjustments for tablets */
    .grid-cols-1.md\\:grid-cols-2.xl\\:grid-cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Sidebar width on tablet */
    .lg\\:w-1\\/4 {
        width: 33.333333%;
    }

    .lg\\:w-3\\/4 {
        width: 66.666667%;
    }
}

/* ============================================
   LARGE SCREENS - Desktop
   ============================================ */

@media (min-width: 1280px) {
    .container {
        max-width: 1280px;
    }
}

@media (min-width: 1536px) {
    .container {
        max-width: 1400px;
    }
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

/* Focus styles for keyboard navigation */
*:focus {
    outline: 2px solid #1e40af;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@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;
    }
}

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

@media print {
    /* Hide unnecessary elements when printing */
    nav, .navbar, footer, .sidebar, .mobile-menu, button, .no-print {
        display: none !important;
    }

    /* Optimize for printing */
    body {
        background: white;
        color: black;
    }

    a {
        text-decoration: underline;
    }

    /* Show URLs after links */
    a[href]:after {
        content: " (" attr(href) ")";
    }
}

/* ============================================
   SPECIFIC COMPONENT FIXES
   ============================================ */

/* Blog/Activities Grid - Better responsive */
@media (max-width: 640px) {
    .blog-grid {
        grid-template-columns: 1fr;
    }

    /* Stack sidebar on mobile */
    .sidebar-wrapper {
        order: 2;
        width: 100%;
        margin-top: 2rem;
    }

    .main-content {
        order: 1;
        width: 100%;
    }
}

/* Hero sections - Better mobile display */
@media (max-width: 768px) {
    .hero-section {
        padding-top: 60px;
        padding-bottom: 60px;
    }

    .hero-section h1 {
        font-size: 2rem;
        line-height: 1.2;
    }

    .hero-section p {
        font-size: 1rem;
    }
}

/* Navbar improvements */
@media (max-width: 1024px) {
    /* Mobile menu full width */
    #mobile-menu {
        width: 100%;
    }

    /* Better logo sizing */
    .logo-img {
        max-height: 40px;
    }
}

/* Cards - Better touch targets and spacing */
.card-hover {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

@media (hover: hover) {
    .card-hover:hover {
        transform: translateY(-5px);
    }
}

/* Safe area for iOS notch */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }

    .container {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
}

/* Form improvements */
@media (max-width: 768px) {
    form .grid {
        grid-template-columns: 1fr;
    }

    form .grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

/* Pagination - Better mobile display */
@media (max-width: 640px) {
    .pagination nav {
        flex-wrap: wrap;
        gap: 8px;
    }

    .pagination a,
    .pagination span {
        min-width: 40px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Modal improvements for mobile */
@media (max-width: 768px) {
    .modal-content {
        width: 95vw;
        max-height: 85vh;
        margin: 20px auto;
    }

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

/* Text readability */
@media (max-width: 768px) {
    /* Optimal line length for readability */
    article p,
    .content p {
        max-width: 100%;
    }

    /* Better text sizing */
    .text-sm {
        font-size: 0.875rem;
    }

    .text-base {
        font-size: 1rem;
    }
}

/* Utility classes for responsive images */
.img-responsive {
    max-width: 100%;
    height: auto;
    display: block;
}

.img-cover {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

/* Aspect ratio utilities */
.aspect-video {
    aspect-ratio: 16 / 9;
}

.aspect-square {
    aspect-ratio: 1 / 1;
}

/* Better scroll behavior on iOS */
.overflow-scroll,
.overflow-auto {
    -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar but keep functionality */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}
