/* Mobile-Specific Enhancements */

/* Skip link for accessibility */
.skip-link:focus {
    position: absolute !important;
    top: 6px !important;
    left: 6px;
    background: #2563eb;
    color: white;
    padding: 8px 12px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 9999;
    font-size: 14px;
}

/* Mobile device specific styles */
.mobile-device {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

.ios-device {
    -webkit-overflow-scrolling: touch;
}

/* Enhanced hamburger menu animation */
.hamburger {
    width: 30px;
    height: 24px;
    position: relative;
    cursor: pointer;
    z-index: 1001;
}

.hamburger span {
    display: block;
    position: absolute;
    height: 3px;
    width: 100%;
    background: #333;
    border-radius: 2px;
    opacity: 1;
    left: 0;
    transform: rotate(0deg);
    transition: .25s ease-in-out;
}

.hamburger span:nth-child(1) {
    top: 0px;
}

.hamburger span:nth-child(2) {
    top: 10px;
}

.hamburger span:nth-child(3) {
    top: 20px;
}

.hamburger.active span:nth-child(1) {
    top: 10px;
    transform: rotate(135deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
    left: -60px;
}

.hamburger.active span:nth-child(3) {
    top: 10px;
    transform: rotate(-135deg);
}

/* Enhanced mobile navigation */
.nav-menu {
    transition: all 0.3s ease;
}

.nav-menu.active {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header hide/show animation for mobile */
.header {
    transition: transform 0.3s ease-in-out;
}

/* Touch-friendly button improvements */
@media (hover: none) and (pointer: coarse) {
    button, .btn, .add-to-cart, .cta-button {
        min-height: 44px;
        min-width: 44px;
        position: relative;
        overflow: hidden;
    }
    
    /* Add touch feedback */
    button:active, .btn:active, .add-to-cart:active, .cta-button:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    /* Touch ripple effect */
    button::after, .btn::after, .add-to-cart::after, .cta-button::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.3);
        transform: translate(-50%, -50%);
        transition: width 0.3s, height 0.3s;
    }
    
    button:active::after, .btn:active::after, 
    .add-to-cart:active::after, .cta-button:active::after {
        width: 100px;
        height: 100px;
    }
}

/* Improved form inputs for mobile */
input, textarea, select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 8px;
    font-size: 16px; /* Prevent zoom on iOS */
}

input:focus, textarea:focus, select:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Better cart sidebar for mobile */
@media (max-width: 768px) {
    .cart-sidebar {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }
    
    .cart-sidebar.open {
        animation: slideInRight 0.3s ease-out;
    }
    
    @keyframes slideInRight {
        from {
            transform: translateX(100%);
        }
        to {
            transform: translateX(0);
        }
    }
}

/* Improved product cards for touch */
.product-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

@media (hover: none) and (pointer: coarse) {
    .product-card:active {
        transform: scale(0.98);
    }
}

/* Better spacing for mobile content */
@media (max-width: 480px) {
    .hero-content {
        padding: 0 1rem;
    }
    
    .section-title {
        padding: 0 1rem;
    }
    
    .product-info {
        padding: 1rem;
    }
    
    .about-text, .contact-info {
        padding: 0 1rem;
    }
}

/* Improved loading states for mobile */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Better error states for mobile */
.error-message {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 8px 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-message::before {
    content: '⚠️';
    font-size: 16px;
}

.success-message {
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 8px 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.success-message::before {
    content: '✅';
    font-size: 16px;
}

/* Improved notification styles for mobile */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #2563eb;
    color: white;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    max-width: calc(100vw - 40px);
    animation: slideIn 0.3s ease-out;
}

@media (max-width: 480px) {
    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        text-align: center;
    }
}

/* Better focus indicators for mobile accessibility */
*:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

button:focus, .btn:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Improved cart item layout for mobile */
@media (max-width: 480px) {
    .cart-item {
        padding: 12px 0;
        border-bottom: 1px solid #f1f5f9;
    }
    
    .cart-item-image {
        width: 60px;
        height: 60px;
        border-radius: 6px;
    }
    
    .cart-item-info {
        flex: 1;
        min-width: 0; /* Allow text truncation */
    }
    
    .cart-item-title {
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .cart-item-price {
        font-size: 16px;
        font-weight: 700;
        color: #2563eb;
    }
}

/* Improved footer for mobile */
@media (max-width: 768px) {
    .footer-content {
        text-align: center;
    }
    
    .footer-section {
        margin-bottom: 2rem;
    }
    
    .social-links {
        justify-content: center;
        gap: 1.5rem;
    }
    
    .social-links a {
        font-size: 1.5rem;
        padding: 8px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.1);
        transition: background 0.3s ease;
    }
    
    .social-links a:hover {
        background: rgba(255, 255, 255, 0.2);
    }
}

/* Performance optimizations for mobile */
@media (max-width: 768px) {
    /* Reduce motion for users who prefer it */
    @media (prefers-reduced-motion: reduce) {
        *, *::before, *::after {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
    
    /* Optimize images for mobile */
    img {
        max-width: 100%;
        height: auto;
        display: block;
    }
    
    /* Improve text readability on mobile */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
    }
}
