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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    /* Mobile optimizations */
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Header */
header {
    text-align: center;
    padding: 2rem 1rem;
    background: rgba(255, 255, 255, 0.95);
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    color: #4a5568;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

header p {
    font-size: 1.2rem;
    color: #666;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 0 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Product Cards */
.product-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 3px solid transparent;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    border-color: #667eea;
}

/* Image Container */
.image-container {
    position: relative;
    width: 100%;
    height: 200px;
    margin-bottom: 1rem;
    border-radius: 10px;
    overflow: hidden;
    background: #f7fafc;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    transition: opacity 0.3s ease;
}

.product-image:not([src]), .product-image[src=""] {
    display: none;
}

.placeholder-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #a0aec0;
    background: linear-gradient(45deg, #f7fafc, #edf2f7);
}

.product-image[src]:not([src=""]) + .placeholder-img {
    display: none;
}

/* Product Info */
.product-card h3 {
    font-size: 1.5rem;
    color: #2d3748;
    margin-bottom: 0.5rem;
    text-align: center;
}

.price {
    font-size: 2rem;
    font-weight: bold;
    color: #38a169;
    text-align: center;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, #38a169, #48bb78);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Color Selector */
.color-selector {
    text-align: center;
}

.color-selector p {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #4a5568;
}

.order-info {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.order-info small {
    color: #666;
    font-size: 0.8rem;
    font-style: italic;
}

.color-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    justify-items: stretch;
}

/* Reorganize available vs unavailable colors */
.color-btn.available {
    order: 1;
}

.color-btn.unavailable {
    order: 2;
}

.color-btn {
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    min-height: 50px;
    /* Mobile touch optimizations */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    /* Dynamic visibility */
    display: block;
}

.color-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

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

/* Color-specific styling */
.color-btn.white {
    background: #ffffff;
    color: #333;
    border-color: #cbd5e0;
}

.color-btn.black {
    background: #000;
    color: white;
    border-color: #000;
}

.color-btn.green {
    background: #399e5a;
    color: white;
    border-color: #296c3f;
}

.color-btn.yellow {
    background: #fcdc09;
    color: black;
    border-color: #d69e2e;
}

.color-btn.red {
    background: #f75145;
    color: white;
    border-color: #b0382f;
}

.color-btn.gold {
    background: linear-gradient(45deg, #f8ac3e, #ffed4e);
    color: #744210;
    border-color: #ffd700;
}

.color-btn.orange {
    background: #f17918;
    color: white;
    border-color: #c06114;
}

.color-btn.purple {
    background: linear-gradient(45deg, #704fad, #8252db);
    color: white;
    border-color: #443068;
    position: relative;
    overflow: hidden;
}

.color-btn.blue {
    background: linear-gradient(45deg, #2e424a, #164d62);
    color: white;
    border-color: #192346;
    position: relative;
    overflow: hidden;
}

.color-btn.rainbow {
    background: linear-gradient(45deg, #8b0000,#00366b,  #204100);
    color: white;
    border-color: #460000;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

/* Sparkling effect for special colors */
.color-btn.purple::after,
.color-btn.blue::after {
    content: '✨';
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 0.8rem;
    animation: sparkle 2s infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* Contact Section */
.contact-section {
    background: rgba(255, 255, 255, 0.95);
    margin: 3rem 1rem 1rem;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.contact-section h2 {
    color: #2d3748;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.contact-section p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #4a5568;
}

.contact-section p:last-child {
    margin-top: 1rem;
    font-size: 1.2rem;
    color: #38a169;
    font-weight: bold;
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 768px) {
    header {
        padding: 1.5rem 0.5rem;
    }
    
    header h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    header p {
        font-size: 1.1rem;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0 0.75rem;
    }
    
    .product-card {
        padding: 1.25rem;
    }
    
    .image-container {
        height: 250px;
        margin-bottom: 1.25rem;
    }
    
    .product-card h3 {
        font-size: 1.4rem;
        margin-bottom: 0.75rem;
    }
    
    .price {
        font-size: 2.2rem;
        margin-bottom: 1.25rem;
    }
    
    .color-buttons {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 0.6rem;
    }
    
    .color-btn {
        padding: 0.9rem;
        font-size: 0.9rem;
        min-height: 52px;
        border-radius: 10px;
    }
    
    .contact-section {
        margin: 2rem 0.75rem 0.75rem;
        padding: 1.75rem;
    }
    
    .contact-section h2 {
        font-size: 1.8rem;
    }
    
    .contact-section p {
        font-size: 1.15rem;
        margin-bottom: 0.75rem;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    header {
        padding: 1rem 0.5rem;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .product-grid {
        padding: 0 0.5rem;
        gap: 1.25rem;
    }
    
    .product-card {
        padding: 1rem;
    }
    
    .image-container {
        height: 220px;
    }
    
    .color-buttons {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.75rem;
    }
    
    .color-btn {
        min-height: 55px;
        font-size: 1rem;
        padding: 1rem;
        font-weight: bold;
    }
    
    .contact-section {
        margin: 1.5rem 0.5rem 0.5rem;
        padding: 1.5rem;
    }
}

@media (max-width: 320px) {
    header h1 {
        font-size: 1.6rem;
    }
    
    .price {
        font-size: 2rem;
    }
    
    .color-btn {
        min-height: 60px;
        font-size: 1.1rem;
    }
}

/* Special color restrictions */
.single-color {
    display: flex;
    justify-content: center;
}

.single-color .color-btn {
    cursor: default;
    opacity: 0.9;
}

.limited-colors {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    max-width: 300px;
    margin: 0 auto;
}

.size-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.size-btn {
    text-align: center;
    line-height: 1.3;
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
}

.color-btn:disabled {
    cursor: default;
    opacity: 0.9;
}

.color-btn.selected {
    border-width: 3px;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Available vs Unavailable color styling */
.color-btn.available {
    opacity: 1;
    border-width: 2px;
}

.color-btn.unavailable {
    opacity: 0.6;
    border-style: dashed;
    border-width: 1px;
    background: #f8f9fa;
    color: #6c757d;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1.2;
}

.color-btn.unavailable small {
    font-size: 0.7rem;
    font-style: italic;
    color: #28a745;
    font-weight: normal;
}

.color-btn.unavailable:hover {
    opacity: 0.8;
    transform: scale(1.02);
}

/* Loading and Error States */
.product-image.loading {
    opacity: 0.5;
}

.product-image.error {
    display: none;
}