/**
 * Sanavi Print Point - Responsive Styles
 * Mobile-first responsive design for WebView compatibility
 */

/* ================================================
   EXTRA LARGE SCREENS (1400px+)
   ================================================ */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .hero-title {
        font-size: var(--text-6xl);
    }
}

/* ================================================
   LARGE SCREENS (1200px - 1399px)
   ================================================ */
@media (max-width: 1399px) {
    .footer-grid {
        grid-template-columns: 1.5fr 1fr 1fr 1fr 1.5fr;
    }
}

/* ================================================
   MEDIUM-LARGE SCREENS (992px - 1199px)
   ================================================ */
@media (max-width: 1199px) {
    .container {
        max-width: 960px;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-6);
    }
    
    .footer-brand {
        grid-column: span 3;
        text-align: center;
        margin-bottom: var(--space-6);
    }
    
    .footer-social {
        justify-content: center;
    }
    
    .mega-menu-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .mega-menu-featured {
        display: none;
    }
    
    .hero-title {
        font-size: var(--text-4xl);
    }
    
    .hero-features {
        flex-wrap: wrap;
        gap: var(--space-6);
    }
}

/* ================================================
   TABLETS (768px - 991px)
   ================================================ */
@media (max-width: 991px) {
    :root {
        --header-height: 70px;
    }
    
    .container {
        max-width: 720px;
    }
    
    /* Topbar */
    .topbar-left {
        display: none;
    }
    
    .topbar-content {
        justify-content: center;
    }
    
    /* Header */
    .header-main {
        flex-wrap: wrap;
        padding: var(--space-3) 0;
    }
    
    .logo img {
        height: 40px;
    }
    
    .search-bar {
        order: 3;
        width: 100%;
        max-width: 100%;
        margin-top: var(--space-3);
    }
    
    .menu-toggle {
        display: flex;
        order: 2;
    }
    
    .header-actions {
        order: 1;
        margin-left: auto;
        margin-right: var(--space-4);
    }
    
    .header-action span {
        display: none;
    }
    
    /* Navigation */
    .nav-wrapper {
        position: fixed;
        top: 0;
        left: -100%;
        width: 300px;
        max-width: 300px;
        height: 100vh;
        background: var(--secondary);
        z-index: var(--z-modal);
        transition: left var(--transition-slow);
        overflow-y: auto;
        display: block;
        justify-content: flex-start;
    }
    
    .nav-wrapper.active {
        left: 0;
    }
    
    .nav-wrapper > .container {
        background: transparent;
        max-width: 100%;
        padding: 0;
        margin: 0;
    }
    
    .nav-close {
        display: flex;
    }
    
    .nav-main {
        flex-direction: column;
        padding: var(--space-20) var(--space-4) var(--space-4);
    }
    
    .nav-main ul {
        flex-direction: column;
        width: 100%;
        align-items: flex-end;
    }
    
    .nav-main > ul > li > a {
        padding: var(--space-4);
        padding-right: var(--space-6);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        text-align: right;
        justify-content: flex-end;
    }
    
    .nav-main > ul > li {
        text-align: right;
        width: 100%;
    }
    
    .dropdown-menu,
    .mega-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none !important;
        box-shadow: none;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 0;
        display: none;
        width: 100% !important;
        max-width: 100% !important;
        left: 0 !important;
        margin-left: 0 !important;
    }
    
    .nav-main > ul > li.active .dropdown-menu,
    .nav-main > ul > li.active .mega-menu {
        display: block;
    }
    
    .dropdown-menu li a {
        color: var(--gray-300);
        border-bottom-color: rgba(255, 255, 255, 0.05);
    }
    
    .dropdown-menu li a:hover {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .mega-menu-grid,
    .mega-menu-grid.mega-menu-5col,
    .mega-menu-grid.mega-menu-6col {
        grid-template-columns: 1fr !important;
        gap: var(--space-4);
    }
    
    .mega-menu-col h4 {
        color: var(--primary);
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    
    .mega-menu-col ul li a {
        color: var(--gray-300);
    }
    
    /* Categories Mega Menu Mobile */
    .categories-mega-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none !important;
        box-shadow: none;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 0;
        display: none;
        width: 100% !important;
        max-width: 100% !important;
        left: 0 !important;
    }
    
    .nav-main > ul > li.active .categories-mega-menu {
        display: block;
    }
    
    .categories-mega-menu-grid {
        grid-template-columns: 1fr !important;
        gap: var(--space-3);
    }
    
    .categories-mega-menu-grid > div {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding-right: 0;
        padding-bottom: var(--space-3);
    }
    
    .categories-mega-menu-grid > div:last-child {
        border-bottom: none;
    }
    
    .categories-mega-menu-grid h4 {
        color: var(--primary);
    }
    
    .categories-mega-menu-grid h4 a {
        color: inherit;
    }
    
    .categories-mega-menu-grid ul li a {
        color: var(--gray-300);
    }
    
    .nav-close {
        position: absolute;
        top: var(--space-4);
        right: var(--space-4);
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-full);
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--white);
        font-size: var(--text-xl);
    }
    
    /* Nav Overlay */
    .nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: calc(var(--z-modal) - 1);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition);
    }
    
    .nav-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Hero */
    .hero-slide {
        min-height: 450px;
    }
    
    .hero-title {
        font-size: var(--text-3xl);
    }
    
    .hero-description {
        font-size: var(--text-base);
    }
    
    .hero-features {
        display: none;
    }
    
    /* Products */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-4);
    }
    
    /* Categories */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-4);
    }
    
    .category-card {
        height: 220px;
    }
    
    /* Features */
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-4);
    }
    
    .feature-card {
        padding: var(--space-6);
    }
    
    /* CTA */
    .cta-content {
        flex-direction: column;
        text-align: center;
    }
    
    .cta-features {
        justify-content: center;
    }
    
    /* Testimonials */
    .testimonials-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Footer */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-brand {
        grid-column: span 2;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        gap: var(--space-4);
        text-align: center;
    }
    
    /* Section headers */
    .section-title {
        font-size: var(--text-3xl);
    }
    
    .section-subtitle::before,
    .section-subtitle::after {
        width: 20px;
    }
}

