/* =============================================
   ProdivetZN - Responsive Styles
   ============================================= */

/* Large Devices (Desktops, less than 1200px) */
@media (max-width: 1199.98px) {
    .container {
        max-width: 960px;
    }

    .services-grid,
    .products-grid,
    .why-us-grid,
    .stats-grid,
    .team-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .slide-content h2 {
        font-size: 40px;
    }
}

/* Medium Devices (Tablets, less than 992px) */
@media (max-width: 991.98px) {
    .container {
        max-width: 720px;
    }

    .section {
        padding: 60px 0;
    }

    /* Header */
    .header {
        position: fixed;
        top: 33px;
        left: 0;
        right: 0;
        z-index: 1000;
    }

    /* Header Tablet */
    .header-content {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
    }

    .mobile-toggle {
        order: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 8px;
        background: transparent;
        border: none;
        cursor: pointer;
        font-size: 24px;
        color: var(--text-color, #333);
        transition: color 0.3s ease;
    }

    .mobile-toggle:hover {
        color: #dc3545;
    }

    /* Ícone hamburger animado */
    .mobile-toggle i {
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .mobile-toggle:active i {
        transform: scale(0.85);
    }

    .hamburger-line {
        display: block;
        width: 24px;
        height: 2px;
        background-color: var(--text-color, #333);
        border-radius: 2px;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    }

    .mobile-toggle.active .hamburger-line:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .mobile-toggle.active .hamburger-line:nth-child(2) {
        opacity: 0;
    }

    .mobile-toggle.active .hamburger-line:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .logo {
        order: 2;
        text-align: center;
    }

    .header-actions {
        order: 3;
        justify-content: flex-end;
    }

    /* Search Form Tablet - apenas ícone */
    .search-form {
        background: transparent;
        border: none;
        padding: 0;
    }

    .search-form:focus-within {
        box-shadow: none;
    }

    .search-input {
        display: none;
    }

    .search-btn {
        background-color: transparent;
        color: var(--text-color);
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .search-btn:hover {
        background-color: var(--gray-light);
        color: var(--primary-color);
    }

    /* Nav Mobile Menu - Slide-in */
    .nav {
        position: fixed !important;
        top: 0 !important;
        left: -300px !important;
        width: 300px !important;
        height: 100vh !important;
        background-color: #ffffff !important;
        box-shadow: 5px 0 30px rgba(0, 0, 0, 0.3);
        padding: 80px 30px 30px !important;
        transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 9999 !important;
        overflow-y: auto;
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }

    .nav.active {
        left: 0 !important;
    }

    /* Links do menu mobile com animações suaves */
    .nav-list > li {
        opacity: 0;
        transform: translateX(-30px);
        transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                    transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        width: 100%;
        will-change: opacity, transform;
    }

    .nav.active .nav-list > li {
        opacity: 1;
        transform: translateX(0);
    }

    /* Animação escalonada - stagger effect */
    .nav.active .nav-list > li:nth-child(1) { transition-delay: 0.05s; }
    .nav.active .nav-list > li:nth-child(2) { transition-delay: 0.1s; }
    .nav.active .nav-list > li:nth-child(3) { transition-delay: 0.15s; }
    .nav.active .nav-list > li:nth-child(4) { transition-delay: 0.2s; }
    .nav.active .nav-list > li:nth-child(5) { transition-delay: 0.25s; }
    .nav.active .nav-list > li:nth-child(6) { transition-delay: 0.3s; }

    /* Reset delay quando fecha o menu */
    .nav:not(.active) .nav-list > li {
        transition-delay: 0s !important;
    }

    .nav-list {
        flex-direction: column;
        gap: 0;
        width: 100%;
        position: relative;
        z-index: 5;
    }

    /* Links do menu mobile - remover underline animado do desktop */
    .nav-list > li > a::after {
        display: none !important;
    }

    .nav-list > li > a {
        display: block !important;
        width: 100% !important;
        padding: 15px 15px !important;
        border-bottom: 1px solid #dee2e6;
        position: relative;
        z-index: 1;
        color: #333333 !important;
        background-color: #ffffff;
        cursor: pointer;
        font-weight: 500;
        font-size: 16px;
        transition: background-color 0.25s ease,
                    color 0.25s ease,
                    padding-left 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    /* Indicador lateral animado para mobile */
    .nav-list > li > a::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        width: 4px;
        height: 100%;
        background-color: #dc3545;
        transform: scaleY(0);
        transform-origin: center;
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .nav-list > li > a:hover,
    .nav-list > li > a:active {
        background-color: #f8f9fa;
        color: #dc3545 !important;
        padding-left: 20px !important;
    }

    .nav-list > li > a:hover::before,
    .nav-list > li > a:active::before {
        transform: scaleY(1);
    }

    .nav-list > li > a.active {
        background-color: #f0f0f0;
        color: #dc3545 !important;
        padding-left: 20px !important;
    }

    .nav-list > li > a.active::before {
        transform: scaleY(1);
    }

    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        padding-left: 15px;
        max-height: 0;
        overflow: hidden;
        background-color: #f8f9fa;
        transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                    padding 0.35s ease;
        padding-top: 0;
        padding-bottom: 0;
    }

    .dropdown.active .dropdown-menu {
        max-height: 500px;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .dropdown-menu li a {
        display: block;
        padding: 12px 15px;
        width: 100%;
        transition: background-color 0.2s ease,
                    color 0.2s ease,
                    padding-left 0.2s ease;
    }

    .dropdown-menu li a::before {
        display: none;
    }

    .dropdown-menu li a:hover {
        background-color: #e9ecef;
        padding-left: 20px;
    }

    .nav-close {
        display: flex;
        position: absolute;
        top: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        font-size: 24px;
        cursor: pointer;
        background: none;
        border: none;
        color: #1a1a1a;
        align-items: center;
        justify-content: center;
        z-index: 10;
        transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                    background-color 0.3s ease;
        border-radius: 50%;
    }

    .nav-close:hover {
        color: #dc3545;
        transform: rotate(90deg);
        background-color: rgba(220, 53, 69, 0.1);
    }

    .nav-close:active {
        transform: rotate(90deg) scale(0.9);
    }

    .nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.6);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                    visibility 0.35s;
        z-index: 999;
    }

    .nav-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Hero Slider */
    .hero-slider {
        height: 500px;
    }

    .slide-content h2 {
        font-size: 32px;
    }

    .slide-content p {
        font-size: 16px;
    }

    /* About */
    .about-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .about-images {
        order: -1;
    }

    .about-img-main {
        width: 100%;
        height: 350px;
    }

    .about-img-secondary {
        width: 150px;
        height: 150px;
    }

    /* Blog / Notícias - Tablet */
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .noticias-grid {
        grid-template-columns: 1fr !important;
        gap: 25px;
    }

    /* Newsletter */
    .newsletter-content {
        flex-direction: column;
        text-align: center;
    }

    .newsletter-form {
        width: 100%;
        max-width: 500px;
    }

    .newsletter-form input {
        flex: 1;
    }

    /* Footer */
    .footer-grid,
    .footer-grid.footer-3-cols {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Section titles */
    .section-title {
        font-size: 30px;
    }
}

/* Small Devices (Landscape phones, less than 768px) */
@media (max-width: 767.98px) {
    .container {
        max-width: 540px;
    }

    /* Top Bar */
    .top-bar {
        padding: 6px 0;
        font-size: 11px;
    }

    .top-bar-content {
        flex-direction: column;
        gap: 6px;
    }

    .top-info {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .top-info span {
        font-size: 11px;
    }

    .top-info i {
        font-size: 10px;
    }

    /* Adjust header position */
    .header {
        top: 52px;
    }

    /* Header Mobile */
    .header-content {
        padding: 12px 0;
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
    }

    .logo {
        order: 2;
        text-align: center;
    }

    .logo h1 {
        font-size: 22px;
    }

    .header-actions {
        order: 3;
        justify-content: flex-end;
    }

    .header-actions .btn {
        display: none;
    }

    /* Search Form Mobile - apenas ícone */
    .search-form {
        background: transparent;
        border: none;
        padding: 0;
    }

    .search-form:focus-within {
        box-shadow: none;
    }

    .search-input {
        display: none;
    }

    .search-btn {
        background-color: transparent;
        color: var(--text-color);
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .search-btn:hover {
        background-color: var(--gray-light);
        color: var(--primary-color);
    }

    /* Hero Slider */
    .hero-slider {
        height: 450px;
    }

    .slide-content h2 {
        font-size: 28px;
    }

    .slide-buttons {
        flex-direction: column;
    }

    .slide-buttons .btn {
        width: 100%;
    }

    /* Grids */
    .services-grid,
    .why-us-grid,
    .stats-grid,
    .team-grid,
    .blog-grid {
        grid-template-columns: 1fr !important;
    }

    /* Products grid - 2 columns in mobile */
    .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }

    .product-card {
        font-size: 13px;
    }

    .product-image {
        height: 180px;
    }

    .product-info {
        padding: 12px;
    }

    .product-name {
        font-size: 15px;
    }

    .product-desc {
        font-size: 12px;
    }

    .product-category {
        font-size: 10px;
    }

    .product-badge {
        font-size: 9px;
        padding: 4px 8px;
    }

    .product-footer .btn {
        font-size: 12px;
        padding: 8px 12px;
    }

    /* Stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-number {
        font-size: 36px;
    }

    /* Footer */
    .footer-grid,
    .footer-grid.footer-3-cols {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-col h3::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .footer-social {
        justify-content: center;
    }

    .contact-info li {
        justify-content: center;
    }

    /* Newsletter */
    .newsletter-form {
        flex-direction: column;
    }

    .newsletter-form input {
        width: 100%;
    }

    /* Section titles */
    .section-title {
        font-size: 26px;
    }

    .section-header {
        margin-bottom: 40px;
    }

    /* About */
    .experience-badge {
        top: auto;
        bottom: -20px;
        right: 20px;
    }

    .about-content .section-title,
    .about-content .section-subtitle {
        text-align: center;
    }

    .about-features {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .about-content .btn {
        display: block;
        width: 100%;
        text-align: center;
    }

    /* Cart */
    .cart-table {
        display: block;
        overflow-x: auto;
    }

    /* Page Header */
    .page-header {
        padding: 60px 0;
    }

    .page-header h1 {
        font-size: 32px;
    }
}

/* Extra Small Devices (Portrait phones, less than 576px) */
@media (max-width: 575.98px) {
    .container {
        padding: 0 15px;
    }

    .section {
        padding: 50px 0;
    }

    /* Top Bar - Layout organizado em 2 linhas */
    .top-bar {
        padding: 5px 0;
    }

    .top-bar-content {
        gap: 4px;
    }

    .top-info {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4px 10px;
        font-size: 10px;
        width: 100%;
    }

    .top-info span:first-child {
        grid-column: 1 / -1;
        justify-content: center;
    }

    .top-info span:nth-child(2),
    .top-info span:nth-child(3) {
        justify-content: center;
    }

    .top-info span {
        gap: 4px;
    }

    .top-info i {
        font-size: 9px;
    }

    .top-social {
        margin-top: 0;
    }

    /* Header Extra Small */
    .header {
        top: 48px;
    }

    .logo h1 {
        font-size: 18px;
    }

    .search-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }

    .mobile-toggle {
        font-size: 20px;
    }

    /* Hero Slider */
    .hero-slider {
        height: 400px;
    }

    .slide-content h2 {
        font-size: 24px;
    }

    .slide-content p {
        font-size: 14px;
    }

    .slider-controls {
        bottom: 15px;
    }

    .slider-btn {
        width: 35px;
        height: 35px;
    }

    /* Stats */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stats {
        padding: 40px 0;
    }

    /* Buttons */
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    /* Products */
    .product-image {
        height: 180px;
    }

    /* Team */
    .team-image {
        height: 220px;
    }

    /* Testimonials */
    .testimonial-content {
        padding: 25px;
    }

    .testimonial-content > p {
        font-size: 16px;
    }

    /* Blog / Notícias - Mobile */
    .blog-grid,
    .noticias-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    .blog-image {
        height: 220px;
    }

    .blog-content {
        padding: 20px;
    }

    .blog-title {
        font-size: 18px;
    }

    .blog-summary,
    .blog-content p {
        -webkit-line-clamp: 2;
    }

    .news-category {
        font-size: 10px;
        padding: 6px 12px;
    }

    /* Back to top */
    .back-to-top {
        width: 40px;
        height: 40px;
        bottom: 20px;
        right: 20px;
    }

    /* About images */
    .about-img-main {
        height: 280px;
    }

    .about-img-secondary {
        width: 120px;
        height: 120px;
    }

    .experience-badge {
        padding: 15px;
    }

    .experience-badge .years {
        font-size: 28px;
    }

    .experience-badge .text {
        font-size: 10px;
    }
}

/* Print Styles */
@media print {
    .top-bar,
    .header,
    .hero-slider,
    .newsletter,
    .back-to-top,
    .footer-social {
        display: none;
    }

    .section {
        padding: 30px 0;
    }

    body {
        font-size: 12pt;
    }

    a {
        color: var(--text-color);
    }
}

/* =============================================
   REDUCED MOTION - Accessibility
   ============================================= */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .btn:focus-visible {
        box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.4);
    }

    .btn:hover,
    .btn-primary:hover,
    .btn-outline:hover,
    .btn-icon:hover,
    .search-btn:hover,
    .back-to-top:hover,
    .footer-social a:hover,
    .user-icon:hover,
    .cart-icon:hover,
    .mobile-toggle:hover,
    .nav-close:hover {
        transform: none;
    }

    .btn-success-feedback,
    .btn-error-feedback {
        animation: none;
    }

    /* Menu mobile - transições instantâneas */
    .nav {
        transition: none !important;
    }

    .nav-list > li {
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .nav-overlay {
        transition: none !important;
    }

    /* Menu desktop - sem underline animado */
    .nav-list > li > a::after {
        transition: none !important;
    }

    .dropdown-menu {
        transition: none !important;
    }
}

/* =============================================
   MOBILE SEARCH DROPDOWN
   ============================================= */
/* Backdrop com blur */
.search-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.search-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

.search-overlay {
    position: fixed;
    top: 130px; /* Mais espaço do header */
    left: 50%;
    transform: translateX(-50%) translateY(-150%);
    width: calc(100% - 40px);
    max-width: 600px;
    background-color: white;
    z-index: 9999;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.search-overlay.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: all;
}

.search-overlay-content {
    padding: 40px 20px;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.search-overlay-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.search-overlay-close:hover {
    background-color: var(--gray-light);
    color: #dc3545;
    transform: rotate(90deg);
}

.search-overlay h2 {
    color: var(--text-color);
    font-size: 22px;
    margin-bottom: 25px;
    font-weight: 600;
}

.search-overlay-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.search-overlay-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    background-color: white;
    color: var(--text-color);
    outline: none;
    transition: all 0.3s ease;
}

.search-overlay-input::placeholder {
    color: var(--text-light);
}

.search-overlay-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.1);
}

.search-overlay-btn {
    width: 100%;
    padding: 16px 30px;
    font-size: 16px;
    font-weight: 600;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.search-overlay-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(25, 135, 84, 0.3);
}

.search-overlay-btn:active {
    transform: translateY(0);
}

/* Desktop - esconder dropdown */
@media (min-width: 992px) {
    .search-overlay,
    .search-backdrop {
        display: none !important;
    }
}
