/**
 * OyeMedical Mobile-First Styles
 * Beautiful responsive design for all mobile devices
 */

/* ============================================
   CSS Variables
   ============================================ */
:root {
    --mobile-nav-height: 65px;
    --mobile-header-height: 60px;
    --sage-green: #8B9D83;
    --light-sage: #A8B89F;
    --pale-sage: #C5D1BC;
    --mint-cream: #DDE8D5;
    --soft-olive: #9DAA94;
    --dark-sage: #5A6D52;
    --darker-sage: #3A4D32;
}

/* ============================================
   Mobile Bottom Navigation Bar
   ============================================ */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-nav-height);
    background: white;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1050;
    padding: 0.5rem 0;
    padding-bottom: env(safe-area-inset-bottom, 0.5rem);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.mobile-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #7A8D72;
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    position: relative;
}

.mobile-nav-item i {
    font-size: 1.4rem;
    margin-bottom: 0.2rem;
    transition: all 0.3s ease;
}

.mobile-nav-item.active,
.mobile-nav-item:hover {
    color: var(--dark-sage);
}

.mobile-nav-item.active i {
    transform: scale(1.1);
}

.mobile-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    width: 20px;
    height: 3px;
    background: linear-gradient(135deg, var(--sage-green) 0%, var(--dark-sage) 100%);
    border-radius: 2px;
}

.mobile-nav-item .nav-badge {
    position: absolute;
    top: 0;
    right: 5px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    font-size: 0.6rem;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Center cart button with special styling */
.mobile-nav-item.cart-center {
    position: relative;
}

.mobile-nav-item.cart-center .cart-icon-wrapper {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--sage-green) 0%, var(--dark-sage) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -25px;
    box-shadow: 0 4px 15px rgba(90, 109, 82, 0.4);
    transition: all 0.3s ease;
}

.mobile-nav-item.cart-center .cart-icon-wrapper i {
    color: white;
    font-size: 1.3rem;
    margin-bottom: 0;
}

.mobile-nav-item.cart-center:hover .cart-icon-wrapper {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(90, 109, 82, 0.5);
}

.mobile-nav-item.cart-center .nav-badge {
    top: -20px;
    right: 0;
}

.mobile-nav-item.cart-center span:last-child {
    margin-top: 0.3rem;
}

/* ============================================
   Mobile Header Adjustments
   ============================================ */
@media (max-width: 991px) {
    /* Simplified mobile header */
    .pastel-navbar {
        padding: 0.8rem 0 !important;
    }

    .navbar-brand-pastel {
        font-size: 1.4rem !important;
    }

    .navbar-brand-pastel i {
        font-size: 1.5rem !important;
    }

    /* Hide desktop navigation items on mobile */
    .navbar-collapse {
        background: white;
        border-radius: 20px;
        margin-top: 1rem;
        padding: 1rem;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    }

    .nav-link-pastel {
        padding: 0.8rem 1rem !important;
        margin: 0.2rem 0 !important;
        border-radius: 12px;
    }

    .nav-link-pastel:hover {
        background: var(--mint-cream);
    }

    /* Hide mobile icons section in navbar when bottom nav is active */
    .header-icons-mobile {
        display: none !important;
    }

    /* Add padding to body for bottom nav */
    body {
        padding-bottom: calc(var(--mobile-nav-height) + 10px);
    }

    /* Show mobile bottom nav */
    .mobile-bottom-nav {
        display: block;
    }
}

/* ============================================
   Mobile Hero Section
   ============================================ */
@media (max-width: 768px) {
    .pastel-hero {
        padding: 2.5rem 0 !important;
        text-align: center;
    }

    .pastel-title {
        font-size: 2rem !important;
        line-height: 1.3 !important;
    }

    .pastel-subtitle {
        font-size: 1rem !important;
        margin-bottom: 1.5rem !important;
    }

    .hero-badge {
        font-size: 0.8rem !important;
        padding: 0.5rem 1rem !important;
    }

    .btn-pastel {
        padding: 0.8rem 1.5rem !important;
        font-size: 0.9rem !important;
        width: 100%;
        margin: 0.3rem 0 !important;
    }

    .hero-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .hero-image img {
        max-width: 250px !important;
        margin-top: 2rem;
    }
}