/* ================================================
   MOBILE LANDSCAPE (576px - 767px)
   ================================================ */
@media (max-width: 767px) {
    .container {
        max-width: 540px;
    }
    
    .section {
        padding: var(--space-12) 0;
    }
    
    .section-lg {
        padding: var(--space-16) 0;
    }
    
    /* Hero */
    .hero-slide {
        min-height: 400px;
    }
    
    .hero-content {
        padding: var(--space-8) 0;
    }
    
    .hero-badge {
        padding: var(--space-1) var(--space-3);
        font-size: var(--text-xs);
    }
    
    .hero-title {
        font-size: var(--text-2xl);
    }
    
    .hero-actions {
        flex-direction: column;
    }
    
    .hero-actions .btn {
        width: 100%;
    }
    
    /* Category Strip */
    .category-strip-item {
        width: 110px;
        min-width: 110px;
        max-width: 110px;
    }
    
    .category-strip-icon {
        width: 50px;
        height: 50px;
    }
    
    .category-strip-icon i {
        font-size: var(--text-xl);
    }
    
    /* Products */
    .product-info {
        padding: var(--space-3);
    }
    
    .product-title {
        font-size: var(--text-sm);
    }
    
    .product-price-current {
        font-size: var(--text-base);
    }
    
    /* Testimonials */
    .testimonials-grid {
        grid-template-columns: 1fr;
    }
    
    .testimonial-card {
        padding: var(--space-6);
    }
    
    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .footer-brand {
        grid-column: span 1;
    }
    
    .footer-col h4::after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .footer-contact-item {
        justify-content: center;
    }
    
    .newsletter-form {
        flex-direction: column;
    }
    
    /* Page header */
    .page-title {
        font-size: var(--text-3xl);
    }
    
    .breadcrumb {
        flex-wrap: wrap;
    }
}

/* ================================================
   MOBILE PORTRAIT (max-width: 575px)
   ================================================ */
