/**
 * Reparico.hr - Responsive Stylesheet
 * Mobile-first breakpoints and optimizations
 */

/* ========================================
   BREAKPOINTS
   ======================================== */
/*
   Mobile: < 600px (default, mobile-first)
   Tablet: 600px - 899px
   Desktop: 900px - 1199px
   Large Desktop: 1200px+
*/

/* ========================================
   TABLET (600px+)
   ======================================== */
@media (min-width: 600px) {
    /* Typography adjustments */
    html {
        font-size: 17px;
    }
    
    /* Container padding */
    .container {
        padding: 0 30px;
    }
    
    /* Header improvements */
    .site-header {
        padding: 0;
    }
    
    .header-content {
        padding: 20px 30px;
    }
    
    .site-logo img,
    .site-logo svg {
        height: 55px;
    }
    
    /* Hero adjustments */
    .hero {
        min-height: 80vh;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero .tagline {
        font-size: 1.3rem;
    }
    
    /* Service cards - 2 columns */
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
    
    .service-card {
        padding: 35px;
    }
    
    /* Gallery - 2 columns */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
    
    /* Contact form grid */
    .contact-grid {
        gap: 50px;
    }
    
    /* Footer - 2 columns */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 40px;
    }
    
    /* Before/After slider larger */
    .ba-handle-circle {
        width: 60px;
        height: 60px;
    }
    
    .ba-labels {
        top: 25px;
        left: 25px;
        right: 25px;
    }
    
    .ba-label {
        padding: 12px 24px;
        font-size: 15px;
    }
}

/* ========================================
   DESKTOP (768px+)
   ======================================== */
@media (min-width: 768px) {
    /* Typography */
    html {
        font-size: 18px;
    }
    
    h1 {
        font-size: 2.5rem;
    }
    
    h2 {
        font-size: 2rem;
    }
    
    /* Spacing increase */
    .section {
        padding: 80px 0;
    }
    
    /* Header becomes horizontal */
    .header-content {
        padding: 20px 40px;
    }
    
    .main-nav {
        display: flex;
    }
    
    .header-phone {
        display: flex;
    }
    
    /* Hero full screen */
    .hero {
        min-height: 100vh;
    }
    
    .hero h1 {
        font-size: 3rem;
        margin-bottom: 25px;
    }
    
    .hero .tagline {
        font-size: 1.4rem;
        margin-bottom: 40px;
    }
    
    .hero-buttons {
        gap: 20px;
    }
    
    /* Service cards enhanced */
    .service-card {
        padding: 40px;
    }
    
    .service-icon {
        font-size: 56px;
    }
    
    .service-card h3 {
        font-size: 1.4rem;
    }
    
    /* Contact form side-by-side */
    .contact-grid {
        grid-template-columns: 1fr 1fr;
        gap: 60px;
    }
    
    /* Lightbox controls larger */
    .lightbox-close,
    .lightbox-prev,
    .lightbox-next {
        width: 60px;
        height: 60px;
        font-size: 35px;
    }
    
    /* Stats grid improvements */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   LARGE DESKTOP (900px+)
   ======================================== */
@media (min-width: 900px) {
    /* Container max-width active */
    .container {
        max-width: 1200px;
        padding: 0 40px;
    }
    
    /* Service cards - 3 columns */
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }
    
    /* Gallery - 3 columns */
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 35px;
    }
    
    /* Footer - 4 columns */
    .footer-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Stats - 4 columns */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========================================
   EXTRA LARGE (1200px+)
   ======================================== */
@media (min-width: 1200px) {
    html {
        font-size: 18px;
    }
    
    .container {
        max-width: 1400px;
    }
    
    /* Hero adjustments */
    .hero h1 {
        font-size: 3.5rem;
    }
    
    .hero .tagline {
        font-size: 1.5rem;
    }
    
    /* Service cards more spacing */
    .services-grid {
        gap: 35px;
    }
    
    /* Gallery 4 columns on very large screens */
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 40px;
    }
}

/* ========================================
   MOBILE LANDSCAPE OPTIMIZATIONS
   ======================================== */
