/**
 * Responsividade - Mobile First
 * Breakpoints seguindo padrão Tailwind CSS
 */

/* ============================================
   BREAKPOINTS
   ============================================ */
/* sm: 640px - tablets pequenos */
/* md: 768px - tablets */
/* lg: 1024px - desktops pequenos */
/* xl: 1280px - desktops */
/* 2xl: 1536px - desktops grandes */

/* ============================================
   VARIÁVEIS CSS
   ============================================ */
:root {
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
    --breakpoint-2xl: 1536px;
}

/* ============================================
   MOBILE MENU
   ============================================ */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.mobile-menu-toggle span {
    width: 2rem;
    height: 0.25rem;
    background: currentColor;
    border-radius: 10px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: rotate(-45deg);
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

.mobile-menu-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: white;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}

.mobile-menu-sidebar.active {
    transform: translateX(0);
}

.mobile-menu-header {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-menu-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
}

.mobile-menu-content {
    padding: 1rem 0;
}

.mobile-menu-item {
    display: block;
    padding: 0.75rem 1rem;
    color: #1f2937;
    text-decoration: none;
    border-bottom: 1px solid #f3f4f6;
}

.mobile-menu-item:hover {
    background: #f9fafb;
}

.mobile-menu-accordion {
    border-bottom: 1px solid #f3f4f6;
}

.mobile-menu-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    color: #1f2937;
}

.mobile-menu-accordion-header:hover {
    background: #f9fafb;
}

.mobile-menu-accordion-icon {
    transition: transform 0.3s;
}

.mobile-menu-accordion[aria-expanded="true"] .mobile-menu-accordion-icon {
    transform: rotate(180deg);
}

.mobile-menu-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.mobile-menu-accordion[aria-expanded="true"] .mobile-menu-accordion-content {
    max-height: 1000px;
}

.mobile-menu-subitem {
    display: block;
    padding: 0.5rem 1rem 0.5rem 2rem;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
}

.mobile-menu-subitem:hover {
    background: #f9fafb;
    color: #1f2937;
}

/* ============================================
   UTILITÁRIOS RESPONSIVOS
   ============================================ */
/* Ocultar em mobile */
.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

/* Mostrar apenas em mobile */
@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile {
        display: block !important;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
}

/* Ocultar em desktop */
@media (min-width: 768px) {
    .hide-desktop {
        display: none !important;
    }
    
    .mobile-menu-overlay,
    .mobile-menu-sidebar {
        display: none !important;
    }
}

/* ============================================
   GRID RESPONSIVO
   ============================================ */
.responsive-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .responsive-grid.sm-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .responsive-grid.sm-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) {
    .responsive-grid.md-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .responsive-grid.md-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .responsive-grid.md-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1024px) {
    .responsive-grid.lg-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .responsive-grid.lg-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .responsive-grid.lg-4 {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .responsive-grid.lg-5 {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .responsive-grid.lg-6 {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (min-width: 1280px) {
    .responsive-grid.xl-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .responsive-grid.xl-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .responsive-grid.xl-4 {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .responsive-grid.xl-5 {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .responsive-grid.xl-6 {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* ============================================
   CONTAINER RESPONSIVO
   ============================================ */
.container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .container {
        max-width: 640px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 768px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1024px;
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: 1280px;
    }
}

/* ============================================
   TIPOGRAFIA RESPONSIVA
   ============================================ */
.responsive-text {
    font-size: 1rem;
}

@media (min-width: 768px) {
    .responsive-text {
        font-size: 1.125rem;
    }
}

@media (min-width: 1024px) {
    .responsive-text {
        font-size: 1.25rem;
    }
}

/* ============================================
   ESPAÇAMENTO RESPONSIVO
   ============================================ */
.responsive-padding {
    padding: 1rem;
}

@media (min-width: 768px) {
    .responsive-padding {
        padding: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .responsive-padding {
        padding: 2rem;
    }
}

/* ============================================
   TABELAS RESPONSIVAS
   ============================================ */
.responsive-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767px) {
    .responsive-table {
        display: block;
        width: 100%;
    }
    
    .responsive-table thead {
        display: none;
    }
    
    .responsive-table tbody,
    .responsive-table tr,
    .responsive-table td {
        display: block;
        width: 100%;
    }
    
    .responsive-table tr {
        border: 1px solid #e5e7eb;
        margin-bottom: 1rem;
        border-radius: 0.5rem;
        padding: 1rem;
    }
    
    .responsive-table td {
        text-align: right;
        padding: 0.5rem 0;
        border-bottom: 1px solid #f3f4f6;
    }
    
    .responsive-table td:before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        color: #6b7280;
    }
    
    .responsive-table td:last-child {
        border-bottom: none;
    }
}
