/* Reset y configuración base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #ffffff, #bcbcbc);
    min-height: 100vh;
    color: #5e89b3;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    color: #212529;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    color: #212529;
}

header p {
    font-size: 1.1rem;
    color: #6c757d;
}



/* Sección de búsqueda */
.search-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid #f1f3f4;
}

.search-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 15px 50px 15px 20px;
    border: 2px solid #dee2e6;
    border-radius: 25px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fefefe;
}

.search-box input:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.search-box input:not(:placeholder-shown) {
    border-color: #d4af37;
    background-color: #fefefe;
}

.search-box input:not(:placeholder-shown) + button {
    background: #b8860b;
}

.search-box button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: #d4af37;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-box button:hover {
    background: #b8860b;
    transform: translateY(-50%) scale(1.1);
}

.filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.filters select {
    padding: 12px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
    background: #fefefe;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filters select:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
    flex-wrap: wrap;
    gap: 15px;
}

.results-info span {
    font-weight: 600;
    color: #212529;
}

.search-help {
    text-align: center;
    margin: 0 15px;
}

.search-help small {
    color: #6c757d;
    font-size: 0.85rem;
    font-style: italic;
}

.clear-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    background: #495057;
    transform: translateY(-1px);
}

/* Grid de productos */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.product-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0,0.08);
    transition: all 0.3s ease;
    border: 1px solid #f1f3f4;
}

.product-card:hover {
    transform: translateY(0px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
    border-color: #d4af37;
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 10px;
}

.product-name {
    font-size: 1.3rem;
    color: #212529;
    margin: 0;
    flex: 1;
    line-height: 1.3;
}

.product-code {
    background: #f8f9fa;
    color: #495057;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.product-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.product-info {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.product-category {
    background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 500;
}

.product-brand {
    background: #495057;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
}

.product-pricing {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.product-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: #d4af37;
}

.product-stock {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.product-stock.in-stock {
    background: #e8f5e8;
    color: #2d5016;
}

.product-stock.out-of-stock {
    background: #f8f9fa;
    color: #6c757d;
}

.product-description {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

.product-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f1f3f4;
}

.sell-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
}

.sell-btn:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-1px);
}

.sell-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Sin resultados */
.no-results {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid #f1f3f4;
}

.no-results-content {
    max-width: 400px;
    margin: 0 auto;
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.no-results h3 {
    font-size: 1.5rem;
    color: #212529;
    margin-bottom: 10px;
}

.no-results p {
    color: #6c757d;
    font-size: 1.1rem;
}

/* Sección de Productos Vendidos */
.sold-products-section {
    margin-top: 40px;
    padding: 30px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid #f1f3f4;
}

.section-header {
    text-align: center;
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 2rem;
    color: #212529;
    margin-bottom: 10px;
}

.section-header p {
    color: #6c757d;
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.clear-history-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.clear-history-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.sold-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.sold-product-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.sold-product-card:hover {
    border-color: #d4af37;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.sold-product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 10px;
}

.sold-product-name {
    font-size: 1.3rem;
    color: #495057;
    margin: 0;
    flex: 1;
    line-height: 1.3;
}

.sold-product-code {
    background: #e9ecef;
    color: #6c757d;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.sold-product-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sold-product-info {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.sold-product-category {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 500;
}

.sold-product-brand {
    background: #495057;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
}

.sold-product-pricing {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.sold-product-price {
    font-size: 1.3rem;
    font-weight: bold;
    color: #6c757d;
}

.sold-product-date {
    background: #e9ecef;
    color: #495057;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.sold-product-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.revert-btn {
    background: #ffc107;
    color: #212529;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
}

.revert-btn:hover {
    background: #e0a800;
    transform: translateY(-1px);
}

.no-sold-products {
    text-align: center;
    padding: 60px 20px;
}

.no-sold-content {
    max-width: 400px;
    margin: 0 auto;
}

.no-sold-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #6c757d;
}

.no-sold-content h3 {
    font-size: 1.5rem;
    color: #495057;
    margin-bottom: 10px;
}

.no-sold-content p {
    color: #6c757d;
    font-size: 1.1rem;
}

/* Notificaciones */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
    font-weight: 500;
}

.notification.show {
    transform: translateX(0);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .search-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        min-width: auto;
    }
    
    .filters {
        justify-content: center;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .product-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .product-pricing {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .results-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .sold-products-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .sold-product-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .sold-product-pricing {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .section-header {
        text-align: center;
    }
    
    .clear-history-btn {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .upload-area {
        padding: 40px 15px;
    }
    
    .upload-icon {
        font-size: 3rem;
    }
    
    .search-section {
        padding: 20px;
    }
    
    .product-card {
        padding: 20px;
    }
}

/* Estilos para el botón de ventas */
.sales-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #085226 0%, #0f3202 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

.sales-btn:hover {
    box-shadow: 0 4px 12px rgba(137, 141, 138, 0.3);
}

/* Responsive para el botón de ventas */
@media (max-width: 768px) {
    .sales-btn {
        margin-left: 0;
        margin-top: 0.5rem;
        width: 100%;
    }
}

/* Estilos para imágenes de productos */
.product-image-container {
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Estilos para imágenes de productos vendidos */
.sold-product-image-container {
    width: 100%;
    height: 150px;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sold-product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
}

/* Estilos para imágenes en la página de ventas */
.sale-image-container {
    width: 80px;
    height: 60px;
    overflow: hidden;
    border-radius: 6px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sale-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

/* Ajustes responsive para las imágenes */
@media (max-width: 768px) {
    .product-image-container {
        height: 180px;
    }
    
    .sold-product-image-container {
        height: 120px;
    }
    
    .sale-image-container {
        width: 60px;
        height: 45px;
    }
    
    .sale-item {
        gap: 1rem;
    }
}

/* Botón para regresar al principio */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #615f5f 0%, #5e5e5e 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 1000;
    display: none;
}

.back-to-top:hover {
    background: linear-gradient(135deg, #615f5f 0%, #5e5e5e 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.back-to-top:active {
    transform: translateY(-1px);
}

/* Responsive para el botón */
@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

/* Footer */
.footer {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 2rem 0;
    margin-top: 3rem;
    border-top: 3px solid #d4af37;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h3 {
    color: #d4af37;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.footer-section h4 {
    color: #ecf0f1;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.footer-section p {
    color: #bdc3c7;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

/* Enlaces de redes sociales */
.social-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ecf0f1;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.social-link:hover {
    transform: translateX(5px);
    text-decoration: none;
}

.social-link.facebook:hover {
    background: rgba(59, 89, 152, 0.2);
    color: #3b5998;
}

.social-link.instagram:hover {
    background: rgba(225, 48, 108, 0.2);
    color: #e1306c;
}

.social-link.whatsapp:hover {
    background: rgba(37, 211, 102, 0.2);
    color: #25d366;
}

.social-link.email:hover {
    background: rgba(234, 67, 53, 0.2);
    color: #ea4335;
}

.social-link span {
    font-size: 1.2rem;
}

/* Responsive para el footer */
@media (max-width: 768px) {
    .footer {
        padding: 1.5rem 0;
        margin-top: 2rem;
    }
    
    .footer-content {
        padding: 0 1rem;
        grid-template-columns: 1fr;
        gap: 1.5rem;
        text-align: center;
    }
    
    .social-links {
        align-items: center;
    }
    
    .social-link {
        justify-content: center;
        max-width: 200px;
        margin: 0 auto;
    }
}