/**
 * Mobile-Specific Fixes and Optimizations
 * Automotora Useche Raffle System
 */

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

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

    .gradient-orb,
    .floating-element {
        animation: none !important;
        opacity: 0.05 !important;
    }
}

/* ========================================
   TOUCH OPTIMIZATIONS
======================================== */

@media (max-width: 768px) {

    /* Larger touch targets */
    .btn,
    .nav-link,
    .carousel-prev,
    .carousel-next,
    .indicator {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .btn:hover,
    .step-card:hover,
    .detail-item:hover,
    .trust-feature:hover {
        transform: none;
    }

    /* Disable parallax on mobile for performance */
    .hero-enhanced {
        transform: none !important;
    }

    /* Simplify animations */
    .gradient-orb {
        animation-duration: 30s !important;
    }

    /* Optimize floating CTA for mobile */
    .floating-cta {
        bottom: 0;
        right: 0;
        left: 0;
        border-radius: 0;
        padding: 1rem;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    }

    .floating-cta .btn {
        width: 100%;
        border-radius: 12px;
    }

    /* Stack hero stats vertically on small screens */
    .hero-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .stat-pill {
        width: 100%;
        max-width: 320px;
        justify-content: center;
    }

    /* Optimize trust badges */
    .trust-badges {
        gap: 1rem;
    }

    .trust-item {
        font-size: 0.85rem;
    }

    .trust-item i {
        font-size: 1.25rem;
    }

    /* Better modal sizing */
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 1rem;
    }

    /* Improve carousel navigation on mobile */
    .carousel-prev,
    .carousel-next {
        width: 50px;
        height: 50px;
        background: rgba(255, 255, 255, 0.98);
    }

    .carousel-prev i,
    .carousel-next i {
        font-size: 1.75rem;
    }

    /* Stack CTA section */
    .cta-card {
        flex-direction: column;
    }

    .cta-content {
        width: 100%;
        text-align: center;
    }

    .btn-accent {
        width: 100%;
    }
}

/* ========================================
   SMALL MOBILE (< 480px)
======================================== */