@media (max-height: 600px) and (orientation: landscape) {
    /* Hero takes less vertical space */
    .hero {
        min-height: auto;
        padding: 100px 0 60px;
    }
    
    .hero h1 {
        font-size: 2rem;
        margin-bottom: 15px;
    }
    
    .hero .tagline {
        font-size: 1rem;
        margin-bottom: 20px;
    }
    
    .hero-buttons .btn {
        padding: 12px 25px;
        font-size: 14px;
    }
    
    /* Lightbox adjustments */
    .lightbox-image-container {
        max-height: 70vh;
    }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn {
        padding: 16px 36px;
        min-height: 48px;
    }
    
    .form-control {
        padding: 16px 20px;
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    .main-nav a {
        padding: 18px 20px;
        min-height: 48px;
    }
    
    /* Remove hover effects on touch devices */
    .service-card:hover {
        transform: none;
    }
    
    .gallery-item:hover {
        transform: none;
    }
    
    .gallery-item:hover .gallery-img {
        transform: none;
    }
    
    /* Increase Before/After handle size */
    .ba-handle-circle {
        width: 70px;
        height: 70px;
    }
}

/* ========================================
   HIGH DPI / RETINA DISPLAYS
   ======================================== */
@media (-webkit-min-device-pixel-ratio: 2), 
       (min-resolution: 192dpi) {
    /* Sharper borders */
    .service-card,
    .gallery-item,
    .form-control {
        border-width: 0.5px;
    }
    
    /* Better shadows */
    .service-card:hover {
        box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    }
}

/* ========================================
   PRINT OPTIMIZATIONS
   ======================================== */
@media print {
    /* Hide interactive elements */
    .site-header,
    .mobile-action-bar,
    .btn,
    .menu-toggle,
    .lightbox,
    .service-filter,
    .gallery-filter {
        display: none !important;
    }
    
    /* Optimize for paper */
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    /* Page breaks */
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    .service-card,
    .gallery-item {
        page-break-inside: avoid;
    }
    
    /* Remove shadows and colors */
    .service-card,
    .gallery-item {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    /* URLs visible */
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 80%;
        color: #666;
    }
}

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

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 20px;
    background: var(--color-primary);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    z-index: 10000;
    transition: top 0.3s;
}

.skip-to-content:focus {
    top: 20px;
}

/* Reduced motion support */
@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;
    }
    
    .animate-on-scroll {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .service-card {
        border: 2px solid var(--color-text-main);
    }
    
    .form-control {
        border: 2px solid var(--color-text-main);
    }
}

/* Dark mode support (if implemented) */
@media (prefers-color-scheme: dark) {
    :root {
        --color-bg-light: #1a1d29;
        --color-bg-gray: #252834;
        --color-text-main: #e8eaed;
        --color-text-muted: #9aa0a6;
    }
    
    body {
        background: var(--color-bg-light);
        color: var(--color-text-main);
    }
    
    .site-header {
        background: var(--color-bg-gray);
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }
    
    .service-card,
    .gallery-item,
    .contact-section {
        background: var(--color-bg-gray);
        border-color: #3c4043;
    }
    
    .form-control {
        background: var(--color-bg-gray);
        color: var(--color-text-main);
        border-color: #3c4043;
    }
}

/* ========================================
   ULTRA-WIDE SCREENS (1920px+)
   ======================================== */
@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }
    
    /* Gallery 5 columns */
    .gallery-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    /* Stats 4 columns (keep readable) */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 1400px;
        margin: 0 auto;
    }
}

/* ========================================
   SMALL MOBILE (< 375px)
   ======================================== */
@media (max-width: 374px) {
    html {
        font-size: 14px;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .hero h1 {
        font-size: 1.6rem;
    }
    
    .hero .tagline {
        font-size: 1rem;
    }
    
    .service-card,
    .contact-section {
        padding: 20px;
    }
    
    .ba-label {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .ba-handle-circle {
        width: 40px;
        height: 40px;
    }
}

/* ========================================
   INTERNET EXPLORER 11 FALLBACKS
   ======================================== */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
    /* IE11 doesn't support CSS Grid well */
    .services-grid,
    .gallery-grid,
    .contact-grid,
    .footer-grid {
        display: flex;
        flex-wrap: wrap;
    }
    
    .services-grid > *,
    .gallery-grid > *,
    .footer-grid > * {
        flex: 0 0 calc(33.333% - 20px);
        margin: 10px;
    }
    
    /* IE11 doesn't support CSS variables */
    body {
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        color: #333333;
    }
    
    .btn-primary {
        background: #ff6b00;
        color: #ffffff;
    }
}

/* ========================================
   SAFARI-SPECIFIC FIXES
   ======================================== */
@supports (-webkit-appearance: none) {
    /* Fix iOS Safari input zoom */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    textarea {
        font-size: 16px;
    }
    
    /* Fix Safari flex gap on older versions */
    @supports not (gap: 20px) {
        .services-grid > * {
            margin: 10px;
        }
        
        .services-grid {
            margin: -10px;
        }
    }
}

/* ========================================
   FIREFOX-SPECIFIC FIXES
   ======================================== */
@-moz-document url-prefix() {
    /* Firefox scrollbar styling */
    * {
        scrollbar-width: thin;
        scrollbar-color: var(--color-primary) var(--color-bg-gray);
    }
}

/* ========================================
   EDGE CASES & IMPROVEMENTS
   ======================================== */

/* No JavaScript fallback */
.no-js .animate-on-scroll {
    opacity: 1;
    transform: none;
}

.no-js .mobile-action-bar {
    display: flex;
}

/* Slow connection indicator */
.slow-connection-warning {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--color-warning);
    color: #000;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9998;
    animation: slideInRight 0.5s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
    }
    to {
        transform: translateX(0);
    }
}

/* Loading state */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid var(--color-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

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

/* GPU acceleration for animations */
.service-card,
.gallery-item,
.btn,
.ba-handle {
    will-change: transform;
}

/* Optimize hover states */
@media (hover: hover) {
    .service-card:hover,
    .gallery-item:hover {
        transform: translateY(-5px);
    }
}

/* Lazy load optimization */
img[loading="lazy"] {
    content-visibility: auto;
}
