/* ==========================================
   OTIMIZAÇÃO MOBILE E RESPONSIVIDADE
   ========================================== */

/* Mobile First - Telas pequenas (< 768px) */
@media (max-width: 768px) {
    /* Header e Navegação */
    .header {
        padding: 1rem 0;
    }
    
    .logo span {
        font-size: 0.9rem;
    }
    
    .nav {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .nav-link {
        width: 100%;
        text-align: center;
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    /* Filtros */
    .filters {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group label {
        font-size: 0.875rem;
    }
    
    .filter-group select,
    .filter-group input {
        font-size: 0.875rem;
        padding: 0.75rem;
    }
    
    /* Cards de Agendamentos */
    .agendamento-card {
        padding: 1rem;
    }
    
    .agendamento-card h3 {
        font-size: 1rem;
    }
    
    .agendamento-card .badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* Estatísticas */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    /* Botões */
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    /* Formulários */
    .form-row {
        flex-direction: column;
    }
    
    .form-group {
        width: 100%;
    }
    
    /* Calendário */
    .calendario-grid {
        font-size: 0.75rem;
    }
    
    .calendario-dia {
        padding: 0.25rem;
        min-height: 60px;
    }
    
    /* Modais */
    .modal-content {
        width: 95%;
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .modal-header h2 {
        font-size: 1.25rem;
    }
    
    /* Notificações */
    .notification-item {
        padding: 1rem;
        font-size: 0.875rem;
    }
    
    /* Tabelas */
    .data-table {
        font-size: 0.75rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem 0.25rem;
    }
    
    /* Senha Modal */
    .senha-container {
        width: 95%;
        padding: 1.5rem;
    }
    
    /* Gráficos */
    canvas {
        max-height: 250px !important;
    }
}

/* Tablets (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filters {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* Landscape Mobile (max-height 500px) */
@media (max-height: 500px) {
    .header {
        padding: 0.5rem 0;
    }
    
    .section {
        padding: 1rem 0;
    }
    
    .modal-content {
        max-height: 90vh;
        display: flex;
        flex-direction: column;
    }
}

/* Menu Hamburger para Mobile */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .nav {
        position: fixed;
        top: 60px;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: calc(100vh - 60px);
        background: var(--primary-color);
        flex-direction: column;
        padding: 1rem;
        transition: left 0.3s ease;
        z-index: 999;
        overflow-y: auto;
    }
    
    .nav.active {
        left: 0;
    }
    
    .nav-link {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .nav-link:last-child {
        border-bottom: none;
    }
}

/* Overlay para mobile menu */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.mobile-overlay.active {
    display: block;
}

/* Touch-friendly - Aumentar área de toque */
@media (max-width: 768px) {
    button,
    .btn,
    .nav-link,
    input[type="checkbox"],
    input[type="radio"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    .agendamento-actions {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .agendamento-actions .btn {
        width: 100%;
    }
}

/* Melhorias de acessibilidade mobile */
@media (max-width: 768px) {
    /* Aumentar fontes para leitura */
    body {
        font-size: 16px;
    }
    
    /* Espaçamento confortável */
    .container {
        padding: 0 1rem;
    }
    
    /* Cards mais espaçados */
    .card {
        margin-bottom: 1.5rem;
    }
    
    /* Inputs maiores */
    input,
    select,
    textarea {
        font-size: 16px; /* Previne zoom no iOS */
        padding: 0.75rem;
    }
}

/* Orientação portrait específica */
@media (max-width: 768px) and (orientation: portrait) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .stat-card {
        min-height: 100px;
    }
}

/* Print styles */
@media print {
    .header,
    .nav,
    .filters,
    .btn,
    .mobile-menu-toggle,
    .notification-btn {
        display: none !important;
    }
    
    .section {
        page-break-inside: avoid;
    }
    
    .agendamento-card {
        border: 1px solid #000;
        margin-bottom: 1rem;
    }
}
