/* Responsive Utilities for Process IT Website */

/* Mobile-first responsive breakpoints */
@media (max-width: 640px) {
    /* Small mobile devices */
    .container-custom {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Ensure text doesn't overflow */
    .text-responsive {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    /* Stack buttons vertically on small screens */
    .btn-stack-mobile {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    /* Full width buttons on mobile */
    .btn-full-mobile {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    
    /* Hide elements on mobile */
    .hide-mobile {
        display: none !important;
    }
    
    /* Smaller text on mobile */
    .text-sm-mobile {
        font-size: 0.875rem;
    }
    
    /* Reduce padding on mobile */
    .p-reduced-mobile {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    /* Tablet and small screens */
    
    /* Ensure forms are mobile-friendly */
    .form-mobile {
        width: 100%;
    }
    
    .form-mobile input,
    .form-mobile select,
    .form-mobile textarea {
        width: 100%;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Stack grid items on mobile */
    .grid-stack-mobile {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    
    /* Responsive tables */
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-responsive table {
        min-width: 600px;
    }
    
    /* Card layouts for mobile */
    .card-mobile {
        margin-bottom: 1rem;
        border-radius: 0.5rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    /* Navigation improvements */
    .nav-mobile {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    
    /* Hero section adjustments */
    .hero-mobile {
        padding-top: 2rem;
        padding-bottom: 2rem;
        text-align: center;
    }
    
    .hero-mobile h1 {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    .hero-mobile p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 1024px) {
    /* Tablet landscape and smaller laptops */
    
    /* Adjust container padding */
    .container-custom {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    /* Sidebar adjustments */
    .sidebar-mobile {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }
    
    .sidebar-mobile.open {
        transform: translateX(0);
    }
    
    /* Content adjustments when sidebar is hidden */
    .content-full {
        margin-left: 0;
        width: 100%;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Touch devices */
    
    /* Larger touch targets */
    .touch-target {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem;
    }
    
    /* Remove hover effects on touch devices */
    .no-touch-hover:hover {
        transform: none;
        box-shadow: none;
    }
    
    /* Better button spacing for touch */
    .btn-touch {
        padding: 0.875rem 1.5rem;
        margin: 0.25rem;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Crisp images on retina displays */
    .img-retina {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 500px) {
    /* Short landscape screens (like phones in landscape) */
    .hero-landscape {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    
    .nav-landscape {
        padding: 0.5rem 0;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-full-width {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Ensure text is readable when printed */
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
        background: #fff;
    }
    
    /* Remove shadows and gradients for print */
    * {
        box-shadow: none !important;
        text-shadow: none !important;
        background-image: none !important;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    /* Respect user's motion preferences */
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-color-scheme: dark) {
    /* Dark mode support (if needed in future) */
    .dark-mode-ready {
        /* Placeholder for dark mode styles */
    }
}

/* Focus improvements for keyboard navigation */
.focus-visible:focus-visible {
    outline: 2px solid #875A7B;
    outline-offset: 2px;
    border-radius: 0.25rem;
}

/* Utility classes for responsive design */
.responsive-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .responsive-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .responsive-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Responsive text sizing */
.text-responsive-xl {
    font-size: 1.5rem;
}

@media (min-width: 640px) {
    .text-responsive-xl {
        font-size: 2rem;
    }
}

@media (min-width: 1024px) {
    .text-responsive-xl {
        font-size: 2.5rem;
    }
}

/* Responsive spacing */
.space-responsive {
    margin-bottom: 1rem;
}

@media (min-width: 640px) {
    .space-responsive {
        margin-bottom: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .space-responsive {
        margin-bottom: 2rem;
    }
}

/* Image responsiveness */
.img-responsive {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Video responsiveness */
.video-responsive {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.video-responsive iframe,
.video-responsive object,
.video-responsive embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Newsletter form responsiveness */
.newsletter-responsive {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 640px) {
    .newsletter-responsive {
        flex-direction: row;
        align-items: center;
    }
    
    .newsletter-responsive input {
        flex: 1;
    }
    
    .newsletter-responsive button {
        flex-shrink: 0;
    }
}

/* Admin panel mobile improvements */
.admin-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: white;
    border-bottom: 1px solid #e5e7eb;
}

@media (min-width: 768px) {
    .admin-mobile-header {
        display: none;
    }
}

/* Loading states for mobile */
.loading-mobile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
}

.loading-mobile svg {
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
}

/* Error states for mobile */
.error-mobile {
    padding: 1rem;
    border-radius: 0.5rem;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    font-size: 0.875rem;
    text-align: center;
}

/* Success states for mobile */
.success-mobile {
    padding: 1rem;
    border-radius: 0.5rem;
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
    font-size: 0.875rem;
    text-align: center;
}