@media (max-width: 480px) {

    /* Reduce padding */
    .container {
        padding: 0 1rem;
    }

    .glass-card,
    .glass-card-dark {
        padding: 1.5rem 1rem;
    }

    /* Smaller typography */
    .hero-title {
        font-size: 1.75rem;
    }

    .hero-highlight {
        font-size: 2.25rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .section-title {
        font-size: 1.75rem;
    }

    .prize-name {
        font-size: 1.75rem;
    }

    /* Compact countdown */
    .time-block {
        min-width: 40px;
        padding: 0.35rem;
    }

    .time-block .days,
    .time-block .hours,
    .time-block .minutes,
    .time-block .seconds {
        font-size: 1.1rem;
    }

    .time-block .label {
        font-size: 0.55rem;
    }

    /* Smaller buttons */
    .btn {
        font-size: 0.85rem;
        padding: 0.85rem 1.25rem;
        gap: 0.5rem;
    }

    .btn-xl,
    .btn-large {
        padding: 1rem 1.5rem;
        font-size: 0.95rem;
    }

    .btn i {
        font-size: 1.1rem;
    }

    /* Compact stat pills */
    .stat-pill {
        padding: 0.75rem 1.25rem;
        gap: 0.5rem;
    }

    .stat-pill i {
        font-size: 1.5rem;
    }

    .stat-pill strong {
        font-size: 1.25rem;
    }

    .stat-pill span {
        font-size: 0.75rem;
    }

    /* Compact hero badge */
    .hero-badge {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        gap: 0.5rem;
    }

    /* Smaller detail items */
    .detail-item {
        flex-direction: column;
        text-align: center;
        padding: 1.25rem;
    }

    .detail-icon {
        font-size: 2.5rem;
    }

    .detail-content strong {
        font-size: 1.75rem;
    }

    /* Compact steps */
    .step-card {
        padding: 2rem 1.5rem;
    }

    .step-number {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
        top: -15px;
        right: 15px;
    }

    .step-icon {
        font-size: 3rem;
        margin-bottom: 1rem;
    }

    .step-card h3 {
        font-size: 1.25rem;
    }

    /* Compact trust features */
    .trust-feature {
        padding: 1.5rem 1rem;
    }

    .trust-icon {
        font-size: 2.5rem;
    }

    .trust-feature h4 {
        font-size: 1.1rem;
    }

    .trust-feature p {
        font-size: 0.85rem;
    }

    /* Smaller section badges */
    .section-badge {
        font-size: 0.7rem;
        padding: 0.35rem 1rem;
    }

    /* Compact bases list */
    .bases-list li {
        font-size: 0.9rem;
        gap: 0.75rem;
    }

    .bases-list i {
        font-size: 1.25rem;
    }
}

/* ========================================
   LANDSCAPE MOBILE
======================================== */

@media (max-width: 896px) and (orientation: landscape) {
    .hero-enhanced {
        padding: 3rem 1.5rem 4rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-highlight {
        font-size: 2.5rem;
    }

    .modal-content {
        max-height: 80vh;
    }
}

/* ========================================
   TABLET (768px - 1024px)
======================================== */

@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 0 3rem;
    }

    .hero-title {
        font-size: 3rem;
    }

    .hero-highlight {
        font-size: 3.5rem;
    }

    .steps-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }

    .prize-details {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   SAFE AREA INSETS (iPhone X+)
======================================== */

@supports (padding: env(safe-area-inset-bottom)) {
    .floating-cta {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }

    .top-countdown-bar {
        padding-top: calc(0.9rem + env(safe-area-inset-top));
    }

    .modal-content {
        padding-bottom: calc(3rem + env(safe-area-inset-bottom));
    }
}

/* ========================================
   DARK MODE SUPPORT
======================================== */

@media (prefers-color-scheme: dark) {
    /* Optional: Add darkmode support if needed */
    /* Currently maintaining light theme for brand consistency */
}

/* ========================================
   HIGH CONTRAST MODE
======================================== */

@media (prefers-contrast: high) {

    .btn,
    .step-card,
    .detail-item,
    .trust-feature {
        border-width: 3px;
    }

    .gradient-text,
    .hero-highlight {
        -webkit-text-fill-color: currentColor;
    }
}

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

@media print {

    .header,
    .top-countdown-bar,
    .floating-cta,
    .modal-overlay,
    .floating-element,
    .hero-badge,
    .hero-actions,
    .trust-badges,
    .cta-section {
        display: none !important;
    }

    .hero-enhanced {
        background: white !important;
        color: black !important;
        border-radius: 0 !important;
    }

    .glass-card,
    .glass-card-dark {
        background: white !important;
        color: black !important;
        border: 1px solid #ccc !important;
    }

    a[href]:after {
        content: " (" attr(href) ")";
    }
}

/* ========================================
   ACCESSIBILITY FIXES
======================================== */

/* Focus visible for keyboard navigation */
.keyboard-navigation *:focus {
    outline: 3px solid var(--brand-accent) !important;
    outline-offset: 2px !important;
}

/* Skip to content link */
.skip-to-content {
    position: fixed;
    top: -100px;
    left: 0;
    background: var(--brand-primary);
    color: white;
    padding: 1rem 2rem;
    z-index: 10000;
    transition: top 0.3s;
}

.skip-to-content:focus {
    top: 0;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Better focus indicators */
button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid var(--brand-accent);
    outline-offset: 2px;
}

/* ========================================
   PERFORMANCE HINTS
======================================== */

/* Will-change for animated elements */
.carousel-slide,
.gradient-orb,
.floating-element,
.btn {
    will-change: transform, opacity;
}

/* GPU acceleration */
.glass-effect,
.glass-card,
.glass-card-dark {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Contain paint for better performance */
.step-card,
.detail-item,
.trust-feature,
.prize-card {
    contain: layout style paint;
}