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

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

/* Header Styles */
.header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 30px 0;
    margin-bottom: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.header-content {
    text-align: center;
    padding: 0 20px;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Section Styles */
section {
    background: white;
    margin-bottom: 30px;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid #e0e0e0;
}

section h2 {
    color: #2c3e50;
    font-size: 1.8rem;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 3px solid #3498db;
    font-weight: 600;
}

/* Customer Info Form */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
    font-size: 0.95rem;
}

.form-group input {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background-color: #fafafa;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
    background-color: white;
}

.form-group input[readonly] {
    background-color: #f0f0f0;
    cursor: not-allowed;
}

/* Product Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.product-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.product-card:hover {
    border-color: #3498db;
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.15);
    transform: translateY(-2px);
}

.product-image {
    width: 100%;
    height: 180px;
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.product-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 8px;
    line-height: 1.3;
}

.product-reference {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 12px;
    font-weight: 600;
    background: #ecf0f1;
    padding: 5px 10px;
    border-radius: 4px;
    display: inline-block;
}

.product-description {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.4;
    min-height: 40px;
}

.btn-add-product {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-add-product:hover {
    background: linear-gradient(135deg, #229954, #27ae60);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

/* Order Summary */
.order-items {
    min-height: 100px;
    margin-bottom: 20px;
}

.empty-order {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.order-item {
    display: flex;
    align-items: center;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 15px;
    background: #fafafa;
    transition: background-color 0.3s ease;
}

.order-item:hover {
    background: #f0f8ff;
}

.order-item-image {
    width: 60px;
    height: 60px;
    background: linear-gradient(45deg, #e9ecef, #f8f9fa);
    border-radius: 6px;
    margin-right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.order-item-details {
    flex: 1;
}

.order-item-name {
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.order-item-config {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 3px;
}

/* Corona en resumen del pedido */
.order-item-corona {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.order-item-corona .corona-thumb {
    width: 40px;
    height: 40px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
}

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

.order-item-observations {
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
    background: white;
    padding: 5px 8px;
    border-radius: 4px;
    border-left: 3px solid #3498db;
    margin-top: 8px;
}

.btn-remove {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

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

.order-total {
    text-align: right;
    padding: 20px;
    background: #ecf0f1;
    border-radius: 8px;
    border: 2px solid #bdc3c7;
}

.total-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: #2c3e50;
}

/* Action Buttons */
.actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    padding: 30px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid #e0e0e0;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 180px;
}

.btn-primary {
    background: linear-gradient(135deg, #2980b9, #3498db);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #21618c, #2980b9);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.3);
}

.btn-primary:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #bdc3c7);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #7f8c8d, #95a5a6);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(149, 165, 166, 0.3);
}

/* Modal Styles */
.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);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: modalSlideIn 0.3s ease;
    max-height: 80vh;
    overflow-y: auto;
}

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

.modal-header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 20px 30px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 30px;
}

.config-group {
    margin-bottom: 20px;
}

.config-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
}

.config-group input,
.config-group select,
.config-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background-color: #fafafa;
}

.config-group input:focus,
.config-group select:focus,
.config-group textarea:focus {
    outline: none;
    border-color: #3498db;
    background-color: white;
}

.config-options {
    margin-bottom: 20px;
}

.config-option {
    margin-bottom: 15px;
}

.config-option label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

/* Image Option Grid */
.image-option-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.image-option {
    position: relative;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    cursor: pointer;
    transition: all 0.25s ease;
}

.image-option:hover {
    border-color: #3498db;
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.2);
    transform: translateY(-2px);
}

.image-option.selected {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2) inset;
}

.image-option img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.image-option-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.9rem;
    padding: 6px 8px;
    text-align: center;
}

/* Corona Option Grid: miniaturas cuadradas en una sola línea */
.corona-option-grid {
    display: flex;
    gap: 10px;
    align-items: stretch;
    flex-wrap: nowrap;
}

.corona-option-grid .image-option {
    width: 88px;
    height: 88px;
    border-radius: 6px;
}

.corona-option-grid .image-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.corona-option-grid .image-option-label {
    font-size: 0.75rem;
    padding: 4px 6px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
    
    .actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .order-item {
        flex-direction: column;
        text-align: center;
    }
    
    .order-item-image {
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

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

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