/**
 * Academia ASA-SM - CSS Responsivo Mobile-First
 * Incluir em todas as páginas: <link rel="stylesheet" href="includes/responsive.css">
 */

/* ========================================
   MOBILE FIRST - Base (até 480px)
   ======================================== */

/* Reset e Base */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { 
    font-family: 'Inter', sans-serif; 
    overflow-x: hidden; 
    -webkit-text-size-adjust: 100%;
}

/* Container */
.container {
    width: 100%;
    padding: 0 1rem;
    margin: 0 auto;
}

/* Header Mobile */
.header {
    padding: 0.75rem 1rem !important;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.logo-img {
    height: 35px !important;
}

.logo-text {
    font-size: 1rem !important;
}

/* Navegação Mobile - Esconder por padrão */
.nav-links {
    display: none !important;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark, #0a1929);
    flex-direction: column;
    padding: 2rem 1rem;
    gap: 0.5rem !important;
    z-index: 999;
}

.nav-links.active {
    display: flex !important;
}

.nav-links a {
    padding: 1rem !important;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
}

/* Menu Hamburger */
.menu-toggle {
    display: flex !important;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Header Right */
.header-right {
    gap: 0.5rem !important;
}

.search-box {
    display: none !important;
}

.search-box input {
    width: 120px !important;
}

/* Botões */
.btn-login {
    padding: 0.5rem 1rem !important;
    font-size: 0.8rem !important;
}

.btn-primary, .btn-secondary {
    padding: 0.875rem 1.5rem !important;
    font-size: 0.9rem !important;
    width: 100%;
    justify-content: center;
}

/* Hero Section */
.hero {
    min-height: auto !important;
    padding: 80px 1rem 2rem !important;
    padding-right: 1rem !important;
    flex-direction: column !important;
    text-align: center;
}

.hero-content {
    max-width: 100% !important;
    padding: 0 !important;
}

.hero h1 {
    font-size: 1.75rem !important;
    line-height: 1.3 !important;
}

.hero-subtitle, .hero p {
    font-size: 0.95rem !important;
}

.hero-buttons {
    flex-direction: column !important;
    gap: 0.75rem !important;
    width: 100%;
}

.hero-stats {
    flex-wrap: wrap !important;
    gap: 1.5rem !important;
    justify-content: center;
}

.stat-value {
    font-size: 1.5rem !important;
}

/* Hero Card (lateral) */
.hero-card {
    position: relative !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 2rem;
}

/* Badge Row */
.badge-row {
    justify-content: center !important;
    flex-wrap: wrap !important;
}

.badge {
    font-size: 0.7rem !important;
    padding: 0.3rem 0.75rem !important;
}

/* Hero Meta */
.hero-meta {
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 1rem !important;
}

.meta-item {
    font-size: 0.85rem !important;
}

/* Content Sections */
.content {
    padding: 2rem 1rem !important;
}

.content-section {
    padding: 2rem 1rem !important;
}

/* Section Headers */
.section-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
}

.section-title {
    font-size: 1.25rem !important;
}

/* Grids */
.categories-grid,
.courses-grid,
.cards-grid,
.trilhas-grid,
.related-grid,
.lessons-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
}

/* Cards */
.course-card,
.ebook-card,
.card,
.trilha-card,
.lesson-card {
    width: 100% !important;
    min-width: auto !important;
}

.card-thumb, .course-thumb {
    height: 180px !important;
}

/* Sidebar e Filtros */
.sidebar,
.filters-sidebar {
    position: fixed !important;
    left: -100% !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 280px !important;
    z-index: 1000 !important;
    transition: left 0.3s ease !important;
    overflow-y: auto !important;
    padding-top: 70px !important;
}

.sidebar.active,
.filters-sidebar.active {
    left: 0 !important;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* Botão de filtro mobile */
.filter-toggle {
    display: flex !important;
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: var(--primary, #1A4D6D);
    color: white;
    padding: 1rem;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 998;
    cursor: pointer;
}

.filter-toggle i {
    font-size: 1.25rem;
}

/* Main Content com Sidebar */
.main-content,
.catalog-content {
    margin-left: 0 !important;
    width: 100% !important;
}

/* Página de Curso */
.curso-grid {
    grid-template-columns: 1fr !important;
}

/* Para quem é este curso - Grid */
.content-section > div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
}

/* Instrutor */
.content-section div[style*="display: flex"][style*="align-items: center"][style*="gap: 2rem"] {
    flex-direction: column !important;
    text-align: center !important;
}

/* Footer */
.footer {
    padding: 2rem 1rem !important;
}

.footer-grid {
    grid-template-columns: 1fr !important;
    text-align: center;
}

/* Tabelas */
table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
}

/* Forms */
.form-row {
    flex-direction: column !important;
}

.form-group {
    width: 100% !important;
}

input, select, textarea {
    font-size: 16px !important; /* Previne zoom no iOS */
}

