/**
 * BEMFICA MOBILE OPTIMIZATIONS
 * CSS otimizado para dispositivos móveis
 * Mobile-First approach com Progressive Enhancement
 * Versão: 1.0 | Data: 27/09/2025
 */

/* ========================================
   MOBILE-FIRST BASE STYLES
   ======================================== */

/* Reset e base mobile */
*,
*::before,
*::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    /* Prevenir zoom horizontal em iOS */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    /* Otimizar scrolling em iOS */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;

    /* Prevenir bounce em iOS */
    position: fixed;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

/* Container principal com scroll */
.main-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ========================================
   MOBILE TYPOGRAPHY SCALE
   ======================================== */

/* Base mobile (320px+) */
.hero-title {
    font-size: clamp(2rem, 8vw, 2.5rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: clamp(1rem, 4vw, 1.1rem);
    line-height: 1.4;
}

.section-title {
    font-size: clamp(1.5rem, 6vw, 2rem);
    line-height: 1.2;
}

.body-text {
    font-size: clamp(0.9rem, 3.5vw, 1rem);
    line-height: 1.6;
}

/* ========================================
   MOBILE LAYOUT GRID SYSTEM
   ======================================== */

.mobile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.mobile-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mobile-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* ========================================
   TOUCH-OPTIMIZED COMPONENTS
   ======================================== */

/* Touch targets mínimo 44px */
.touch-target {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
}

/* Feedback visual para touch */
.touch-feedback {
    transition: transform 0.15s ease-out, background-color 0.15s ease-out;
    -webkit-user-select: none;
    user-select: none;
}

.touch-feedback:active {
    transform: scale(0.98);
}

/* Botões mobile-first */
.btn-mobile {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease-out;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    -webkit-appearance: none;
}

.btn-mobile:active {
    transform: scale(0.98);
}

.btn-primary-mobile {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--dark);
}

.btn-secondary-mobile {
    background: transparent;
    border: 2px solid var(--gold);
    color: var(--gold);
}

/* ========================================
   MOBILE NAVIGATION
   ======================================== */

/* Mobile menu toggle - sempre visível em mobile */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 9999;
    width: 44px;
    height: 44px;
    background: rgba(26, 26, 26, 0.9);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.hamburger-line {
    width: 18px;
    height: 2px;
    background: var(--gold);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 1px;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

/* Mobile menu overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-nav {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    gap: 2rem;
    padding: 2rem;
}

.mobile-nav-link {
    color: var(--light);
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 600;
    padding: 1rem 2rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    min-height: 44px;
    display: flex;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 280px;
    justify-content: center;
}

.mobile-nav-link:active {
    background: rgba(212, 175, 55, 0.1);
    color: var(--gold);
    transform: scale(0.98);
}

/* ========================================
   MOBILE HERO SECTION
   ======================================== */

/* Mobile (320px+) */
.hero-section-mobile {
    height: 70vh;
    min-height: 500px;
    background-attachment: scroll; /* Performance em mobile */
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
}

.hero-content-mobile {
    position: relative;
    z-index: 10;
    max-width: 100%;
}

.hero-title-mobile {
    font-size: clamp(2rem, 8vw, 3rem);
    line-height: 1.1;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.8);
    background: linear-gradient(135deg, #ffffff, #e0e0e0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle-mobile {
    font-size: clamp(1rem, 4vw, 1.2rem);
    margin-bottom: 2rem;
    opacity: 0.9;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.8);
}

.hero-cta-mobile {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--dark);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    transition: transform 0.15s ease-out;
    min-height: 44px;
    min-width: 120px;
    justify-content: center;
}

.hero-cta-mobile:active {
    transform: scale(0.98);
}

/* ========================================
   MOBILE CATALOG CARDS
   ======================================== */

.catalog-grid-mobile {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1rem;
}

.catalog-card-mobile {
    position: relative;
    min-height: 160px;
    padding: 2rem 1.5rem;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid rgba(212, 175, 55, 0.2);
    backdrop-filter: blur(10px);
}

.catalog-card-mobile:active {
    transform: scale(0.98);
    box-shadow: 0 8px 32px rgba(212, 175, 55, 0.2);
}

.catalog-card-mobile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent, rgba(212, 175, 55, 0.05));
    opacity: 0;
    transition: opacity 0.15s ease-out;
}

.catalog-card-mobile:active::before {
    opacity: 1;
}

.catalog-card-content-mobile {
    position: relative;
    z-index: 2;
}

.catalog-card-title-mobile {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gold);
    margin-bottom: 0.5rem;
}

.catalog-card-description-mobile {
    font-size: 0.95rem;
    line-height: 1.4;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.catalog-card-cta-mobile {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gold);
    color: var(--dark);
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    min-height: 44px;
}

/* ========================================
   MOBILE FORMS
   ======================================== */