/* ============================================
   Mobile Product Cards
   ============================================ */
@media (max-width: 768px) {
    .product-card-pastel {
        margin-bottom: 1rem;
        border-radius: 15px !important;
    }

    .product-card-pastel .card-body {
        padding: 1rem !important;
    }

    .product-title-pastel {
        font-size: 0.95rem !important;
        margin-bottom: 0.5rem !important;
    }

    .product-price-pastel {
        font-size: 1.1rem !important;
    }

    .product-category-pastel {
        font-size: 0.7rem !important;
    }

    /* 2-column grid on mobile */
    .products-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }

    .products-grid .col-md-4,
    .products-grid .col-lg-3 {
        width: 100%;
        padding: 0;
    }

    .product-image-container {
        height: 140px !important;
    }

    .product-image-container img {
        height: 100%;
        object-fit: cover;
    }

    .product-actions-pastel {
        flex-direction: column;
        gap: 0.5rem;
    }

    .product-actions-pastel .btn {
        width: 100%;
        padding: 0.6rem !important;
        font-size: 0.8rem !important;
    }

    .quick-actions-pastel {
        top: 5px !important;
        right: 5px !important;
    }

    .quick-action-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.9rem !important;
    }
}

/* ============================================
   Mobile Category Section
   ============================================ */
@media (max-width: 768px) {
    .category-scroll {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding: 1rem 0;
        gap: 1rem;
        scrollbar-width: none;
    }

    .category-scroll::-webkit-scrollbar {
        display: none;
    }

    .category-scroll .category-item {
        flex: 0 0 auto;
        width: 100px;
        scroll-snap-align: start;
    }

    .category-icon-pastel {
        width: 70px !important;
        height: 70px !important;
        font-size: 1.5rem !important;
    }

    .category-title-pastel {
        font-size: 0.8rem !important;
    }
}

/* ============================================
   Mobile Section Titles
   ============================================ */
