/* Products Page Specific Styles */

/* Page Header */
.page-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: black;
    padding: 3rem 0;
    text-align: center;
}

.page-header h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: bold;
    color: black;
}

.page-header p {
    font-size: 1.2rem;
    opacity: 1;
    color: black;
}

/* Professional Filters Section */
.filters-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 3rem 0;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.filters-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Professional Search Bar */
.search-bar {
    display: flex;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-radius: 12px;
    overflow: hidden;
}

.search-bar input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    font-size: 1.1rem;
    outline: none;
    background: white;
    color: #333;
    font-weight: 500;
}

.search-bar input::placeholder {
    color: #6c757d;
    font-weight: 400;
}

.search-bar button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-bar button:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

/* Professional Filter Controls */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    justify-content: center;
    align-items: center;
}

.filters select {
    padding: 1rem 1.5rem;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #495057;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    position: relative;
}

.filters select:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.15);
}

.filters select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

/* Professional Clear Button */
#clearFilters {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: #fff;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.2);
    min-width: 200px;
    flex-shrink: 0;
}

#clearFilters:hover {
    background: linear-gradient(135deg, #c82333 0%, #a71e2a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(220, 53, 69, 0.3);
}

#clearFilters:active {
    transform: translateY(0);
}

/* Products Section */
.products-section {
    padding: 3rem 0;
    background-color: #f8f9fa;
    min-height: 60vh;
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.products-header h2 {
    font-size: 2rem;
    color: #333;
    margin: 0;
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    background-color: white;
    border: 2px solid #e9ecef;
    color: #666;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn.active,
.view-btn:hover {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

/* Products Grid - List View */
.products-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.products-grid.list-view .product-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 1rem;
}

.products-grid.list-view .product-image {
    width: 150px;
    height: 150px;
    flex-shrink: 0;
    border-radius: 8px;
}

.products-grid.list-view .product-info {
    flex: 1;
    padding: 0 1rem;
}

.products-grid.list-view .product-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.products-grid.list-view .product-price {
    margin-bottom: 0;
}

.products-grid.list-view .add-to-cart-btn {
    width: auto;
    min-width: 150px;
}

/* Loading and No Products States */
.loading,
.no-products {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.loading i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #667eea;
}

.no-products i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #ccc;
}

.no-products h3 {
    margin-bottom: 0.5rem;
    color: #333;
}

/* Product Card Hover Animation & Button Visibility (overrides shared styles) */
.product-card {
    /* Reset shared transform to allow a subtle hover lift here */
    transform: translateY(0);
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 36px rgba(0,0,0,0.14);
}

.product-image {
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.03);
}