.form-mobile {
    width: 100%;
    max-width: 100%;
    padding: 1rem;
}

.form-group-mobile {
    margin-bottom: 1.5rem;
}

.form-label-mobile {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--gold);
    font-size: 0.9rem;
}

.form-input-mobile,
.form-textarea-mobile,
.form-select-mobile {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    background: rgba(26, 26, 26, 0.8);
    color: var(--light);
    min-height: 44px;
    transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out;

    /* iOS specific */
    -webkit-appearance: none;
    -webkit-border-radius: 12px;
    appearance: none;
}

.form-input-mobile:focus,
.form-textarea-mobile:focus,
.form-select-mobile:focus {
    border-color: var(--gold);
    outline: none;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.form-textarea-mobile {
    min-height: 120px;
    resize: vertical;
}

.form-submit-mobile {
    width: 100%;
    padding: 1.25rem;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--dark);
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease-out;
    min-height: 44px;
}

.form-submit-mobile:active {
    transform: scale(0.98);
}

/* Radio buttons mobile */
.radio-group-mobile {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.radio-option-mobile {
    padding: 1rem;
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease-out;
    min-height: 44px;
    display: flex;
    align-items: center;
    background: rgba(26, 26, 26, 0.5);
}

.radio-option-mobile:active {
    transform: scale(0.98);
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--gold);
}

.radio-option-mobile.selected {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--gold);
}

/* ========================================
   MOBILE BREAKPOINTS
   ======================================== */

/* Small Mobile (375px+) - iPhone SE, iPhone 12 mini */
@media (min-width: 375px) {
    .hero-title-mobile {
        font-size: clamp(2.2rem, 8vw, 3.2rem);
    }

    .catalog-card-mobile {
        min-height: 180px;
        padding: 2.5rem 2rem;
    }

    .mobile-nav-link {
        font-size: 1.4rem;
    }
}

/* Mobile Landscape (480px+) */
@media (min-width: 480px) {
    .hero-section-mobile {
        height: 60vh;
    }

    .catalog-grid-mobile {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 2rem;
        padding: 2rem 1rem;
    }

    .mobile-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1rem;
    }

    .mobile-nav-link {
        width: auto;
        min-width: 140px;
    }
}

/* Tablet Portrait (768px+) */
@media (min-width: 768px) {
    /* Esconder elementos mobile em tablet+ */
    .mobile-menu-toggle {
        display: none;
    }

    .mobile-menu-overlay {
        display: none;
    }

    /* Ajustar grid para tablet */
    .catalog-grid-mobile {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
        padding: 2rem;
    }

    .hero-section-mobile {
        height: 80vh;
    }
}

/* Tablet Landscape (1024px+) */
@media (min-width: 1024px) {
    .catalog-grid-mobile {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
    }

    .hero-section-mobile {
        height: 90vh;
    }
}

/* Desktop (1200px+) */
@media (min-width: 1200px) {
    /* Desktop styles inherit from main CSS */
    .mobile-optimizations {
        display: none; /* Flag para identificar que chegou no desktop */
    }
}

/* ========================================
   ACCESSIBILITY & REDUCED MOTION
   ======================================== */

@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;
    }

    /* Manter apenas feedback essencial */
    .touch-feedback:active,
    .btn-mobile:active,
    .catalog-card-mobile:active {
        transition-duration: 0.1s !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .catalog-card-mobile {
        border-width: 2px;
        border-color: var(--gold);
    }

    .form-input-mobile,
    .form-textarea-mobile,
    .form-select-mobile {
        border-width: 3px;
    }
}

/* Dark mode preference */
@media (prefers-color-scheme: dark) {
    :root {
        --dark: #000000;
        --dark-light: #0a0a0a;
        --dark-secondary: #1a1a1a;
    }
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

/* GPU acceleration para elementos que animam */
.gpu-optimized {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
    will-change: transform, opacity;
}

/* Otimizações para imagens em mobile */
.mobile-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 12px;
}

.mobile-image[data-src] {
    background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Performance mode styles */
.performance-mode * {
    animation-duration: 0.2s !important;
    transition-duration: 0.1s !important;
}

.performance-mode .backdrop-blur {
    backdrop-filter: blur(3px) !important;
}

.performance-mode .complex-shadow {
    box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
}

/* ========================================
   UTILITIES
   ======================================== */

.mobile-only {
    display: block;
}

.desktop-only {
    display: none;
}

.mobile-hidden {
    display: none;
}

.mobile-visible {
    display: block;
}

@media (min-width: 768px) {
    .mobile-only {
        display: none;
    }

    .desktop-only {
        display: block;
    }

    .tablet-hidden {
        display: none;
    }
}

@media (min-width: 1200px) {
    .tablet-only {
        display: none;
    }
}