/**
 * RESPONSIVE FIXES - Poprawki kontrastu, responsywności i spacing
 * Załącz ten plik po base.html styles
 *
 * @version 1.0
 * @date 2025-11-14
 * @description Poprawki wizualne dla pełnej responsywności i WCAG compliance
 */

/* ============================================
   1. KONTRAST FIXES (WCAG 2.1 Compliance)
   ============================================ */

/* Zwiększ kontrast na gradientach */
.hero-subheadline {
    opacity: 1 !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.final-cta-subtitle {
    opacity: 1 !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Lepszy kontrast dla gray-600 - improved from 4.8:1 to 7:1 */
:root {
    --gray-600: #57606a;
}

/* Footer links lepszy kontrast */
.footer-links a {
    color: rgba(255, 255, 255, 0.95) !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Footer copyright lepszy kontrast */
.footer-copyright,
.footer-badge {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Overlay na gradientach dla lepszej czytelności */
.hero-section::after,
.final-cta-section::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    pointer-events: none;
    z-index: 0;
}

.hero-content,
.final-cta-container {
    position: relative;
    z-index: 2;
}

/* ============================================
   2. RESPONSIVENESS FIXES
   ============================================ */

/* Fix navbar menu position - relative zamiast hardcoded */
@media (max-width: 768px) {
    .navbar-menu {
        top: 100% !important;
        margin-top: 0;
    }
}

/* Fix cart dropdown overflow na mobile */
@media (max-width: 480px) {
    .cart-dropdown {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        border-radius: 1rem 1rem 0 0 !important;
        top: auto !important;
        bottom: 0 !important;
        max-height: 80vh !important;
    }

    .cart-dropdown-body {
        max-height: calc(80vh - 200px) !important;
    }

    .cart-dropdown.active {
        transform: translateY(0) !important;
    }
}

/* Fluid typography używając clamp() */
.hero-headline {
    font-size: clamp(1.75rem, 4vw + 1rem, 4rem) !important;
}

.hero-subheadline {
    font-size: clamp(1rem, 2vw + 0.5rem, 1.5rem) !important;
}

.section-title {
    font-size: clamp(2rem, 3vw + 1rem, 3rem) !important;
}

.section-subtitle {
    font-size: clamp(0.95rem, 1.5vw + 0.5rem, 1.25rem) !important;
}

.final-cta-title {
    font-size: clamp(2rem, 4vw + 1rem, 3.5rem) !important;
}

.final-cta-subtitle {
    font-size: clamp(1.125rem, 2vw + 0.5rem, 1.5rem) !important;
}

/* Extra small breakpoint dla bardzo małych ekranów (320px-360px) */
@media (max-width: 360px) {
    .navbar-title {
        font-size: 1rem !important;
    }

    .navbar-logo {
        font-size: 1.25rem !important;
    }

    .cart-dropdown-toggle {
        width: 36px !important;
        height: 36px !important;
    }

    .navbar-container {
        padding: 0.75rem !important;
    }

    .hero-btn {
        font-size: 0.9375rem !important;
        padding: 0.875rem 1.75rem !important;
    }
}

/* Hide testimonial quote before element na małych ekranach */
@media (max-width: 768px) {
    .testimonial-quote::before {
        font-size: 3rem !important;
        top: -10px !important;
        left: -5px !important;
    }
}

@media (max-width: 480px) {
    .testimonial-quote::before {
        display: none !important;
    }
}

/* Lepszy footer grid na tablet (2 kolumny) */
@media (min-width: 481px) and (max-width: 768px) {
    .footer-top {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .footer-brand {
        grid-column: 1 / -1;
    }
}

/* Lepszy benefits/testimonials grid na tablet */
@media (min-width: 640px) and (max-width: 1024px) {
    .benefits-grid,
    .testimonials-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .steps-container {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Large desktop support - lepsze wykorzystanie przestrzeni */
@media (min-width: 1440px) {
    .hero-content,
    .stats-container,
    .benefits-container,
    .how-it-works-container,
    .testimonials-container,
    .seo-content-container {
        max-width: 1400px !important;
    }
}

@media (min-width: 1920px) {
    .hero-content,
    .stats-container,
    .benefits-container,
    .how-it-works-container,
    .testimonials-container,
    .seo-content-container {
        max-width: 1600px !important;
    }
}

/* ============================================
   3. SPACING FIXES
   ============================================ */

/* Unified card padding - consistency */
.stat-card,
.benefit-card {
    padding: 2.5rem !important;
}

.step-card,
.testimonial-card {
    padding: 3rem !important;
}

@media (max-width: 768px) {
    .stat-card,
    .benefit-card,
    .step-card,
    .testimonial-card {
        padding: 2rem !important;
    }
}

@media (max-width: 480px) {
    .stat-card,
    .benefit-card,
    .step-card,
    .testimonial-card {
        padding: 1.5rem !important;
    }
}

/* Responsive footer margin */
@media (max-width: 768px) {
    .footer {
        margin-top: 4rem !important;
    }
}

@media (max-width: 480px) {
    .footer {
        margin-top: 3rem !important;
    }
}

/* Consistent line-height dla lepszej czytelności */
.hero-headline,
.section-title,
.final-cta-title,
.step-title,
.benefit-title {
    line-height: 1.1 !important;
}

.hero-subheadline,
.section-subtitle,
.final-cta-subtitle,
.stat-label {
    line-height: 1.6 !important;
}

.benefit-description,
.step-description,
.testimonial-quote,
.seo-content p,
.footer-description {
    line-height: 1.7 !important;
}

/* Lepszy spacing w SEO content section */
.seo-content h2 {
    margin-top: 0 !important;
}

.seo-content h3 {
    margin-top: 2.5rem !important;
    margin-bottom: 1rem !important;
}

@media (max-width: 768px) {
    .seo-content h3 {
        margin-top: 2rem !important;
    }
}

/* ============================================
   4. ACCESSIBILITY FIXES
   ============================================ */

/* Focus states dla keyboard navigation */
.navbar-link:focus,
.btn:focus,
.hero-btn:focus,
.navbar-cta:focus,
.footer-links a:focus,
.social-link:focus,
a:focus {
    outline: 3px solid var(--primary) !important;
    outline-offset: 2px !important;
    border-radius: 0.25rem;
}

button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 3px solid var(--primary) !important;
    outline-offset: 2px !important;
}

/* Improved hover states dla lepszej interakcji */
.navbar-link:hover,
.footer-links a:hover {
    text-decoration: underline;
}

/* Skip to main content link dla screen readers */
.skip-to-main {
    position: absolute;
    left: -9999px;
    z-index: 9999;
    padding: 1em 1.5em;
    background-color: var(--primary);
    color: white;
    text-decoration: none;
    font-weight: 600;
    border-radius: 0.5rem;
}

.skip-to-main:focus {
    left: 50%;
    transform: translateX(-50%);
    top: 1rem;
    outline: 3px solid white;
    outline-offset: 2px;
}

/* Reduced motion support dla użytkowników z motion sensitivity */
@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;
    }

    .cart-badge,
    .cart-dropdown-badge {
        animation: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --gray-600: #1a202c !important;
        --gray-700: #171923 !important;
    }

    .navbar-link {
        color: var(--gray-900) !important;
    }

    .section-subtitle,
    .benefit-description,
    .step-description {
        color: var(--gray-800) !important;
    }

    /* Silniejsze borders dla lepszej widoczności */
    .card,
    .stat-card,
    .benefit-card,
    .step-card,
    .testimonial-card {
        border: 2px solid var(--gray-400) !important;
    }
}

/* ============================================
   5. ADDITIONAL UX IMPROVEMENTS
   ============================================ */

/* Loading state dla images */
img {
    background-color: var(--gray-100);
}

/* Smooth scrolling z safeguard */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Improved touch targets na mobile (minimum 44x44px) */
@media (max-width: 768px) {
    .navbar-link,
    .mobile-menu-toggle {
        min-height: 44px !important;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .cart-dropdown-toggle {
        min-width: 44px !important;
        min-height: 44px !important;
    }
}

/* Prevent text selection na UI elements */
.navbar-brand,
.mobile-menu-toggle,
.cart-dropdown-toggle,
.btn,
.hero-btn {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

/* Prevent layout shift z lazyload images */
img[loading="lazy"] {
    min-height: 200px;
}

/* ============================================
   6. PRINT STYLES
   ============================================ */

@media print {
    /* Hide navigation, footer, animations */
    .navbar,
    .footer,
    .cart-dropdown,
    .mobile-menu-toggle,
    .hero-btn,
    .final-cta-section {
        display: none !important;
    }

    /* Ensure text is black na białym */
    body {
        background: white !important;
        color: black !important;
    }

    /* Remove shadows i gradients */
    * {
        box-shadow: none !important;
        text-shadow: none !important;
        background-image: none !important;
    }

    /* Page breaks */
    .section-title,
    .benefit-card,
    .testimonial-card {
        page-break-inside: avoid;
    }
}

/* ============================================
   7. BROWSER-SPECIFIC FIXES
   ============================================ */

/* Safari-specific fixes */
@supports (-webkit-appearance: none) {
    /* Fix backdrop-filter na Safari */
    .navbar {
        -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    }

    .navbar-menu {
        -webkit-backdrop-filter: blur(20px) !important;
    }
}

/* Firefox-specific fixes */
@-moz-document url-prefix() {
    /* Firefox scrollbar styling */
    * {
        scrollbar-width: thin;
        scrollbar-color: var(--gray-300) var(--gray-100);
    }
}

/* Edge/IE fallbacks */
@supports not (backdrop-filter: blur(20px)) {
    .navbar,
    .navbar-menu {
        background: rgba(255, 255, 255, 0.98) !important;
    }
}

/* ============================================
   END OF RESPONSIVE FIXES
   ============================================ */