@media (max-width: 575px) {
    :root {
        --header-height: 60px;
    }
    
    .container {
        padding: 0 var(--space-3);
    }
    
    /* Topbar */
    .topbar {
        padding: var(--space-1) 0;
    }
    
    .topbar-promo {
        font-size: var(--text-xs);
        padding: var(--space-1) var(--space-2);
    }
    
    .topbar-right {
        gap: var(--space-2);
    }
    
    /* Header */
    .logo img {
        height: 35px;
    }
    
    .logo-text {
        display: none;
    }
    
    .header-action {
        padding: var(--space-2);
    }
    
    .header-action i {
        font-size: var(--text-lg);
    }
    
    .search-bar input {
        padding: var(--space-2) var(--space-4);
    }
    
    .search-bar button {
        padding: var(--space-2) var(--space-4);
    }
    
    /* Hero */
    .hero-slide {
        min-height: 350px;
    }
    
    .hero-content {
        padding: var(--space-6) 0;
    }
    
    .hero-title {
        font-size: var(--text-xl);
        margin-bottom: var(--space-3);
    }
    
    .hero-description {
        font-size: var(--text-sm);
        margin-bottom: var(--space-6);
    }
    
    .hero-badge {
        margin-bottom: var(--space-4);
    }
    
    /* Section Headers */
    .section-header {
        margin-bottom: var(--space-8);
    }
    
    .section-title {
        font-size: var(--text-2xl);
    }
    
    .section-description {
        font-size: var(--text-base);
    }
    
    .section-subtitle {
        font-size: var(--text-xs);
        letter-spacing: 1px;
    }
    
    .section-subtitle::before,
    .section-subtitle::after {
        width: 15px;
    }
    
    /* Products */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
    }
    
    .product-card {
        border-radius: var(--radius);
    }
    
    .product-badges {
        top: var(--space-2);
        left: var(--space-2);
    }
    
    .product-badge {
        padding: 2px var(--space-2);
        font-size: 10px;
    }
    
    .product-info {
        padding: var(--space-2);
    }
    
    .product-category {
        font-size: 10px;
        margin-bottom: var(--space-1);
    }
    
    .product-title {
        font-size: var(--text-xs);
        margin-bottom: var(--space-1);
    }
    
    .product-rating {
        margin-bottom: var(--space-2);
    }
    
    .product-rating-stars i {
        font-size: 10px;
    }
    
    .product-price-current {
        font-size: var(--text-sm);
    }
    
    .product-price-original {
        font-size: var(--text-xs);
    }
    
    .product-delivery {
        display: none;
    }
    
    .product-actions {
        display: none;
    }
    
    /* Categories */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
    }
    
    .category-card {
        height: 180px;
        border-radius: var(--radius);
    }
    
    .category-card-content {
        padding: var(--space-4);
    }
    
    .category-card-icon {
        width: 40px;
        height: 40px;
        margin-bottom: var(--space-2);
    }
    
    .category-card-icon i {
        font-size: var(--text-lg);
    }
    
    .category-card h3 {
        font-size: var(--text-base);
    }
    
    .category-card p {
        display: none;
    }
    
    /* Features */
    .features-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
    
    .feature-card {
        padding: var(--space-5);
        display: flex;
        align-items: center;
        text-align: left;
        gap: var(--space-4);
    }
    
    .feature-icon {
        width: 60px;
        height: 60px;
        min-width: 60px;
        margin: 0;
    }
    
    .feature-icon i {
        font-size: var(--text-2xl);
    }
    
    .feature-card h3 {
        font-size: var(--text-base);
        margin-bottom: var(--space-1);
    }
    
    .feature-card p {
        font-size: var(--text-xs);
    }
    
    /* CTA */
    .cta-text h2 {
        font-size: var(--text-2xl);
    }
    
    .cta-text p {
        font-size: var(--text-base);
    }
    
    .cta-features {
        flex-direction: column;
        gap: var(--space-3);
    }
    
    .cta-actions .btn {
        min-width: 100%;
    }
    
    /* Testimonials */
    .testimonial-card {
        padding: var(--space-5);
    }
    
    .testimonial-text {
        font-size: var(--text-sm);
    }
    
    .testimonial-quote {
        font-size: 40px;
    }
    
    /* Footer */
    .footer-main {
        padding: var(--space-10) 0;
    }
    
    .footer-col h4 {
        font-size: var(--text-base);
    }
    
    .footer-links a {
        font-size: var(--text-xs);
    }
    
    /* Buttons */
    .btn {
        padding: var(--space-2) var(--space-4);
        font-size: var(--text-sm);
    }
    
    .btn-lg {
        padding: var(--space-3) var(--space-6);
    }
    
    /* Back to top & WhatsApp */
    .back-to-top {
        width: 40px;
        height: 40px;
        right: var(--space-4);
        bottom: var(--space-4);
    }
    
    .whatsapp-float {
        width: 45px;
        height: 45px;
        left: var(--space-4);
        bottom: var(--space-4);
    }
    
    /* Page Header */
    .page-header {
        padding: var(--space-8) 0;
    }
    
    .page-title {
        font-size: var(--text-2xl);
    }
    
    .breadcrumb {
        font-size: var(--text-xs);
    }
    
    /* Modal */
    .modal {
        padding: var(--space-5);
        width: 95%;
        border-radius: var(--radius-lg);
    }
    
    .modal-title {
        font-size: var(--text-xl);
    }
    
    /* Forms */
    .form-control {
        padding: var(--space-2) var(--space-3);
        font-size: var(--text-sm);
    }
    
    /* Pagination */
    .pagination-item {
        width: 36px;
        height: 36px;
        font-size: var(--text-sm);
    }
    
    /* Alerts */
    .alert {
        padding: var(--space-3);
        font-size: var(--text-sm);
    }
}

