/* Responsive Fixes and Modern Styling for KanzuShop */
/* Fixes for iPhone X, color consistency, slider issues, and responsive design */

/* Reset and base styles */
* {
    box-sizing: border-box;
}

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

body {
    font-family: 'Fira Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Fix for iPhone X and notch devices */
@supports (padding: max(0px)) {
    .safe-area-top {
        padding-top: max(1rem, env(safe-area-inset-top));
    }

    .safe-area-bottom {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .safe-area-left {
        padding-left: max(1rem, env(safe-area-inset-left));
    }

    .safe-area-right {
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* Button color consistency fix - ensures same colors across all devices */
/* .btn-primary, 
button[type="submit"],
.bg-green-600,
.checkout-btn,
.payment-btn,
.bg-gradient-to-r.from-emerald-600,
button.bg-gradient-to-r {
    background: #16a34a !important;
    background-color: #16a34a !important;
    background-image: none !important;
    border-color: #16a34a !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    color: white !important;
} */
/* 
.btn-primary:hover,
button[type="submit"]:hover,
.bg-green-600:hover,
.checkout-btn:hover,
.payment-btn:hover {
    background: #15803d !important;
    background-color: #15803d !important;
    border-color: #15803d !important;
}

.btn-secondary,
.bg-blue-600 {
    background: #2563eb !important;
    background-color: #2563eb !important;
    border-color: #2563eb !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.btn-secondary:hover,
.bg-blue-600:hover {
    background: #1d4ed8 !important;
    background-color: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
} */

/* Slider fixes - prevent vertical stretching and maintain aspect ratio */
.slider-container {
    position: relative;
    overflow: hidden;
    border-radius: 0 0 1.5rem 1.5rem;
}

.slides {
    display: flex;
    transition: transform 0.7s ease-in-out;
    min-height: 280px;
}

.slide {
    flex: 0 0 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e40af 0%, #7c3aed 50%, #ec4899 100%);
    cursor: pointer;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    /* Prevent stretching */
    object-position: center;
    max-height: 400px;
}

/* Slider controls - smaller on mobile */
.slider-controls {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.75rem;
    bottom: 1rem;
}

.slider-controls button {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.slider-controls button.active {
    background: #22c55e;
    width: 18px;
    border-radius: 3px;
}

@media (min-width: 768px) {
    .slider-controls {
        bottom: 2rem;
        gap: 1rem;
    }

    .slider-controls button {
        width: 8px;
        height: 8px;
    }

    .slider-controls button.active {
        width: 24px;
        border-radius: 4px;
    }
}

/* Responsive slider heights */
@media (max-width: 640px) {
    .slides {
        min-height: 250px;
    }

    .slide img {
        max-height: 250px;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .slides {
        min-height: 350px;
    }

    .slide img {
        max-height: 350px;
    }
}

@media (min-width: 1025px) {
    .slides {
        min-height: 450px;
    }

    .slide img {
        max-height: 450px;
    }
}

/* Product card improvements */
.product-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
}

.product-card img {
    transition: transform 0.3s ease;
    object-fit: contain !important;
    width: 100%;
    height: 200px !important;
    background: transparent !important;
}

.product-card:hover img {
    transform: scale(1.05);
}

/* Image aspect ratio fixes */
#mainImage,
.thumbnail {
    object-fit: contain !important;
    background: transparent !important;
}

#mainImage {
    aspect-ratio: 16/10;
    width: 100%;
    height: auto;
    max-height: 400px;
}

.thumbnail {
    aspect-ratio: 16/10;
    width: 100%;
    height: auto;
}

/* Price display improvements for mobile */
.price-box {
    background: linear-gradient(135deg, #fef2f2 0%, #fef3c7 50%, #fefce8 100%);
    border: 2px solid #fca5a5;
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.price-main {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.current-price {
    font-size: 1.875rem;
    font-weight: 700;
    color: #dc2626;
    line-height: 1.2;
}

.old-price {
    font-size: 1.125rem;
    color: #6b7280;
    text-decoration: line-through;
    line-height: 1.2;
}

.savings-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    padding: 0.5rem 0.75rem;
    border-radius: 9999px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    width: fit-content;
    font-size: 0.875rem;
    font-weight: 600;
}

.savings-badge i {
    color: #16a34a;
}

.savings-amount {
    color: #16a34a;
    font-weight: 700;
}

@media (min-width: 640px) {
    .price-box {
        padding: 1.5rem;
    }

    .price-main {
        flex-direction: row;
        align-items: baseline;
        gap: 1rem;
        margin-bottom: 0.5rem;
    }

    .current-price {
        font-size: 2.5rem;
    }

    .old-price {
        font-size: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .current-price {
        font-size: 3rem;
    }

    .old-price {
        font-size: 1.5rem;
    }
}

/* Cart item responsive improvements */
.cart-item {
    border-radius: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 1rem;
    background: white;
    border: 1px solid #f3f4f6;
    transition: all 0.2s ease;
}

/* Cart item mobile redesign */
.cart-item {
    background: white;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #f3f4f6;
    transition: all 0.2s ease;
    display: flex;
    gap: 1rem;
}

.cart-item:hover {
    background: #f9fafb;
    border-color: #e5e7eb;
}

.cart-item {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.cart-item-header {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.cart-item-image {
    width: 320px;
    height: fit-content;
    flex-shrink: 0;
    object-fit: contain;
    border-radius: 0.5rem;
    background: #f9fafb;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.5rem;
    line-height: 1.25;
}

.cart-item-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.cart-item-spec {
    font-size: 0.925rem;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.cart-item-price {
    font-size: 2rem;
    font-weight: 700;
    color: #dc2626;
    margin-bottom: 0.25rem;
}

.cart-item-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid #f3f4f6;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 640px) {
    .cart-item {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .cart-item-header {
        display: flex;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .cart-item-image {
        width: 80px;
        height: 80px;
        flex-shrink: 0;
        object-fit: contain;
        border-radius: 0.5rem;
        background: #f9fafb;
    }

    .cart-item-info {
        flex: 1;
        min-width: 0;
    }

    .cart-item-title {
        font-size: 0.875rem;
        font-weight: 600;
        color: #111827;
        margin-bottom: 0.5rem;
        line-height: 1.25;
    }

    .cart-item-specs {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
        margin-bottom: 0.5rem;
    }

    .cart-item-spec {
        font-size: 0.625rem;
        padding: 0.125rem 0.375rem;
        border-radius: 0.25rem;
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
    }

    .cart-item-price {
        font-size: 1rem;
        font-weight: 700;
        color: #dc2626;
        margin-bottom: 0.25rem;
    }

    .cart-item-actions {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-top: 0.75rem;
        border-top: 1px solid #f3f4f6;
    }

    .cart-item-quantity {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
}

/* Mobile navigation improvements */
@media (max-width: 768px) {
    .mobile-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e5e7eb;
        padding: 0.75rem;
        z-index: 50;
        display: flex;
        justify-content: space-around;
        align-items: center;
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 0.5rem;
        text-decoration: none;
        color: #6b7280;
        font-size: 0.75rem;
        transition: color 0.2s;
    }

    .mobile-nav-item:hover,
    .mobile-nav-item.active {
        color: #16a34a;
    }

    .mobile-nav-item i {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
    }

}

/* Form improvements for better mobile experience */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
textarea,
select {
    -webkit-appearance: none !important;
    appearance: none !important;
    border-radius: 0.75rem !important;
    font-size: 16px !important;
    /* Prevents zoom on iOS */
    padding: 0.875rem 1rem !important;
    border: 2px solid #e5e7eb !important;
    transition: all 0.2s ease !important;
    background-color: white !important;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
textarea:focus,
select:focus {
    border-color: #16a34a !important;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.1) !important;
    outline: none !important;
}

/* Improved spacing for mobile */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .grid {
        gap: 1rem !important;
    }

    .space-y-4>*+* {
        margin-top: 1rem !important;
    }

    .space-y-6>*+* {
        margin-top: 1.5rem !important;
    }

    /* Reduce font sizes on mobile for better fit */
    h1 {
        font-size: 1.875rem !important;
        /* 30px */
    }

    h2 {
        font-size: 1.5rem !important;
        /* 24px */
    }

    h3 {
        font-size: 1.25rem !important;
        /* 20px */
    }
}

/* Cart and checkout improvements */
.cart-item {
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    background: white;
    border: 1px solid #f3f4f6;
    transition: all 0.2s ease;
}

.cart-item:hover {
    background-color: #f9fafb;
    border-color: #e5e7eb;
}

/* Quantity controls */
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #f9fafb;
    border-radius: 0.75rem;
    padding: 0.5rem;
    border: 2px solid #e5e7eb;
}

.quantity-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    background: white;
    border: 1px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}

.quantity-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.quantity-btn:active {
    transform: scale(0.95);
}

/* Modal improvements */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Loading states */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.5rem;
    height: 1.5rem;
    margin: -0.75rem 0 0 -0.75rem;
    border: 2px solid #f3f4f6;
    border-top: 2px solid #16a34a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus states for better accessibility */
button:focus,
input:focus,
textarea:focus,
select:focus,
a:focus {
    outline: 2px solid #16a34a;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .product-card {
        border: 2px solid #000;
    }

    button {
        border: 2px solid #000;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .product-card {
        border: 1px solid #000;
        break-inside: avoid;
    }
}

/* Improved touch targets for mobile */
@media (max-width: 768px) {

    button,
    .btn,
    .clickable {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1rem;
    }

    .cart-item button {
        min-height: 40px;
        min-width: 40px;
    }
}

/* Font standardization - Fira Sans */
body,
html {
    font-family: 'Fira Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-weight: 400;
    line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Fira Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-weight: 600;
}

.font-bold {
    font-weight: 700 !important;
}

.font-semibold {
    font-weight: 600 !important;
}

.font-medium {
    font-weight: 500 !important;
}

/* Fix for iOS Safari viewport height issues */
@supports (-webkit-touch-callout: none) {
    .min-h-screen {
        min-height: -webkit-fill-available;
    }
}

/* Remove excessive margins */
@media (max-width: 768px) {
    .mb-12 {
        margin-bottom: 2rem !important;
    }

    .mb-8 {
        margin-bottom: 1.5rem !important;
    }

    .mb-6 {
        margin-bottom: 1rem !important;
    }

    .py-12 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    .py-8 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
}

/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
}

/* Better text rendering */
body {
    text-rendering: optimizeLegibility;
    -webkit-font-feature-settings: "kern" 1;
    font-feature-settings: "kern" 1;
}

/* Prevent horizontal scroll on mobile */
body {
    overflow-x: hidden;
}

/* Improved table responsiveness */
@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
}

