/**
 * ONSTRYX - CSS Responsivo Completo
 * Adaptação para todos os dispositivos
 */

/* =====================================================
   VARIÁVEIS E BREAKPOINTS
   ===================================================== */
:root {
    --container-padding: 20px;
}

/* =====================================================
   RESET E BASE RESPONSIVA
   ===================================================== */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    min-width: 320px;
}

img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* Container responsivo */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

/* =====================================================
   DESKTOP GRANDE (1400px+)
   ===================================================== */
@media (min-width: 1400px) {
    :root {
        --container-padding: 40px;
    }
}

/* =====================================================
   DESKTOP (1200px - 1399px)
   ===================================================== */
@media (max-width: 1399px) {
    :root {
        --container-padding: 32px;
    }
    
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* =====================================================
   LAPTOP (992px - 1199px)
   ===================================================== */
@media (max-width: 1199px) {
    :root {
        --container-padding: 24px;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .hero-title {
        font-size: 48px;
    }
    
    .section-title {
        font-size: 32px;
    }
    
    /* Footer */
    .footer-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .footer-about {
        grid-column: span 3;
        margin-bottom: 24px;
    }
}

/* =====================================================
   TABLET (768px - 991px)
   ===================================================== */
@media (max-width: 991px) {
    :root {
        --container-padding: 20px;
    }
    
    /* Header */
    .header-nav {
        display: none;
    }
    
    .mobile-menu-btn {
        display: flex !important;
    }
    
    .header-logo img {
        max-height: 36px;
    }
    
    /* Hero */
    .hero {
        min-height: 60vh;
    }
    
    .hero-title {
        font-size: 36px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
    
    /* Products Grid */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    /* Product Card */
    .product-card-info {
        padding: 12px;
    }
    
    .product-card-title {
        font-size: 14px;
    }
    
    .product-card-price {
        font-size: 16px;
    }
    
    /* Categories */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Features */
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Footer */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 32px;
    }
    
    .footer-about {
        grid-column: span 2;
    }
    
    /* Checkout */
    .checkout-grid {
        grid-template-columns: 1fr;
    }
    
    .checkout-summary {
        order: -1;
        margin-bottom: 24px;
    }
    
    /* Product Page */
    .product-detail-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .product-gallery {
        max-height: 500px;
    }
    
    /* Admin */
    .admin-sidebar {
        position: fixed;
        left: -280px;
        z-index: 1000;
        transition: left 0.3s ease;
    }
    
    .admin-sidebar.active {
        left: 0;
    }
    
    .admin-main {
        margin-left: 0;
    }
    
    .admin-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Tables */
    .admin-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    /* Auth Pages */
    .auth-left {
        display: none;
    }
    
    .auth-right {
        width: 100%;
    }
    
    /* Institutional Pages */
    .institutional-content {
        padding: 0;
    }
    
    .policy-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .steps-guide .step-item {
        flex-direction: column;
        text-align: center;
    }
    
    .step-number {
        margin-bottom: 12px;
    }
}

/* =====================================================
   MOBILE GRANDE (576px - 767px)
   ===================================================== */
@media (max-width: 767px) {
    :root {
        --container-padding: 16px;
    }
    
    /* Typography */
    h1, .h1 {
        font-size: 28px;
    }
    
    h2, .h2 {
        font-size: 24px;
    }
    
    h3, .h3 {
        font-size: 20px;
    }
    
    /* Header */
    .header-container {
        padding: 12px 16px;
    }
    
    .header-logo img {
        max-height: 32px;
    }
    
    .header-icons {
        gap: 8px;
    }
    
    .header-icon-btn {
        padding: 8px;
    }
    
    /* Hero */
    .hero {
        min-height: 50vh;
    }
    
    .hero-title {
        font-size: 28px;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 14px;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 12px;
    }
    
    .hero-buttons .btn {
        width: 100%;
    }
    
    /* Sections */
    .section {
        padding: 48px 0;
    }
    
    .section-title {
        font-size: 24px;
        margin-bottom: 24px;
    }
    
    /* Products */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .product-card-gallery-nav {
        display: none;
    }
    
    .product-card-info {
        padding: 10px;
    }
    
    .product-card-title {
        font-size: 13px;
        -webkit-line-clamp: 1;
    }
    
    .product-card-price {
        font-size: 15px;
    }
    
    .product-card-old-price {
        font-size: 12px;
    }
    
    /* Categories */
    .categories-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .category-card {
        min-height: 150px;
    }
    
    .category-card-title {
        font-size: 16px;
    }
    
    /* Features */
    .features-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    /* Newsletter */
    .newsletter-form {
        flex-direction: column;
    }
    
    .newsletter-form input,
    .newsletter-form button {
        width: 100%;
    }
    
    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 24px;
        text-align: center;
    }
    
    .footer-about {
        grid-column: span 1;
    }
    
    .footer-social {
        justify-content: center;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    /* Cart Drawer */
    .cart-drawer {
        width: 100%;
        max-width: 100%;
    }
    
    /* Buttons */
    .btn {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .btn-lg {
        padding: 14px 24px;
    }
    
    /* Forms */
    .form-input,
    .form-select,
    .form-textarea {
        padding: 12px 14px;
        font-size: 16px; /* Previne zoom no iOS */
    }
    
    /* Filters */
    .filters-bar {
        flex-direction: column;
        gap: 12px;
    }
    
    .filters-bar select {
        width: 100%;
    }
    
    /* Product Page */
    .product-gallery {
        max-height: 400px;
    }
    
    .product-gallery-thumbs {
        display: none;
    }
    
    .product-info {
        padding: 20px 0;
    }
    
    .product-title {
        font-size: 24px;
    }
    
    .product-price {
        font-size: 28px;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .product-actions .btn {
        width: 100%;
    }
    
    /* Checkout */
    .checkout-steps {
        overflow-x: auto;
        padding-bottom: 8px;
    }
    
    .checkout-step {
        white-space: nowrap;
        font-size: 12px;
    }
    
    /* Account */
    .account-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
    }
    
    .account-tab {
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* Admin */
    .admin-header {
        padding: 12px 16px;
    }
    
    .admin-page-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .admin-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-card {
        border-radius: 8px;
    }
    
    .admin-card-body {
        padding: 16px;
    }
    
    .admin-form-row {
        flex-direction: column;
    }
    
    .admin-modal-content {
        margin: 16px;
        max-height: calc(100vh - 32px);
    }
    
    /* Institutional */
    .institutional-header {
        padding: 40px 0;
    }
    
    .institutional-title {
        font-size: 28px;
    }
    
    .policy-cards {
        grid-template-columns: 1fr;
    }
    
    .support-channels {
        grid-template-columns: 1fr;
    }
    
    .faq-category {
        padding: 16px;
    }
    
    /* WhatsApp Button */
    .whatsapp-float {
        width: 50px;
        height: 50px;
        bottom: 16px;
        right: 16px;
    }
    
    .whatsapp-float svg {
        width: 26px;
        height: 26px;
    }
}

/* =====================================================
   MOBILE PEQUENO (até 575px)
   ===================================================== */
@media (max-width: 575px) {
    :root {
        --container-padding: 12px;
    }
    
    /* Header */
    .header-container {
        padding: 10px 12px;
    }
    
    .header-logo img {
        max-height: 28px;
    }
    
    /* Hero */
    .hero {
        min-height: 45vh;
    }
    
    .hero-title {
        font-size: 24px;
    }
    
    .hero-subtitle {
        font-size: 13px;
    }
    
    /* Products */
    .products-grid {
        gap: 8px;
    }
    
    .product-card {
        border-radius: 8px;
    }
    
    .product-card-info {
        padding: 8px;
    }
    
    .product-card-title {
        font-size: 12px;
    }
    
    .product-card-price {
        font-size: 14px;
    }
    
    /* Single Column Option */
    .products-grid.single-column {
        grid-template-columns: 1fr;
    }
    
    /* Categories */
    .categories-grid {
        gap: 8px;
    }
    
    .category-card {
        min-height: 120px;
        border-radius: 8px;
    }
    
    .category-card-title {
        font-size: 14px;
    }
    
    /* Footer */
    .footer {
        padding: 32px 0 24px;
    }
    
    .footer-logo img {
        max-height: 32px;
    }
    
    /* Modals */
    .modal-content {
        margin: 8px;
        border-radius: 12px;
    }
    
    /* Alerts */
    .alert {
        padding: 12px;
        font-size: 14px;
    }
}

/* =====================================================
   UTILITÁRIOS RESPONSIVOS
   ===================================================== */

/* Ocultar em diferentes breakpoints */
@media (max-width: 991px) {
    .hide-tablet { display: none !important; }
}

@media (max-width: 767px) {
    .hide-mobile { display: none !important; }
}

@media (min-width: 768px) {
    .show-mobile-only { display: none !important; }
}

@media (min-width: 992px) {
    .show-tablet-only { display: none !important; }
}

/* Texto responsivo */
.text-center-mobile {
    text-align: center;
}

@media (min-width: 768px) {
    .text-center-mobile {
        text-align: left;
    }
}

/* Flex responsivo */
.flex-column-mobile {
    flex-direction: column;
}

@media (min-width: 768px) {
    .flex-column-mobile {
        flex-direction: row;
    }
}

/* Gap responsivo */
.gap-responsive {
    gap: 12px;
}

@media (min-width: 768px) {
    .gap-responsive {
        gap: 24px;
    }
}

/* Padding responsivo */
.p-responsive {
    padding: 16px;
}

@media (min-width: 768px) {
    .p-responsive {
        padding: 24px;
    }
}

@media (min-width: 992px) {
    .p-responsive {
        padding: 32px;
    }
}

/* =====================================================
   MOBILE MENU
   ===================================================== */
.mobile-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: min(100vw, 380px);
    max-width: 100vw;
    height: 100vh;
    background: var(--color-white);
    z-index: 10001;
    transition: left 0.3s ease;
    overflow-y: auto;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
}

.mobile-menu.active {
    left: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-gray-200);
}

.mobile-menu-logo img {
    max-height: 40px;
    filter: brightness(0);
}

.mobile-menu-close {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-gray-700);
    background: var(--color-gray-100);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-full);
}

