/* ============================================
   MidwifePlus Shop - Comprehensive Responsive Styles
   Mobile-First Approach with Fluid Design
   ============================================ */

/* ============================================
   CSS Custom Properties for Responsive Design
   ============================================ */
:root {
    --container-padding-mobile: 16px;
    --container-padding-tablet: 24px;
    --container-padding-desktop: 20px;
    --section-padding-mobile: 48px 0;
    --section-padding-tablet: 64px 0;
    --section-padding-desktop: 80px 0;
}

/* ============================================
   Base Fluid Typography
   ============================================ */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

/* Fluid font sizes using clamp() */
h1 {
    font-size: clamp(1.75rem, 5vw, 3rem);
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
}

h3 {
    font-size: clamp(1.125rem, 3vw, 1.5rem);
}

p {
    font-size: clamp(0.9rem, 2.5vw, 1rem);
}

/* ============================================
   Touch-Friendly Interactions
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets for mobile */
    .btn {
        min-height: 48px;
        min-width: 48px;
    }
    
    .nav-icon-btn {
        min-width: 48px;
        min-height: 48px;
    }
    
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Remove hover effects on touch devices */
    .btn:hover,
    .nav-link:hover,
    .product-card:hover,
    .value-card:hover {
        transform: none;
    }
}

/* ============================================
   Mobile Styles (up to 480px)
   ============================================ */