/* Modal */
.modal-content {
    width: 95% !important;
    max-width: 95% !important;
    margin: 1rem !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
}

/* Player de Vídeo */
.video-container {
    width: 100% !important;
}

.video-wrapper {
    padding-bottom: 56.25%; /* 16:9 */
    position: relative;
    height: 0;
}

.video-wrapper iframe,
.video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Painel do Aluno */
.stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
}

.stat-card {
    padding: 1rem !important;
}

/* Certificado */
.certificado-preview {
    transform: scale(0.5) !important;
    transform-origin: top center;
}

/* ========================================
   TABLET - 481px a 768px
   ======================================== */
@media (min-width: 481px) {
    .container {
        padding: 0 1.5rem;
    }
    
    .hero h1 {
        font-size: 2rem !important;
    }
    
    .categories-grid,
    .courses-grid,
    .cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    .hero-buttons {
        flex-direction: row !important;
        justify-content: center;
    }
    
    .btn-primary, .btn-secondary {
        width: auto;
    }
}

/* ========================================
   TABLET LANDSCAPE - 769px a 1024px
   ======================================== */
@media (min-width: 769px) {
    .header {
        padding: 0.75rem 3% !important;
    }
    
    .menu-toggle {
        display: none !important;
    }
    
    .nav-links {
        display: flex !important;
        position: static !important;
        flex-direction: row !important;
        background: none !important;
        padding: 0 !important;
        gap: 1.5rem !important;
    }
    
    .nav-links a {
        padding: 0.5rem !important;
        background: none !important;
    }
    
    .search-box {
        display: flex !important;
    }
    
    .hero {
        padding: 100px 3% 3rem !important;
        text-align: left;
    }
    
    .hero h1 {
        font-size: 2.5rem !important;
    }
    
    .hero-buttons {
        justify-content: flex-start;
    }
    
    .badge-row {
        justify-content: flex-start !important;
    }
    
    .hero-meta {
        justify-content: flex-start !important;
    }
    
    .content {
        padding: 3rem 3% !important;
    }
    
    .categories-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .courses-grid,
    .cards-grid,
    .trilhas-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .sidebar,
    .filters-sidebar {
        position: sticky !important;
        left: auto !important;
        top: 80px !important;
        width: 250px !important;
        padding-top: 0 !important;
    }
    
    .filter-toggle {
        display: none !important;
    }
    
    .main-content,
    .catalog-content {
        margin-left: 1.5rem !important;
    }
    
    .section-header {
        flex-direction: row !important;
        align-items: center !important;
    }
}

/* ========================================
   DESKTOP - 1025px a 1200px
   ======================================== */
@media (min-width: 1025px) {
    .header {
        padding: 0.75rem 4% !important;
    }
    
    .hero {
        padding: 120px 4% 4rem !important;
        flex-direction: row !important;
    }
    
    .hero-content {
        max-width: 600px !important;
    }
    
    .hero h1 {
        font-size: 3rem !important;
    }
    
    .hero-card {
        position: absolute !important;
        right: 5% !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        width: 340px !important;
        margin-top: 0;
    }
    
    .content {
        padding: 3rem 4% !important;
    }
    
    .categories-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    .courses-grid,
    .cards-grid,
    .trilhas-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .related-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* ========================================
   DESKTOP LARGE - 1201px+
   ======================================== */
@media (min-width: 1201px) {
    .categories-grid {
        grid-template-columns: repeat(6, 1fr) !important;
    }
    
    .courses-grid,
    .cards-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    .hero-content {
        max-width: 700px !important;
    }
}

/* ========================================
   UTILITÁRIOS
   ======================================== */

/* Esconder em mobile */
.hide-mobile {
    display: none !important;
}

@media (min-width: 769px) {
    .hide-mobile {
        display: block !important;
    }
    
    .hide-desktop {
        display: none !important;
    }
}

/* Mostrar apenas em mobile */
.show-mobile {
    display: block !important;
}

@media (min-width: 769px) {
    .show-mobile {
        display: none !important;
    }
}

/* Texto responsivo */
.text-responsive {
    font-size: clamp(0.875rem, 2vw, 1rem);
}

.title-responsive {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
}

/* Imagens responsivas */
img {
    max-width: 100%;
    height: auto;
}

/* Safe area para dispositivos com notch */
@supports (padding: max(0px)) {
    .header {
        padding-left: max(1rem, env(safe-area-inset-left)) !important;
        padding-right: max(1rem, env(safe-area-inset-right)) !important;
    }
    
    .content,
    .content-section {
        padding-left: max(1rem, env(safe-area-inset-left)) !important;
        padding-right: max(1rem, env(safe-area-inset-right)) !important;
    }
}

/* Print */
@media print {
    .header,
    .footer,
    .sidebar,
    .nav-links,
    .btn-primary,
    .btn-secondary {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}