/* Ensure "Ver detalles" button is always visible on white cards */
.product-card .btn.btn-secondary {
    border-color: #667eea;
    color: #667eea;
    background-color: transparent;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.product-card .btn.btn-secondary:hover {
    background-color: #667eea;
    color: #fff;
    transform: translateY(-1px);
}

/* Stock Status Styles - HIDDEN */
.product-stock {
    display: none !important;
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0.5rem 0;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-align: center;
}

.product-stock.in-stock {
    display: none !important;
    color: #28a745;
    background-color: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.product-stock.out-of-stock {
    display: none !important;
    color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
}

/* Disabled Add to Cart Button */
.add-to-cart-btn.disabled {
    background-color: #6c757d !important;
    color: #fff !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

.add-to-cart-btn.disabled:hover {
    background-color: #6c757d !important;
    transform: none !important;
}

/* Product Modal */
.product-modal {
    max-width: 800px;
    max-height: 90vh;
    border-radius: 12px;
    overflow: hidden;
}

.product-modal-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
    background: #fff;
}

/* Allow scrolling inside modal content when tall */
.modal-content.product-modal { max-height: 90vh; overflow-y: auto; }

.product-modal-image img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 10px;
}

/* Windows-like title bar */
.window-titlebar {
    height: 38px;
    background: linear-gradient(180deg, #e9eef7, #d8e0f0);
    border-bottom: 1px solid #c8d0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px 0 12px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.win-drag { display: flex; align-items: center; gap: 8px; }
.win-title { color: #1f2937; font-weight: 700; }

.win-controls { display: flex; gap: 2px; }
.win-btn {
    width: 36px;
    height: 28px;
    border: none;
    background: transparent;
    color: #334155;
    border-radius: 6px;
    cursor: pointer;
}
.win-btn:hover { background: #e5e7eb; }
.win-close:hover { background: #ef4444; color: #fff; }

/* Opening animation */
@keyframes modalZoomIn {
    from { transform: scale(0.96); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.product-modal {
    animation: modalZoomIn 180ms ease-out;
}

.product-modal-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.product-modal-info h2 {
    font-size: 1.8rem;
    color: #333;
    margin: 0;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stars {
    color: #ffd700;
}

.rating-text {
    color: #666;
    font-size: 0.9rem;
}

.product-modal-info .product-price {
    font-size: 2rem;
    margin: 0;
}

.product-specs {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.product-specs h4 {
    margin-bottom: 0.5rem;
    color: #333;
}

.product-specs ul {
    list-style: none;
    padding: 0;
}

.product-specs li {
    padding: 0.25rem 0;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
}

.product-specs li:last-child {
    border-bottom: none;
}

.product-specs .spec-label {
    font-weight: 600;
    color: #666;
}

.product-specs .spec-value {
    color: #333;
}

.product-actions {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.quantity-selector {
    margin-bottom: 1rem;
}

.quantity-selector label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-controls button {
    background-color: #667eea;
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.quantity-controls button:hover {
    background-color: #5a6fd8;
}

.quantity-controls input {
    width: 60px;
    text-align: center;
    padding: 0.5rem;
    border: 2px solid #e9ecef;
    border-radius: 5px;
    font-weight: 600;
}

.add-to-cart-modal {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Mobile Form Optimizations */
.search-bar input {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 12px 16px;
}

.search-bar button {
    padding: 12px 20px;
    font-size: 16px;
}

.filters select {
    font-size: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: all 0.2s ease;
}

.filters select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

#clearFilters {
    font-size: 16px;
    padding: 12px 20px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

#clearFilters:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

/* Enhanced touch interactions */
.view-btn {
    min-width: 44px;
    min-height: 44px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.view-btn:hover,
.view-btn.active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

/* Responsive Design for Products */
@media (max-width: 768px) {
    .page-header {
        padding: 2rem 0;
    }
    
    .page-header h1 {
        font-size: clamp(1.8rem, 4vw, 2.5rem);
        margin-bottom: 0.5rem;
    }
    
    .page-header p {
        font-size: 1rem;
    }
    
    .filters-section {
        padding: 2rem 0;
    }
    
    .filters-container {
        gap: 1.5rem;
        padding: 0 1rem;
    }
    
    .search-bar {
        width: 100%;
        max-width: 100%;
        border-radius: 10px;
        flex-direction: row;
        gap: 0;
    }
    
    .search-bar input {
        padding: 1rem 1.25rem;
        font-size: 16px;
        border-radius: 10px 0 0 10px;
        border: none;
        flex: 1;
    }
    
    .search-bar button {
        padding: 1rem 1.5rem;
        font-size: 16px;
        border-radius: 0 10px 10px 0;
        flex-shrink: 0;
        min-width: 60px;
        max-width: 80px;
    }
    
    .filters {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        width: 100%;
    }
    
    .filters select {
        width: 100%;
        padding: 1rem 1.25rem;
        font-size: 16px;
        border-radius: 10px;
    }
    
    #clearFilters {
        width: 100%;
        max-width: 100%;
        padding: 1rem 1.5rem;
        font-size: 16px;
        border-radius: 10px;
    }
    
    .products-section {
        padding: 2rem 0;
    }
    
    .products-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 0 15px;
    }
    
    .products-header h2 {
        font-size: 1.5rem;
    }
    
    .view-toggle {
        align-self: center;
    }
    
    .products-grid.list-view .product-card {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }
    
    .products-grid.list-view .product-image {
        width: 200px;
        height: 200px;
        margin: 0 auto;
    }
    
    .products-grid.list-view .product-actions {
        flex-direction: row;
        justify-content: center;
        gap: 0.75rem;
    }
    
    .product-modal-content {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1.5rem;
    }
    
    .product-modal-image img {
        height: 250px;
        border-radius: 8px;
    }
    
    .product-modal-info h2 {
        font-size: 1.5rem;
    }
    
    .product-modal-info .product-price {
        font-size: 1.8rem;
    }
    
    .quantity-controls {
        justify-content: center;
    }
    
    .add-to-cart-modal {
        font-size: 1rem;
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .filters-section {
        padding: 1.5rem 0;
    }
    
    .filters-container {
        gap: 1rem;
        padding: 0 0.5rem;
    }
    
    .search-bar {
        flex-direction: row;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        gap: 0;
    }
    
    .search-bar input {
        border-radius: 8px 0 0 8px;
        padding: 0.875rem 1rem;
        font-size: 16px;
        flex: 1;
        border: none;
    }
    
    .search-bar button {
        border-radius: 0 8px 8px 0;
        padding: 0.875rem 1.5rem;
        font-size: 16px;
        flex-shrink: 0;
        min-width: 50px;
        max-width: 70px;
    }
    
    .filters {
        gap: 0.75rem;
    }
    
    .filters select {
        padding: 0.875rem 1rem;
        font-size: 16px;
        border-radius: 8px;
    }
    
    #clearFilters {
        padding: 0.875rem 1.5rem;
        font-size: 16px;
        border-radius: 8px;
    }
    
    .view-toggle {
        width: 100%;
        justify-content: center;
    }
    
    .products-grid.list-view .product-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .products-grid.list-view .add-to-cart-btn {
        width: 100%;
    }
}

/* Modern Product Modal Styles - matching login modal */
.product-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.product-modal-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.4s ease;
    position: relative;
}

.product-modal-header {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
}

.product-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
}

.product-modal-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

.product-modal-content {
    padding: 40px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