@media (max-width: 480px) {
    /* Container */
    .container {
        padding: 0 var(--container-padding-mobile);
    }
    
    /* Navigation */
    .navbar {
        padding: 0.625rem 0;
    }
    
    .logo {
        height: 32px;
    }
    
    .brand-name {
        font-size: 1rem;
        max-width: 120px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .nav-toggle {
        display: flex !important;
    }
    
    .nav-menu {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        flex-direction: column;
        padding: 1.5rem;
        gap: 0.5rem;
        transform: translateX(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        z-index: 999;
    }
    
    .nav-menu.active {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-link {
        width: 100%;
        padding: 1rem;
        font-size: 1.1rem;
        border-radius: 12px;
        background: var(--bg-cream);
        text-align: center;
    }
    
    .nav-actions {
        gap: 0.25rem;
    }
    
    .nav-actions .btn-primary {
        display: none;
    }
    
    /* Hero Slider */
    .slides {
        min-height: 500px;
    }
    
    .slide-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        min-height: auto;
        padding: 40px 0;
        text-align: center;
    }
    
    .slide-title {
        font-size: 1.75rem;
        margin-bottom: 1rem;
    }
    
    .slide-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .slide-buttons {
        justify-content: center;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .slide-buttons .btn {
        width: 100%;
    }
    
    .slide-image {
        order: -1;
    }
    
    .slide-icon-wrapper {
        width: 180px;
        height: 180px;
    }
    
    .slide-icon {
        width: 70px;
        height: 70px;
    }
    
    .slider-arrow {
        width: 40px;
        height: 40px;
    }
    
    .slider-arrow svg {
        width: 18px;
        height: 18px;
    }
    
    .slider-dots {
        bottom: 15px;
        gap: 8px;
    }
    
    .slider-dot {
        width: 8px;
        height: 8px;
    }
    
    /* Sections */
    section {
        padding: var(--section-padding-mobile);
    }
    
    .section-header {
        margin-bottom: 2rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .section-subtitle {
        font-size: 0.95rem;
    }
    
    /* Product Grid */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .product-card {
        padding: 0.75rem;
    }
    
    .product-image {
        height: 140px;
    }
    
    .product-title {
        font-size: 0.875rem;
    }
    
    .product-price {
        font-size: 1rem;
    }
    
    /* Footer */
    .footer {
        padding: 40px 0 20px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .footer-brand {
        justify-content: center;
    }
    
    .footer-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem 1rem;
    }
    
    .footer-links li {
        list-style: none;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .footer-social {
        justify-content: center;
    }
    
    /* Buttons */
    .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
        width: 100%;
    }
    
    .btn-full {
        width: 100%;
    }
    
    /* Forms */
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-input {
        padding: 14px 16px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Cards */
    .info-card,
    .value-card,
    .stat-card {
        padding: 1.5rem;
    }
    
    /* Cart Sidebar */
    .cart-sidebar {
        width: 100%;
        max-width: 100%;
    }
    
    /* User Menu */
    .user-dropdown {
        position: fixed;
        top: 60px;
        left: 16px;
        right: 16px;
        width: auto;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }
}

/* ============================================
   Small Tablets (481px - 768px)
   ============================================ */
@media (min-width: 481px) and (max-width: 768px) {
    .container {
        padding: 0 var(--container-padding-tablet);
    }
    
    /* Navigation */
    .navbar {
        padding: 0.75rem 0;
    }
    
    .logo {
        height: 36px;
    }
    
    .brand-name {
        font-size: 1.125rem;
    }
    
    .nav-toggle {
        display: flex !important;
    }
    
    .nav-menu {
        position: fixed;
        top: 68px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 1.5rem 2rem;
        gap: 0.5rem;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 999;
    }
    
    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-link {
        width: 100%;
        padding: 1rem 1.25rem;
        font-size: 1rem;
        border-radius: 10px;
    }
    
    /* Hero Slider */
    .slides {
        min-height: 550px;
    }
    
    .slide-content {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        min-height: auto;
        padding: 50px 0;
        text-align: center;
    }
    
    .slide-title {
        font-size: 2.25rem;
    }
    
    .slide-subtitle {
        font-size: 1.1rem;
    }
    
    .slide-buttons {
        justify-content: center;
    }
    
    .slide-image {
        order: -1;
    }
    
    .slide-icon-wrapper {
        width: 220px;
        height: 220px;
    }
    
    .slide-icon {
        width: 90px;
        height: 90px;
    }
    
    /* Sections */
    section {
        padding: var(--section-padding-tablet);
    }
    
    /* Product Grid */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .product-image {
        height: 180px;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
    
    .footer-section:first-child {
        grid-column: 1 / -1;
        text-align: center;
    }
    
    .footer-brand {
        justify-content: center;
    }
    
    /* Values Grid */
    .values-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Options Grid */
    .options-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto;
    }
    
    /* Policy Highlights */
    .policy-highlights {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto 3rem;
    }
    
    /* Process Steps */
    .process-steps {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Contact Grid */
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .contact-info {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* CTA Grid */
    .cta-grid {
        grid-template-columns: 1fr;
    }
    
    /* Why Grid */
    .why-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .why-stats {
        max-width: 400px;
        margin: 0 auto;
    }
    
    /* Story Grid */
    .story-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
}

/* ============================================
   Large Tablets (769px - 1024px)
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 0 var(--container-padding-tablet);
    }
    
    /* Navigation */
    .nav-menu {
        gap: 0.25rem;
    }
    
    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .brand-name {
        font-size: 1.25rem;
    }
    
    /* Hero Slider */
    .slide-content {
        gap: 2rem;
        padding: 60px 0;
    }
    
    .slide-title {
        font-size: 2.75rem;
    }
    
    .slide-icon-wrapper {
        width: 250px;
        height: 250px;
    }
    
    .slide-icon {
        width: 100px;
        height: 100px;
    }
    
    /* Sections */
    section {
        padding: var(--section-padding-tablet);
    }
    
    /* Product Grid */
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1.5fr 1fr 1fr;
    }
    
    /* Values Grid */
    .values-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Options Grid */
    .options-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Contact Grid */
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .contact-info {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Story Grid */
    .story-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    /* Why Grid */
    .why-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .why-stats {
        grid-template-columns: repeat(4, 1fr);
        max-width: 100%;
    }
}

/* ============================================
   Desktop (1025px and up)
   ============================================ */
@media (min-width: 1025px) {
    .container {
        padding: 0 var(--container-padding-desktop);
    }
    
    section {
        padding: var(--section-padding-desktop);
    }
    
    /* Product Grid */
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Values Grid */
    .values-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Options Grid */
    .options-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Policy Highlights */
    .policy-highlights {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Process Steps */
    .process-steps {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   Large Desktop (1400px and up)
   ============================================ */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .slide-title {
        font-size: 4rem;
    }
    
    .slide-icon-wrapper {
        width: 350px;
        height: 350px;
    }
    
    .slide-icon {
        width: 140px;
        height: 140px;
    }
}

/* ============================================
   Orientation - Landscape Mobile
   ============================================ */
@media (max-width: 896px) and (orientation: landscape) {
    .slides {
        min-height: 400px;
    }
    
    .slide-content {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        min-height: 400px;
        padding: 30px 0;
        text-align: left;
    }
    
    .slide-image {
        order: 0;
    }
    
    .slide-title {
        font-size: 1.75rem;
    }
    
    .slide-subtitle {
        font-size: 0.95rem;
        margin-bottom: 1rem;
    }
    
    .slide-icon-wrapper {
        width: 150px;
        height: 150px;
    }
    
    .slide-icon {
        width: 60px;
        height: 60px;
    }
    
    .slide-buttons {
        justify-content: flex-start;
    }
}

/* ============================================
   High DPI / Retina Displays
   ============================================ */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* ============================================
   Reduced Motion Preference
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .navbar,
    .footer,
    .nav-toggle,
    .cart-sidebar,
    .slider-nav,
    .slider-dots {
        display: none !important;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
}

/* ============================================
   Mobile Menu Overlay
   ============================================ */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 998;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   Fluid Spacing Utilities
   ============================================ */
.py-fluid {
    padding-top: clamp(2rem, 5vw, 5rem);
    padding-bottom: clamp(2rem, 5vw, 5rem);
}

.px-fluid {
    padding-left: clamp(1rem, 3vw, 2rem);
    padding-right: clamp(1rem, 3vw, 2rem);
}

.gap-fluid {
    gap: clamp(1rem, 3vw, 2rem);
}

.mb-fluid {
    margin-bottom: clamp(1rem, 3vw, 2rem);
}

/* ============================================
   Safe Area Insets (for notched devices)
   ============================================ */
@supports (padding: max(0px)) {
    .navbar {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
    
    .footer {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
    
    .nav-menu.active {
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }
}

/* ============================================
   Cart Sidebar Responsive
   ============================================ */
@media (max-width: 480px) {
    .cart-sidebar {
        width: 100%;
        border-radius: 0;
    }
    
    .cart-header {
        padding: 1rem;
    }
    
    .cart-content {
        padding: 1rem;
    }
    
    .cart-footer {
        padding: 1rem;
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* ============================================
   Auth Pages Responsive
   ============================================ */
@media (max-width: 480px) {
    .auth-section {
        padding: 40px 0;
    }
    
    .auth-card {
        padding: 1.5rem;
        margin: 0 1rem;
        border-radius: 16px;
    }
    
    .auth-title {
        font-size: 1.5rem;
    }
    
    .auth-subtitle {
        font-size: 0.9rem;
    }
}

/* ============================================
   Checkout Page Responsive
   ============================================ */
@media (max-width: 768px) {
    .checkout-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .checkout-form-section {
        order: 1;
    }
    
    .checkout-summary-section {
        order: 2;
    }
    
    .progress-steps {
        gap: 0.5rem;
    }
    
    .progress-step {
        flex-direction: column;
        gap: 0.25rem;
        font-size: 0.75rem;
    }
    
    .progress-step .step-number {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
}

/* ============================================
   Profile Page Responsive
   ============================================ */
@media (max-width: 768px) {
    .profile-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .profile-sidebar {
        position: static;
    }
    
    .profile-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .profile-nav-item {
        flex: 1 1 auto;
        text-align: center;
        min-width: 100px;
    }
}

/* ============================================
   Admin Dashboard Responsive
   ============================================ */
@media (max-width: 768px) {
    .admin-sidebar {
        position: fixed;
        left: -280px;
        transition: left 0.3s ease;
        z-index: 1000;
    }
    
    .admin-sidebar.active {
        left: 0;
    }
    
    .admin-main {
        margin-left: 0;
    }
    
    .admin-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stat-cards {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Product Detail Page Responsive
   ============================================ */
@media (max-width: 768px) {
    .product-detail-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .product-gallery {
        max-height: 400px;
    }
    
    .product-thumbnails {
        justify-content: center;
    }
    
    .product-info {
        text-align: center;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .quantity-selector {
        justify-content: center;
    }
}

/* ============================================
   FAQ Page Responsive
   ============================================ */
@media (max-width: 480px) {
    .faq-question {
        padding: 1rem;
        font-size: 0.9rem;
        text-align: left;
    }
    
    .faq-answer {
        font-size: 0.9rem;
    }
    
    .faq-item.active .faq-answer {
        padding: 0 1rem 1rem;
    }
    
    .faq-category-title {
        font-size: 1.25rem;
    }
}

/* ============================================
   Tables Responsive
   ============================================ */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
    }
}

/* ============================================
   Modal Responsive
   ============================================ */
@media (max-width: 480px) {
    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
        border-radius: 16px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
}

/* ============================================
   Image Responsive
   ============================================ */
img {
    max-width: 100%;
    height: auto;
}

.img-fluid {
    max-width: 100%;
    height: auto;
}

/* ============================================
   Hide/Show Utilities
   ============================================ */
.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile {
        display: block !important;
    }
}

.hide-tablet {
    display: block;
}

.show-tablet {
    display: none;
}

@media (min-width: 481px) and (max-width: 1024px) {
    .hide-tablet {
        display: none !important;
    }
    
    .show-tablet {
        display: block !important;
    }
}

.hide-desktop {
    display: block;
}

.show-desktop {
    display: none;
}

@media (min-width: 1025px) {
    .hide-desktop {
        display: none !important;
    }
    
    .show-desktop {
        display: block !important;
    }
}