/* ================================================
   EXTRA SMALL DEVICES (max-width: 375px)
   ================================================ */
@media (max-width: 375px) {
    .logo img {
        height: 30px;
    }
    
    .header-actions {
        gap: 0;
    }
    
    .hero-title {
        font-size: var(--text-lg);
    }
    
    .section-title {
        font-size: var(--text-xl);
    }
    
    .products-grid {
        gap: var(--space-2);
    }
    
    .product-info {
        padding: var(--space-2);
    }
    
    .categories-grid {
        gap: var(--space-2);
    }
    
    .category-card {
        height: 150px;
    }
}

/* ================================================
   LANDSCAPE ORIENTATION FIXES
   ================================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-slide {
        min-height: 100vh;
    }
    
    .hero-content {
        padding: var(--space-4) 0;
    }
    
    .hero-title {
        font-size: var(--text-2xl);
    }
    
    .nav-wrapper {
        width: 100%;
    }
}

/* ================================================
   PRINT STYLES
   ================================================ */
@media print {
    .topbar,
    .header,
    .nav-wrapper,
    .hero,
    .back-to-top,
    .whatsapp-float,
    .footer {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    .product-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

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

/* ================================================
   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;
    }
}

/* ================================================
   DARK MODE SUPPORT
   ================================================ */
@media (prefers-color-scheme: dark) {
    /* Only apply if user hasn't explicitly chosen a theme */
    :root:not([data-theme]) {
        --gray-50: #2d2d44;
        --gray-100: #252538;
        --gray-200: #1e1e2e;
    }
}

/* ================================================
   TOUCH DEVICE OPTIMIZATIONS
   ================================================ */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch target sizes */
    .btn {
        min-height: 44px;
    }
    
    .header-action {
        min-width: 44px;
        min-height: 44px;
    }
    
    .nav-main > ul > li > a {
        min-height: 44px;
    }
    
    /* Disable hover effects that don't work on touch */
    .product-card:hover {
        transform: none;
    }
    
    .product-actions {
        opacity: 1;
        transform: none;
    }
    
    .product-quick-add,
    .product-view-details {
        transform: translateY(0);
    }
    
    .category-card:hover img {
        transform: none;
    }
}

/* ================================================
   SAFE AREA INSETS (for notched phones)
   ================================================ */
@supports (padding: max(0px)) {
    .topbar {
        padding-left: max(var(--space-4), env(safe-area-inset-left));
        padding-right: max(var(--space-4), env(safe-area-inset-right));
    }
    
    .container {
        padding-left: max(var(--space-4), env(safe-area-inset-left));
        padding-right: max(var(--space-4), env(safe-area-inset-right));
    }
    
    .footer-bottom {
        padding-bottom: max(var(--space-5), env(safe-area-inset-bottom));
    }
    
    .back-to-top {
        right: max(var(--space-8), env(safe-area-inset-right));
        bottom: max(var(--space-8), env(safe-area-inset-bottom));
    }
    
    .whatsapp-float {
        left: max(var(--space-8), env(safe-area-inset-left));
        bottom: max(var(--space-8), env(safe-area-inset-bottom));
    }
}