.mobile-menu-nav {
    padding: 8px 0;
}

.mobile-nav-item,
.mobile-menu-item {
    border-bottom: 1px solid var(--color-gray-200);
}

.mobile-nav-link,
.mobile-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 4px;
    color: var(--color-gray-900);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--font-base);
    text-align: left;
    background: transparent;
    border: none;
    transition: color 0.2s ease;
}

.mobile-nav-link svg {
    color: var(--color-gray-600);
    transition: transform 0.2s ease;
}

.mobile-nav-item.open > .mobile-nav-link svg {
    transform: rotate(180deg);
}

.mobile-nav-submenu {
    display: none;
    padding: 0 0 10px 12px;
}

.mobile-nav-submenu.active {
    display: block;
}

.mobile-nav-submenu a {
    display: block;
    padding: 10px 0;
    color: var(--color-gray-600);
    font-size: var(--font-sm);
    text-decoration: none;
}

.mobile-nav-submenu-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 4px 0 12px;
    padding-right: 8px;
}

.mobile-nav-submenu-card {
    display: flex !important;
    flex-direction: column;
    gap: 6px;
    padding: 0 !important;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #fafafa;
}

.mobile-nav-submenu-card-media {
    width: 100%;
    aspect-ratio: 4 / 3;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

.mobile-nav-submenu-card-label {
    display: block;
    padding: 8px 10px 10px;
    color: var(--color-gray-800);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
}

.mobile-nav-submenu a strong {
    color: var(--color-gray-900);
}

.mobile-nav-link:hover,
.mobile-menu-item:hover,
.mobile-nav-submenu a:hover {
    background: var(--color-gray-50);
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* =====================================================
   TOUCH IMPROVEMENTS
   ===================================================== */
@media (hover: none) and (pointer: coarse) {
    /* Aumentar área de toque */
    .btn,
    .header-icon-btn,
    .mobile-nav-link,
    .mobile-menu-item,
    .product-card-gallery-nav button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remover hover effects em touch */
    .product-card:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
    
    /* Scroll suave em containers */
    .products-grid,
    .categories-grid,
    .account-tabs,
    .checkout-steps {
        -webkit-overflow-scrolling: touch;
    }
}

/* =====================================================
   PRINT STYLES
   ===================================================== */
@media print {
    .header,
    .footer,
    .mobile-menu,
    .cart-drawer,
    .whatsapp-float,
    .admin-sidebar {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    a {
        text-decoration: underline;
    }
    
    .btn {
        border: 1px solid #000;
        background: none !important;
        color: #000 !important;
    }
}

/* =====================================================
   LANDSCAPE MODE
   ===================================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: 100vh;
    }
    
    .hero-title {
        font-size: 24px;
    }
    
    .hero-subtitle {
        display: none;
    }
    
    .auth-page {
        min-height: 100vh;
        overflow-y: auto;
    }
}

/* =====================================================
   HIGH DPI / RETINA
   ===================================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Imagens mais nítidas */
    .header-logo img,
    .footer-logo img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* =====================================================
   DARK MODE (se implementado)
   ===================================================== */
@media (prefers-color-scheme: dark) {
    /* Adicionar estilos de dark mode aqui se necessário */
}

/* =====================================================
   REDUCED MOTION
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* =====================================================
   MOBILE HARDENING (GLOBAL)
   ===================================================== */
main,
.main-content {
    width: 100%;
    overflow-x: clip;
}

@media (max-width: 991px) {
    .hide-mobile {
        display: none !important;
    }

    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .hero {
        margin-top: var(--header-height);
    }

    .header-nav {
        display: none !important;
    }

    .mobile-menu-toggle {
        display: flex !important;
    }

    .mobile-menu {
        width: 100vw;
        max-width: 100vw;
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    .header-container {
        padding: 0 16px;
    }

    .header-actions {
        gap: 6px;
    }

    .header-action-btn {
        width: 38px;
        height: 38px;
    }

    .announcement-bar {
        font-size: 12px;
        line-height: 1.35;
    }

    .announcement-bar .container {
        padding-top: 4px;
        padding-bottom: 4px;
    }

    .footer-payments {
        flex-wrap: wrap;
        justify-content: center;
        row-gap: 6px;
    }
}

@media (max-width: 767px) {
    .cart-drawer {
        width: 100%;
        max-width: 100%;
        right: -100%;
    }

    .cart-drawer-body {
        padding: 12px;
    }

    .cart-drawer-footer {
        padding: 14px;
        padding-bottom: calc(14px + env(safe-area-inset-bottom));
    }

    .cart-total {
        margin-bottom: 12px;
    }

    .modal {
        width: calc(100% - 24px);
        margin: 0 12px;
        max-height: calc(100vh - 30px);
        overflow-y: auto;
    }

    .notification {
        left: 12px !important;
        right: 12px !important;
        top: calc(var(--header-height) + 12px) !important;
    }

    .home-banners {
        padding: 24px 0;
    }

    .banner-card-content {
        padding: 16px;
    }

    .banner-card-title {
        font-size: 1.25rem;
    }

    .cashback-item {
        font-size: 12px;
        padding: 0 14px;
    }
}

@media (max-width: 420px) {
    .mobile-nav-submenu-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575px) {
    .hero-content {
        padding: 0 16px;
    }

    .hero-title {
        font-size: clamp(1.6rem, 8vw, 2rem);
        line-height: 1.12;
    }

    .hero-description {
        font-size: 14px;
    }
}

@media (hover: none) and (pointer: coarse) {
    .product-quick-actions {
        opacity: 1;
        transform: none;
    }

    .product-gallery-dots {
        opacity: 1;
    }
}