@media (max-width: 768px) {
    .section-title {
        font-size: 1.5rem !important;
        margin-bottom: 1rem !important;
    }

    .section-subtitle {
        font-size: 0.9rem !important;
    }

    .pastel-section {
        padding: 2rem 0 !important;
    }

    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* ============================================
   Mobile Trust Badges
   ============================================ */
@media (max-width: 768px) {
    .trust-badges-pastel {
        padding: 1.5rem 1rem !important;
        margin: 2rem 0 !important;
        border-radius: 20px !important;
    }

    .trust-badge-item-pastel {
        padding: 0.8rem 0.5rem !important;
    }

    .trust-badge-icon {
        width: 50px !important;
        height: 50px !important;
        font-size: 1.3rem !important;
        margin-bottom: 0.8rem !important;
    }

    .trust-badge-title {
        font-size: 0.85rem !important;
    }

    .trust-badge-text {
        font-size: 0.75rem !important;
    }
}

/* ============================================
   Mobile Footer
   ============================================ */
@media (max-width: 768px) {
    .pastel-footer {
        padding: 2.5rem 0 calc(var(--mobile-nav-height) + 1.5rem) !important;
        margin-top: 2rem !important;
    }

    .footer-brand {
        font-size: 1.5rem !important;
        text-align: center;
    }

    .footer-description {
        text-align: center;
        font-size: 0.9rem !important;
    }

    .footer-contact {
        text-align: center;
    }

    .footer-section-title {
        font-size: 1.1rem !important;
        margin-bottom: 1rem !important;
        margin-top: 1.5rem;
    }

    .footer-link {
        padding: 0.4rem 0 !important;
        font-size: 0.9rem !important;
    }

    .social-links {
        justify-content: center;
    }

    .social-link {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.2rem !important;
    }

    .newsletter-form {
        flex-direction: column;
        border-radius: 15px !important;
        padding: 1rem !important;
    }

    .newsletter-input {
        width: 100%;
        margin-bottom: 0.5rem;
        text-align: center;
    }

    .newsletter-btn {
        width: 100%;
    }

    .footer-bottom-row {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .payment-icons {
        justify-content: center;
    }

    .payment-icon {
        height: 25px !important;
    }
}

/* ============================================
   Mobile Cart Page
   ============================================ */
@media (max-width: 768px) {
    .cart-item-row {
        flex-direction: column;
        padding: 1rem !important;
    }

    .cart-item-image {
        width: 100% !important;
        max-width: 150px;
        margin: 0 auto 1rem;
    }

    .cart-item-details {
        text-align: center;
        width: 100%;
    }

    .cart-item-title {
        font-size: 1rem !important;
    }

    .cart-quantity-controls {
        justify-content: center;
        margin: 1rem 0;
    }

    .cart-item-price {
        text-align: center;
        font-size: 1.2rem !important;
    }

    .cart-summary-card {
        position: relative !important;
        margin-top: 1.5rem;
    }

    .cart-summary-card .card-body {
        padding: 1.5rem !important;
    }
}

/* ============================================
   Mobile Product Detail Page
   ============================================ */
@media (max-width: 768px) {
    .product-detail-image {
        max-height: 300px;
        margin-bottom: 1.5rem;
    }

    .product-detail-title {
        font-size: 1.5rem !important;
    }

    .product-detail-price {
        font-size: 1.8rem !important;
    }

    .product-detail-description {
        font-size: 0.95rem !important;
    }

    .product-tabs .nav-link {
        padding: 0.6rem 1rem !important;
        font-size: 0.85rem !important;
    }

    .add-to-cart-btn {
        width: 100%;
        padding: 1rem !important;
        font-size: 1rem !important;
    }

    .quantity-selector {
        width: 100%;
        justify-content: center;
        margin-bottom: 1rem;
    }
}

/* ============================================
   Mobile Checkout Page
   ============================================ */
@media (max-width: 768px) {
    .checkout-steps {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 1rem;
    }

    .checkout-step {
        flex: 0 0 auto;
        min-width: 80px;
        font-size: 0.8rem;
    }

    .checkout-form .form-control {
        padding: 0.8rem 1rem !important;
        font-size: 1rem !important;
    }

    .checkout-form .form-label {
        font-size: 0.9rem !important;
    }

    .order-summary-mobile {
        position: fixed;
        bottom: var(--mobile-nav-height);
        left: 0;
        right: 0;
        background: white;
        padding: 1rem;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        z-index: 1040;
    }

    .place-order-btn {
        width: 100%;
        padding: 1rem !important;
        font-size: 1.1rem !important;
    }
}

/* ============================================
   Mobile Account Pages
   ============================================ */
@media (max-width: 768px) {
    .account-sidebar {
        display: none;
    }

    .account-nav-mobile {
        display: flex;
        overflow-x: auto;
        background: white;
        padding: 0.8rem;
        border-radius: 15px;
        margin-bottom: 1.5rem;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    }

    .account-nav-mobile a {
        flex: 0 0 auto;
        padding: 0.6rem 1rem;
        margin-right: 0.5rem;
        border-radius: 20px;
        font-size: 0.85rem;
        white-space: nowrap;
        color: var(--dark-sage);
        text-decoration: none;
        transition: all 0.3s;
    }

    .account-nav-mobile a.active,
    .account-nav-mobile a:hover {
        background: var(--mint-cream);
        color: var(--darker-sage);
    }

    .account-card {
        border-radius: 15px !important;
        margin-bottom: 1rem;
    }

    .account-card .card-header {
        padding: 1rem !important;
        font-size: 1rem !important;
    }

    .account-stats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }

    .account-stat-card {
        padding: 1rem !important;
        border-radius: 12px !important;
    }

    .account-stat-value {
        font-size: 1.5rem !important;
    }

    .account-stat-label {
        font-size: 0.8rem !important;
    }
}

/* ============================================
   Mobile Forms
   ============================================ */
@media (max-width: 768px) {
    .form-control,
    .form-select {
        padding: 0.9rem 1rem !important;
        font-size: 16px !important; /* Prevents iOS zoom */
        border-radius: 12px !important;
    }

    .form-label {
        font-size: 0.9rem !important;
        margin-bottom: 0.4rem !important;
    }

    .btn {
        padding: 0.8rem 1.5rem !important;
        font-size: 1rem !important;
        border-radius: 12px !important;
    }

    .btn-lg {
        padding: 1rem 2rem !important;
    }
}

/* ============================================
   Mobile Modals & Alerts
   ============================================ */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-content {
        border-radius: 20px !important;
    }

    .modal-header {
        padding: 1rem 1.2rem !important;
    }

    .modal-body {
        padding: 1.2rem !important;
    }

    .modal-footer {
        padding: 1rem 1.2rem !important;
        flex-direction: column;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        width: 100%;
        margin: 0 !important;
    }

    .alert {
        border-radius: 12px !important;
        padding: 1rem !important;
        font-size: 0.9rem !important;
    }
}

