/* 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-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

header h2 {
    font-size: 1.2rem;
    font-weight: 300;
    opacity: 0.9;
}

.version-info {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 0.5rem;
    font-family: 'Courier New', monospace;
    cursor: pointer;
}

/* Header Layout */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-text {
    flex: 1;
}

/* Cart Indicator */
.cart-indicator {
    display: none;
    align-items: center;
    background: linear-gradient(135deg, #FFD700 0%, #FFC107 100%);
    color: #000;
    padding: 0.75rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
    gap: 0.5rem;
}

.cart-indicator:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    background: linear-gradient(135deg, #FFC107 0%, #FFB300 100%);
}

.cart-icon {
    font-size: 1.2rem;
}

.cart-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
}

.cart-count {
    font-size: 1.1rem;
    font-weight: 700;
}

.cart-label {
    font-size: 0.8rem;
    font-weight: 500;
}

/* Main content */
main {
    padding: 3rem 0;
}

/* Products grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* Product cards */
.product-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.product-image {
    height: 200px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.product-info {
    padding: 1.5rem;
}

.product-info h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.description {
    color: #6c757d;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #000000;
    margin-bottom: 1rem;
}

.product-link {
    display: inline-block;
    color: #007bff;
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

.product-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Product options */
.product-options {
    margin-bottom: 1.5rem;
}

.option-group {
    margin-bottom: 1rem;
}

.option-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #495057;
}

.option-group select,
.option-group input {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.option-group select:focus,
.option-group input:focus {
    outline: none;
    border-color: #000000;
}

.quantity-input {
    width: 80px !important;
}

/* Order button */
.order-btn {
    width: 100%;
    background: linear-gradient(135deg, #FFD700 0%, #FFC107 100%);
    color: #000;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
}

.order-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
    background: linear-gradient(135deg, #FFC107 0%, #FFB300 100%);
}

.stock-info {
    text-align: center;
    font-size: 0.8rem;
    color: #6c757d;
}

/* Size Information */
.size-info {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #FFD700;
}

.sizes-available {
    display: block;
    font-size: 0.9rem;
    color: #333;
    font-weight: 500;
    margin-bottom: 0.5rem;
}


/* Enhanced Modal System */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

/* Enhanced Modal Structure */
.enhanced-modal {
    width: 100%;
    height: 100vh;
    max-height: none;
    margin: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    background: white;
    flex-shrink: 0;
}

.modal-back-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    color: #666;
    transition: all 0.3s ease;
}

.modal-back-btn:hover {
    background-color: #f8f9fa;
    color: #333;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: #f8f9fa;
}

/* Modal Steps */
.modal-step {
    display: none;
}

.modal-step.active {
    display: block;
}

/* Order Items Styling */
.order-items {
    margin-bottom: 1.5rem;
}

.empty-order {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
    background: white;
    border-radius: 8px;
}

.order-item {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    gap: 0.75rem;
}

.order-item-image {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    align-self: center;
}

.order-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.order-item-details {
    text-align: center;
}

.order-item-details h4 {
    margin: 0 0 0.5rem 0;
    color: #333;
}

.order-item-details p {
    margin: 0.25rem 0;
    color: #666;
    font-size: 0.9rem;
}

.item-price {
    font-weight: 600;
    color: #000;
}

.order-item-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: white;
}

.quantity-btn {
    background: none;
    border: none;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    color: #666;
    transition: all 0.3s ease;
}

.quantity-btn:hover {
    background-color: #f8f9fa;
    color: #333;
}

.quantity-display {
    padding: 0 1rem;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

.remove-item-btn {
    background: #dc3545;
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.remove-item-btn:hover {
    background: #c82333;
    transform: scale(1.05);
}

.order-item-total {
    font-size: 1.1rem;
    font-weight: 700;
    color: #000;
    text-align: center;
}

/* Add Item Button */
.add-item-btn {
    width: 100%;
    padding: 1.25rem;
    border: 2px dashed #FFD700;
    background: #fffbf0;
    color: #333;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

.add-item-btn:hover {
    background: #FFD700;
    color: #000;
    border-style: solid;
    transform: translateY(-2px);
}

/* Order Total */
.order-total {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.total-line {
    font-size: 1.3rem;
    font-weight: 700;
    color: #000;
}

/* Step Actions */
.step-actions {
    margin-top: 1rem;
}

.primary-btn {
    width: 100%;
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.primary-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* Loading states */
.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -12px 0 0 -12px;
    width: 24px;
    height: 24px;
    border: 2px solid transparent;
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading.dark::before {
    border-top-color: #333;
}

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

/* Loading overlay for products grid */
/* Loading class - no styles needed, handled by loading-container */

/* Products in Modal Grid */
.products-modal-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    max-height: 60vh;
    overflow-y: auto;
}

.product-card-modal {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.product-card-modal:hover {
    border-color: #FFD700;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.2);
}

.product-image-modal {
    width: 100%;
    height: 120px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

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

.product-info-modal h4 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 1rem;
}

.product-info-modal .price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #000;
    margin: 0.25rem 0;
}

.product-info-modal .stock-info {
    font-size: 0.85rem;
    color: #666;
    margin: 0;
}

/* Selected Product Details */
.selected-product-info {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.product-image-large {
    width: 150px;
    height: 150px;
    border-radius: 8px;
    overflow: hidden;
    align-self: center;
}

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

.product-details {
    text-align: center;
}

.product-details h3 {
    margin: 0 0 0.75rem 0;
    color: #333;
    font-size: 1.3rem;
}

.product-details .description {
    margin: 0.5rem 0;
    color: #666;
    line-height: 1.4;
}

.product-details .price {
    font-size: 1.4rem;
    font-weight: 700;
    color: #000;
    margin: 0.75rem 0;
}

/* Product Options Form */
.product-options-form {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    color: #aaa;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

.modal h2 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
    text-align: center;
}

/* Selected product info */
.selected-product {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid #FFD700;
}

.selected-product h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.selected-product p {
    margin-bottom: 0.5rem;
}

.selected-product .total {
    font-size: 1.2rem;
    font-weight: 700;
    color: #000000;
    border-top: 1px solid #dee2e6;
    padding-top: 0.5rem;
    margin-top: 1rem;
}

/* Form styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #495057;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #000000;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Form actions */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.form-actions button {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#cancel-order {
    background: #6c757d;
    color: white;
}

#cancel-order:hover {
    background: #5a6268;
}

#submit-order {
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    color: white;
}

#submit-order:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Messages */
.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
}

.message {
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    border-radius: 6px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-width: 300px;
    animation: slideIn 0.3s ease;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Enhanced Responsive Design */

/* Tablet Styles (768px+) */
@media (min-width: 768px) {
    .enhanced-modal {
        width: 90%;
        height: 85vh;
        max-height: 85vh;
        margin: 7.5vh auto;
        border-radius: 12px;
    }

    .order-item {
        flex-direction: row;
        align-items: center;
        text-align: left;
    }

    .order-item-image {
        width: 100px;
        height: 100px;
        align-self: flex-start;
        margin-right: 1rem;
    }

    .order-item-details {
        flex: 1;
        text-align: left;
        margin-right: 1rem;
    }

    .order-item-controls {
        justify-content: flex-end;
    }

    .order-item-total {
        text-align: right;
        margin-left: 1rem;
    }

    .products-modal-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    .selected-product-info {
        flex-direction: row;
        text-align: left;
    }

    .product-image-large {
        width: 200px;
        height: 200px;
        margin-right: 1.5rem;
        align-self: flex-start;
    }

    .product-details {
        text-align: left;
    }

}

/* Desktop Styles (1024px+) */
@media (min-width: 1024px) {
    .enhanced-modal {
        width: 700px;
        max-width: 700px;
        height: 80vh;
        max-height: 80vh;
        margin: 10vh auto;
    }

    .products-modal-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .order-item-image {
        width: 120px;
        height: 120px;
    }

    .selected-product-info {
        gap: 2rem;
    }

    .product-image-large {
        width: 250px;
        height: 250px;
        margin-right: 2rem;
    }
}

/* Original responsive design for main layout */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    header h1 {
        font-size: 2rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .cart-indicator {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }

    .cart-label {
        font-size: 0.75rem;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions button {
        width: 100%;
    }

    .message {
        max-width: calc(100vw - 40px);
    }
}

@media (max-width: 480px) {
    header {
        padding: 1.5rem 0;
    }

    header h1 {
        font-size: 1.5rem;
    }

    header h2 {
        font-size: 1rem;
    }

    main {
        padding: 2rem 0;
    }

    .product-info {
        padding: 1rem;
    }

}

/* Out of Stock Styles */
.product-card.out-of-stock {
    opacity: 0.7;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
}

.product-card.out-of-stock .product-info {
    position: relative;
}

.out-of-stock-overlay {
    position: relative;
}

.out-of-stock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #dc3545;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 2;
}

.out-of-stock-text {
    color: #dc3545;
    font-weight: 600;
}

.order-btn.disabled {
    background-color: #6c757d;
    color: #ffffff;
    cursor: not-allowed;
    opacity: 0.6;
}

.order-btn.disabled:hover {
    background-color: #6c757d;
    transform: none;
    box-shadow: none;
}

.product-card-modal.out-of-stock {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
}

.product-card-modal.disabled:hover {
    transform: none;
    box-shadow: none;
    background-color: #f8f9fa;
}

.product-image-modal {
    position: relative;
}

/* Product Actions Layout */
.product-actions {
    display: flex;
    gap: 8px;
    margin: 10px 0;
    align-items: center;
}

/* Question Button Styles */
.question-btn {
    background: linear-gradient(135deg, #FFA726 0%, #FF9800 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
    flex-shrink: 0;
}

.question-btn:hover {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

.question-btn:active {
    transform: translateY(0);
}

.question-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.question-btn.loading {
    opacity: 0.8;
    cursor: wait;
}

.question-btn.loading::after {
    content: "";
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    display: inline-block;
    animation: button-spin 1s linear infinite;
}


/* Loading Animation Keyframes */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

/* Responsive Adjustments for Product Actions */
@media (max-width: 768px) {
    .product-actions {
        flex-direction: column;
        gap: 6px;
    }

    .order-btn,
    .question-btn {
        width: 100%;
        text-align: center;
    }

    .question-btn {
        font-size: 13px;
        padding: 6px 10px;
    }
}

/* Loading Animation */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    padding: 3rem;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #e0e0e0;
    border-top: 4px solid #3949ab;
    border-radius: 50%;
    animation: spinner-rotate 0.8s linear infinite;
}

.loading-text {
    margin-top: 1.5rem;
    font-size: 1.1rem;
    color: #666;
    font-weight: 500;
}

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