/* ==================== MOBILE RESPONSIVENESS FIXES ==================== */

/* Prevenir horizontal scroll em todos os dispositivos */
html, body {
    width: 100%;
    overflow-x: hidden;
    max-width: 100%;
}

/* Garantir que elementos não extrapolem a largura da tela */
* {
    max-width: 100%;
}

/* ==================== TABLETS Y MOBILES (hasta 1024px) ==================== */
@media (max-width: 1024px) {
    html, body {
        width: 100%;
        margin: 0;
        padding: 0;
    }
    
    body {
        padding-top: 70px;
    }
    
    header {
        width: 100vw;
        left: 0;
        right: 0;
        padding: 0.75rem 0;
    }
    
    .container {
        padding: 0 1rem;
        margin: 0 auto;
        width: 100%;
        max-width: 100%;
    }
    
    header .container {
        padding: 0 0.75rem;
    }
    
    nav {
        padding: 0;
        margin: 0;
    }
    
    .navbar-brand {
        font-size: 1rem;
        flex-shrink: 0;
        margin-right: auto;
    }
    
    .navbar-brand span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px;
    }
    
    .hamburger {
        display: flex !important;
        flex-direction: column;
        cursor: pointer;
        background: none !important;
        border: none !important;
        z-index: auto !important;
        gap: 4px;
        position: relative !important;
        top: auto !important;
        right: auto !important;
        width: 40px !important;
        height: 40px !important;
        padding: 0 !important;
        align-items: center;
        justify-content: center;
        border-radius: 0 !important;
        box-shadow: none !important;
        transition: all 0.3s ease !important;
    }
    
    .hamburger span {
        width: 20px;
        height: 2.5px;
        background-color: #D4695E !important;
        transition: all 0.3s ease;
        border-radius: 2px;
        display: block;
    }
    
    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(8px, 8px);
        background-color: white;
    }
    
    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }
    
    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
        background-color: white;
    }
    
    /* Menu overlay superpuesto (modal sidebar) */
    .navbar-menu {
        position: fixed !important;
        top: 70px !important;
        left: 0 !important;
        width: 280px !important;
        height: calc(100vh - 70px) !important;
        background-color: #d7ccca !important;
        flex-direction: column !important;
        padding: 0 !important;
        gap: 0 !important;
        z-index: 1001 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        display: none !important;
        align-items: stretch !important;
        margin: 0 !important;
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.2) !important;
    }
    
    .navbar-menu.active {
        display: flex !important;
        animation: slideInMenu 0.4s ease-out !important;
    }

    /* Overlay detrás del menú - crear con elemento separado */
    body::before {
        content: '';
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        pointer-events: none;
        display: none;
    }

    body.menu-open::before {
        pointer-events: auto;
        display: block;
        animation: fadeIn 0.3s ease-out;
    }
    
    /* Animaciones para el menú */
    @keyframes slideInMenu {
        from {
            transform: translateX(-100%);
            opacity: 0;
        }
        to {
            transform: translateX(0);
            opacity: 1;
        }
    }
    
    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    @keyframes fadeIn {
        from {
            opacity: 0;
        }
        to {
            opacity: 0.5;
        }
    }
    
    /* Items del menú */
    .navbar-menu li {
        width: 100%;
        padding: 0 !important;
        margin: 0 !important;
        border-bottom: 1px solid rgba(212, 105, 94, 0.15);
        position: relative;
        z-index: 1;
        display: block !important;
        list-style: none;
        flex-shrink: 0;
        opacity: 0;
        animation: fadeInUp 0.4s ease-out forwards;
    }
    
    .navbar-menu li:nth-child(1) { animation-delay: 0.05s; }
    .navbar-menu li:nth-child(2) { animation-delay: 0.1s; }
    .navbar-menu li:nth-child(3) { animation-delay: 0.15s; }
    .navbar-menu li:nth-child(4) { animation-delay: 0.2s; }
    .navbar-menu li:nth-child(5) { animation-delay: 0.25s; }
    .navbar-menu li:nth-child(6) { animation-delay: 0.3s; }
    .navbar-menu li:nth-child(7) { animation-delay: 0.35s; }
    .navbar-menu li:nth-child(8) { animation-delay: 0.4s; }
    .navbar-menu li:nth-child(9) { animation-delay: 0.45s; }
    
    .navbar-menu a {
        display: block;
        padding: 1rem 1.5rem;
        color: #333;
        text-decoration: none;
        font-size: 1rem;
        transition: all 0.3s ease;
        font-weight: 500;
        position: relative;
        z-index: 2;
    }
    
    .navbar-menu a:hover,
    .navbar-menu a:active {
        background: rgba(212, 105, 94, 0.1);
        color: #D4695E;
        padding-left: 2rem;
    }
    
    /* Sections - Margins and Padding */
    section {
        padding: 1.5rem 0;
        margin: 0;
    }
    
    section.light,
    section.gray {
        padding: 1.5rem 0;
    }
    
    /* Hero Section */
    .hero {
        margin: 0 !important;
        padding: 1.5rem !important;
        gap: 1rem;
        overflow-x: hidden;
    }
    
    .hero-wrapper {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0;
    }
    
    .hero h1 {
        font-size: 1.4rem;
        line-height: 1.2;
        margin: 0 0 1rem 0;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    .hero p {
        font-size: 0.9rem;
        margin: 0 0 1.5rem 0;
        line-height: 1.5;
        word-wrap: break-word;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 0.75rem;
        margin: 0 0 1.5rem 0;
        width: 100%;
    }
    
    .hero-buttons .btn {
        width: 100%;
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .hero-image {
        width: 100%;
        max-width: 100%;
        margin: 0;
    }
    
    .hero-photo {
        max-width: 100%;
        height: auto;
    }
    
    /* Cards and Grid Layouts */
    .grid, .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin: 0;
        padding: 0;
    }
    
    .card {
        margin: 0;
        padding: 1rem;
        gap: 1rem;
    }
    
    .card h3 {
        font-size: 1rem;
        margin: 0.5rem 0;
    }
    
    .card p {
        font-size: 0.9rem;
        margin: 0.5rem 0;
    }
    
    /* Floating Button */
    .floating-menu {
        position: fixed !important;
        bottom: 20px !important;
        right: 20px !important;
        z-index: 999 !important;
        overflow: visible !important;
    }
    
    .floating-btn-menu {
        width: 55px !important;
        height: 55px !important;
        font-size: 24px !important;
        flex-shrink: 0 !important;
        padding: 0 !important;
        border: none !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: #D4695E !important;
        border-radius: 50% !important;
        cursor: pointer !important;
        box-shadow: 0 4px 12px rgba(212, 105, 94, 0.4) !important;
        transition: all 0.3s ease !important;
        position: absolute !important;
        bottom: 70px !important;
        right: 0 !important;
    }
    
    .floating-btn-menu:active {
        transform: scale(0.95) !important;
    }
    
    .floating-btn-main {
        width: 55px !important;
        height: 55px !important;
        font-size: 22px !important;
        flex-shrink: 0 !important;
        padding: 0 !important;
        border: none !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: #E91E63 !important;
        border-radius: 50% !important;
        cursor: pointer !important;
        box-shadow: 0 4px 12px rgba(233, 30, 99, 0.4) !important;
        transition: all 0.3s ease !important;
    }
    
    .floating-btn-main:active {
        transform: scale(0.95) !important;
    }
    
    .floating-menu-items {
        position: absolute !important;
        bottom: 70px !important;
        right: 0 !important;
        z-index: 1000 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        transition: all 0.3s ease !important;
    }
    
    .floating-item {
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        padding: 12px 18px !important;
        background: white !important;
        border-radius: 50px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
        text-decoration: none !important;
        color: #333 !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        white-space: nowrap !important;
        min-width: max-content !important;
        transition: all 0.3s ease !important;
    }
    
    .floating-item span:first-child {
        font-size: 18px !important;
        flex-shrink: 0 !important;
    }
    
    .floating-item:active {
        background: #E91E63 !important;
        color: white !important;
    }
    
    /* Typography */
    h1 {
        font-size: 1.5rem;
        margin: 0.5rem 0;
    }
    
    h2 {
        font-size: 1.25rem;
        margin: 1rem 0;
    }
    
    h3 {
        font-size: 1rem;
        margin: 0.5rem 0;
    }
    
    h4 {
        font-size: 0.95rem;
        margin: 0.5rem 0;
    }
    
    p {
        font-size: 0.95rem;
        line-height: 1.6;
        margin: 0.5rem 0;
    }
    
    /* Ensure no horizontal scroll on images */
    img {
        max-width: 100%;
        height: auto;
        display: block;
        margin: 0;
    }
    
    /* Input fields and Forms */
    input, textarea, select {
        width: 100%;
        max-width: 100%;
        padding: 0.75rem;
        margin: 0.5rem 0;
        font-size: 16px;
    }
    
    /* Buttons */
    .btn {
        width: 100%;
        padding: 0.75rem;
        margin: 0.5rem 0;
        font-size: 0.95rem;
    }
    
    /* Lists */
    ul, ol {
        margin: 1rem 0;
        padding-left: 1.5rem;
    }
    
    li {
        margin: 0.5rem 0;
    }
    
    /* Divider */
    .divider {
        margin: 1rem 0;
    }
    
    /* Footer */
    footer {
        width: 100%;
        overflow-x: hidden;
        padding: 1.5rem 0;
        margin: 0;
    }
    
    footer .container {
        padding: 0 1rem;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .footer-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 1rem !important;
        margin-bottom: 1.5rem !important;
        width: 100%;
    }
    
    footer div > div {
        overflow-x: hidden !important;
    }
    
    footer h4 {
        margin: 0 0 0.75rem 0;
        font-size: 0.95rem;
        font-weight: 600;
    }
    
    footer ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }
    
    footer li {
        margin: 0.4rem 0;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    
    footer a {
        color: #666;
        text-decoration: none;
        font-size: 0.85rem;
        transition: color 0.3s;
    }
    
    footer a:hover {
        color: #E91E63;
    }
    
    .footer-bottom {
        text-align: center;
        padding-top: 1rem;
        margin-top: 1rem;
        border-top: 1px solid #ddd;
    }
    
    .footer-bottom p {
        margin: 0.4rem 0;
        font-size: 0.8rem;
        color: #999;
        word-break: break-word;
    }
    
    /* Testimonial Cards */
    .testimonial-card {
        padding: 1rem;
    }
    
    .testimonial-author {
        gap: 0.75rem;
    }
    
    .testimonial-stars {
        font-size: 0.9rem;
    }
    
    .testimonial-text {
        font-size: 0.9rem;
        margin: 0.5rem 0;
    }
    
    /* Blog Cards */
    .blog-card {
        padding: 0.75rem;
    }
    
    .blog-content {
        padding: 1rem;
    }
    
    .blog-title {
        font-size: 1rem;
    }
    
    .blog-excerpt {
        font-size: 0.85rem;
    }
    
    .blog-date {
        font-size: 0.8rem;
    }
    
    /* Tabs and Navigation */
    .tab-buttons {
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .tab-button {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        flex: 1;
        min-width: 100px;
    }
    
    /* Two-column layouts */
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns: repeat(2"],
    [style*="grid-template-columns: 50% 50%"] {
        grid-template-columns: 1fr !important;
    }
    
    [style*="grid-template-columns: 1fr 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    
    [style*="display: grid"][style*="grid-template-columns"] {
        gap: 1rem !important;
    }
}
}

/* ==================== SMARTPHONES MAIORES (480px - 599px) ==================== */
@media (min-width: 480px) and (max-width: 599px) {
    .container {
        padding: 0 1.25rem;
    }
    
    .hero {
        padding: 2rem 1.25rem !important;
    }
    
    .hero h1 {
        font-size: 1.6rem;
        margin-bottom: 1rem;
    }
    
    .hero p {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-buttons {
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-buttons .btn {
        padding: 0.75rem 1.2rem !important;
        font-size: 0.95rem !important;
    }
    
    .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* ==================== TABLETS PEQUENOS (600px - 767px) ==================== */
@media (min-width: 600px) and (max-width: 767px) {
    html, body {
        width: 100%;
        overflow-x: hidden;
    }
    
    header {
        width: 100%;
    }
    
    .container {
        padding: 0 1.5rem;
        max-width: 100%;
    }
    
    section {
        padding: 2rem 0;
    }
    
    .hero {
        padding: 2rem 1.5rem !important;
        margin: 0 !important;
    }
    
    .hero h1 {
        font-size: 1.8rem;
        line-height: 1.2;
        margin: 0 0 1rem 0;
    }
    
    .hero p {
        font-size: 1rem;
        margin: 0 0 1.5rem 0;
    }
    
    .hero-buttons {
        gap: 1rem;
        margin: 0 0 1.5rem 0;
    }
    
    .hero-buttons .btn {
        flex: 1;
        min-width: 140px;
        padding: 0.75rem 1rem !important;
        font-size: 0.95rem !important;
    }
    
    .hamburger {
        display: flex !important;
    }
    
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-2 {
        grid-template-columns: 1fr;
    }
    
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns: repeat(2"],
    [style*="grid-template-columns: 50% 50%"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Footer - Tablets */
    footer {
        padding: 2rem 0;
    }
    
    footer .container {
        padding: 0 1.5rem;
    }
    
    .footer-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem !important;
    }
    
    footer h4 {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    footer li {
        margin-bottom: 0.5rem;
    }
    
    .floating-menu {
        bottom: 25px;
        right: 25px;
    }
    
    .floating-btn-menu {
        width: 52px;
        height: 52px;
    }
    
    .floating-btn-main {
        width: 52px;
        height: 52px;
    }
}

/* ==================== LANDSCAPE MODE ==================== */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding-top: 60px;
    }
    
    header {
        padding: 0.5rem 0;
    }
    
    .hamburger span {
        margin: 3px 0;
    }
    
    section {
        padding: 1rem 0;
    }
    
    .hero {
        padding: 1rem;
    }
}

/* ==================== PREVENTS ZOOM ON TOUCH ==================== */
@media (hover: none) and (pointer: coarse) {
    input,
    textarea,
    button,
    select,
    a {
        font-size: 16px !important;
    }
    
    .floating-btn-main:active {
        transform: scale(0.95);
    }
    
    button, .btn, a {
        min-height: 44px;
        padding: 10px 15px;
    }
}

/* ==================== FIX PARA IPHONE ==================== */
@supports (padding: max(0px)) {
    html, body {
        width: 100%;
        overflow-x: hidden;
    }
    
    .floating-menu {
        bottom: max(20px, env(safe-area-inset-bottom));
        right: max(20px, env(safe-area-inset-right));
    }
    
    body {
        padding-bottom: max(0, env(safe-area-inset-bottom));
    }
}

/* ==================== FOCUS VISIBLE PARA ACESSIBILIDADE ==================== */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid #E91E63;
    outline-offset: 2px;
}
/* ==================== TESTES MOBILE ==================== */
@media (max-width: 768px) {
    .grid.grid-5 {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.7rem;
        max-width: 100%;
    }
    
    .test-card {
        min-height: auto;
    }
    
    .test-image {
        font-size: 1.8rem;
    }
    
    .test-info {
        padding: 0.6rem;
    }
    
    .test-name {
        font-size: 0.8rem;
    }
    
    .test-description {
        font-size: 0.65rem;
    }
    
    .test-card .btn {
        font-size: 0.7rem;
        padding: 0.35rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .grid.grid-5 {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }
    
    .test-image {
        font-size: 1.5rem;
    }
    
    .test-info {
        padding: 0.5rem;
    }
    
    .test-name {
        font-size: 0.75rem;
        margin-bottom: 0.2rem;
    }
    
    .test-description {
        font-size: 0.6rem;
        margin-bottom: 0.4rem;
    }
    
    .test-card .btn {
        font-size: 0.65rem;
        padding: 0.3rem 0.4rem;
    }
}