/* ============================================
   Mobile Search
   ============================================ */
@media (max-width: 768px) {
    .mobile-search-bar {
        display: block;
        padding: 0.8rem 1rem;
        background: white;
        margin: -0.5rem -15px 1rem;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    }

    .mobile-search-input {
        width: 100%;
        padding: 0.8rem 1rem 0.8rem 2.5rem;
        border: 2px solid var(--pale-sage);
        border-radius: 25px;
        font-size: 0.95rem;
        background: var(--mint-cream);
        transition: all 0.3s;
    }

    .mobile-search-input:focus {
        outline: none;
        border-color: var(--sage-green);
        background: white;
    }

    .mobile-search-wrapper {
        position: relative;
    }

    .mobile-search-wrapper i {
        position: absolute;
        left: 1rem;
        top: 50%;
        transform: translateY(-50%);
        color: var(--soft-olive);
    }
}

/* ============================================
   Mobile Animations & Transitions
   ============================================ */
@media (max-width: 768px) {
    .fade-in-up {
        animation: fadeInUp 0.5s ease forwards;
    }

    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .slide-in-right {
        animation: slideInRight 0.3s ease forwards;
    }

    @keyframes slideInRight {
        from {
            transform: translateX(100%);
        }
        to {
            transform: translateX(0);
        }
    }
}

/* ============================================
   Touch-Friendly Elements
   ============================================ */
@media (max-width: 768px) {
    /* Larger touch targets */
    a, button, .clickable {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    @media (hover: none) {
        .product-card-pastel:hover {
            transform: none;
            box-shadow: 0 8px 25px rgba(139, 157, 131, 0.15);
        }

        .btn:hover {
            transform: none;
        }

        .mobile-nav-item:hover {
            color: #7A8D72;
        }
    }

    /* Active states for touch */
    .btn:active {
        transform: scale(0.98);
    }

    .product-card-pastel:active {
        transform: scale(0.98);
    }

    .mobile-nav-item:active {
        transform: scale(0.95);
    }
}

/* ============================================
   Pull to Refresh Indicator
   ============================================ */
.pull-to-refresh {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--mint-cream);
    z-index: 1060;
    justify-content: center;
    align-items: center;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.pull-to-refresh.active {
    display: flex;
    transform: translateY(0);
}

.pull-to-refresh i {
    font-size: 1.5rem;
    color: var(--sage-green);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================================
   Skeleton Loading
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    height: 280px;
    margin-bottom: 1rem;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-text.short {
    width: 60%;
}

/* ============================================
   Safe Area for Notched Devices
   ============================================ */
@supports (padding: env(safe-area-inset-bottom)) {
    .mobile-bottom-nav {
        padding-bottom: calc(env(safe-area-inset-bottom) + 0.5rem);
    }

    body {
        padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 10px);
    }
}

/* ============================================
   Landscape Mode Adjustments
   ============================================ */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-bottom-nav {
        height: 55px;
    }

    .mobile-nav-item i {
        font-size: 1.2rem;
    }

    .mobile-nav-item.cart-center .cart-icon-wrapper {
        width: 40px;
        height: 40px;
        margin-top: -15px;
    }

    .pastel-hero {
        padding: 2rem 0 !important;
    }

    .pastel-title {
        font-size: 1.8rem !important;
    }
}

/* ============================================
   Dark Mode Support (Optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles here if needed */
}

/* ============================================
   High Contrast Mode Support
   ============================================ */
@media (prefers-contrast: high) {
    .mobile-bottom-nav {
        border-top: 2px solid var(--darker-sage);
    }

    .mobile-nav-item {
        font-weight: 600;
    }
}

/* ============================================
   Reduced Motion Support
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
