/* ====================================
   RESPONSIVE DESIGN - MOBILE FIRST
==================================== */

/* Base - Mobile First (320px+) */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

/* Touch targets mínimos de 44px */
button, a, input, select, textarea {
    min-height: 44px;
    touch-action: manipulation;
}

/* Tablets e telas menores (até 968px) */
@media (max-width: 968px) {
    .container {
        padding: 0 20px;
    }
    
    /* Hero Section - Tablets */
    .hero .container {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .hero-image {
        order: -1;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        margin: 0 auto;
    }

    .hero-illustration {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
        padding: 1rem;
        max-width: 100%;
        box-sizing: border-box;
    }

    .finance-icon {
        font-size: 3.5rem;
    }

    .hero-content {
        text-align: center;
    }
    
    .hero-content h1 {
        font-size: 2.5rem;
        line-height: 1.2;
    }
    
    .hero-actions {
        justify-content: center;
        flex-wrap: wrap;
    }

    .hero-actions .btn {
        min-width: 200px;
    }
    
    .benefits-grid,
    .tools-grid,
    .blog-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.5rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    /* Controle - Resumo Grid */
    .resumo-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    /* Ferramentas - Tool Grid */
    .tool-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Tablets pequenos (até 768px) */
@media (max-width: 768px) {
    /* Navegação Mobile - Menu Completo */
    .navbar {
        position: relative;
    }
    
    .nav-menu {
        display: none;
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        flex-direction: column;
        padding: 0;
        box-shadow: var(--shadow-xl);
        z-index: 9999;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-menu.active {
        display: flex;
        animation: slideDown 0.3s ease;
    }
    
    .nav-menu a {
        padding: 1rem;
        border-bottom: 1px solid var(--gray-200);
        font-size: 1.125rem;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .nav-actions {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 0;
    }
    
    /* Hero Section */
    .hero {
        padding: 2rem 0;
        overflow-x: hidden;
    }

    .hero .container {
        flex-direction: column;
        gap: 2rem;
        padding: 0 1rem;
    }

    /* Ícones ficam em cima no mobile */
    .hero-image {
        order: -1;
        margin-bottom: 1rem;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        display: flex;
        justify-content: center;
        padding: 0;
    }

    .hero-content {
        width: 100%;
        text-align: center;
        padding: 0 1rem;
    }

    .hero-illustration,
    .finance-icons {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        padding: 0.5rem;
        max-width: 100%;
        width: 100%;
        margin: 0 auto;
        box-sizing: border-box;
        overflow: hidden;
    }

    .finance-icon {
        font-size: 2.4rem;
    }
    
    .hero-content h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero-subtitle,
    .hero-content p {
        font-size: 1rem;
        line-height: 1.5;
    }
    
    .hero-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .hero-actions .btn {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
    }

    .hero-note {
        font-size: 0.75rem;
        text-align: center;
    }
    
    /* Grids */
    .benefits-grid,
    .tools-grid,
    .blog-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
    
    /* Controle Page */
    .controle-header h1,
    .page-header h1 {
        font-size: 2rem;
    }
    
    .controle-header .subtitle,
    .page-header p {
        font-size: 1rem;
    }
    
    .resumo-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .resumo-card {
        padding: 1.5rem;
    }
    
    .resumo-icon {
        font-size: 2rem;
        width: 50px;
        height: 50px;
    }
    
    .resumo-valor {
        font-size: 1.5rem;
    }
    
    /* Summary Cards */
    .summary-cards {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Cards Gerais */
    .card {
        padding: 1.5rem !important;
    }
    
    /* Tabelas Responsivas */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
    }
    
    /* Ferramentas */
    .ferramenta-page .page-header h1 {
        font-size: 2rem;
    }
    
    .ferramenta-page .page-header p {
        font-size: 1rem;
    }
    
    .tool-grid {
        grid-template-columns: 1fr;
    }
    
    .tool-grid .card {
        padding: 1.5rem;
    }
    
    /* Formulários */
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-group {
        margin-bottom: 1.5rem;
    }
    
    input, select, textarea {
        font-size: 16px; /* Evita zoom no iOS */
    }
    
    /* Botões */
    .btn {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .btn-group {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn-group .btn {
        width: 100%;
    }
}

/* Mobile pequeno (até 480px) */
@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .hero {
        padding: 2rem 0;
    }
    
    .hero-content h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 0.9375rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .section-subtitle {
        font-size: 0.9375rem;
    }
    
    /* Header */
    .controle-header,
    .ferramenta-page .page-header {
        padding: 2rem 1rem;
    }
    
    .controle-header h1,
    .ferramenta-page .page-header h1 {
        font-size: 1.75rem;
    }
    
    /* Cards compactos */
    .card {
        padding: 1.25rem !important;
    }
    
    .resumo-card {
        padding: 1.25rem;
        gap: 0.75rem;
    }
    
    .resumo-icon {
        font-size: 1.75rem;
        width: 45px;
        height: 45px;
    }
    
    .resumo-valor {
        font-size: 1.25rem;
    }
    
    .resumo-label {
        font-size: 0.8125rem;
    }
    
    /* Formulários mais compactos */
    .form-group label {
        font-size: 0.9375rem;
    }
    
    input, select, textarea, .form-control {
        padding: 0.75rem;
        font-size: 16px; /* Evita zoom automático no iOS */
    }
    
    /* Botões */
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.9375rem;
    }
    
    /* Tabelas */
    table {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 0.75rem 0.5rem;
    }
    
    /* Modais */
    .modal-content {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    .modal-header h2 {
        font-size: 1.25rem;
    }
}

/* Mobile extra pequeno (até 360px) */
@media (max-width: 360px) {
    .container {
        padding: 0 12px;
    }
    
    .hero-content h1 {
        font-size: 1.5rem;
    }
    
    .section-title {
        font-size: 1.375rem;
    }
    
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
    
    .resumo-valor {
        font-size: 1.125rem;
    }
    
    input, select, textarea {
        padding: 0.625rem;
    }
}

/* ====================================
   LANDSCAPE MODE MOBILE
==================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        padding: 1.5rem 0;
    }
    
    .hero-content h1 {
        font-size: 1.5rem;
    }
    
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ====================================
   TABLET LANDSCAPE (768px - 1024px)
==================================== */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 720px;
    }
    
    .tool-grid {
        grid-template-columns: 1fr;
    }
    
    .benefits-grid,
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ====================================
   SUPORTE PARA TOUCH DEVICES
==================================== */
@media (hover: none) and (pointer: coarse) {
    /* Aumenta áreas de toque */
    a, button, .btn, input[type="checkbox"], input[type="radio"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects em touch devices */
    .card:hover,
    .btn:hover,
    .resumo-card:hover {
        transform: none;
    }
    
    /* Adiciona feedback visual para toque */
    .btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    
    .card:active {
        opacity: 0.95;
    }
}

/* ====================================
   PRINT STYLES
==================================== */
@media print {
    .navbar,
    .footer,
    .btn,
    .mobile-menu-toggle,
    .hero-actions {
        display: none !important;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    .card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
    }
    
    .hero-content h1 {
        font-size: 1.75rem;
    }
    
    .benefits,
    .tools-preview,
    .blog-preview {
        padding: 3rem 0;
    }
    
    .cta-section {
        padding: 3rem 0;
    }
    
    .cta-section h2 {
        font-size: 1.75rem;
    }
}
