/*---------------------------------------------------------------------
    Products Page Styles
---------------------------------------------------------------------*/

.product-card {
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	overflow: hidden;
	transition: transform 0.3s, box-shadow 0.3s;
	margin-bottom: 30px;
	background: white;
}

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

/* Product Image Carousel */
.product-image-container {
	position: relative;
	width: 100%;
	height: 250px;
	overflow: hidden;
	background: #f8f9fa;
}

.product-image-carousel {
	position: relative;
	width: 100%;
	height: 100%;
}

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

.carousel-img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	opacity: 0;
	transition: opacity 0.3s ease-in-out;
}

.carousel-img.active {
	opacity: 1;
	position: relative;
}

.product-carousel-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(0, 0, 0, 0.5);
	color: white;
	border: none;
	width: 35px;
	height: 35px;
	border-radius: 50%;
	cursor: pointer;
	z-index: 10;
	transition: background 0.3s;
	display: flex;
	align-items: center;
	justify-content: center;
}

.product-carousel-arrow:hover {
	background: rgba(0, 0, 0, 0.8);
}

.product-carousel-left {
	left: 10px;
}

.product-carousel-right {
	right: 10px;
}

.carousel-dots {
	position: absolute;
	bottom: 10px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	gap: 6px;
	z-index: 10;
}

.carousel-dots .dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.5);
	cursor: pointer;
	transition: background 0.3s;
}

.carousel-dots .dot.active {
	background: #ffc107;
	width: 10px;
	height: 10px;
}

.carousel-dots .dot:hover {
	background: rgba(255, 255, 255, 0.8);
}

.product-info {
	padding: 20px;
}

.product-name {
	font-size: 18px;
	font-weight: bold;
	margin-bottom: 10px;
	color: #333;
}

.product-category strong {
	color: #666;
 }

.product-category {
	color: #ffc107;
	font-size: 14px;
	margin-bottom: 10px;
}

.product-category span {
	padding: 3px 6px;
	color: #fff;
    background: #ffc107;
	border-radius: 4px;
}

.product-pricing {
	margin-bottom: 15px;
}

.product-pricing-row {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-bottom: 5px;
}

.product-price-label {
	font-size: 14px;
	color: #666;
	font-weight: 600;
}

.product-retail-price {
	font-size: 18px;
	color: #5d5d5d !important;
	text-decoration: line-through !important;
	font-weight: 500;
}

.product-price {
	font-size: 24px;
	font-weight: bold;
	color: #28a745;
}

.product-condition {
	display: inline-block;
	padding: 3px 6px;
	background: #ffc107;
	color: white;
	border-radius: 4px;
	font-size: 12px;
	margin-bottom: 10px;
}

/* Make all cards in a row the same height */
#products-container .row {
    display: flex;
    flex-wrap: wrap;
}

.col-lg-4, .col-md-6 {
    display: flex;
}

.product-card {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.product-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Lock description to a fixed height with ellipsis overflow */
.product-description {
    display: -webkit-box;
    -webkit-line-clamp: 3;       /* max 3 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 60px;            /* ensures same height even if short */
}

/* Push the button to the bottom always */
.product-info .btn {
    margin-top: auto !important;
}

.page-header {
	background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
	padding: 13px 0 5px 0;
	margin-bottom: 0;
}

.page-header h1 {
	color: white;
	font-weight: bold;
	margin-bottom: 10px;
}

.page-header p {
	color: white;
	font-size: 18px;
}

.category-filter {
	background: #f8f9fa;
	padding: 20px;
	border-radius: 8px;
	box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.category-filter h4 {
	margin-bottom: 5px;
	color: #333;
}

.category-filter .btn {
	margin: 5px;
	border-radius: 20px;
	padding: 8px 20px;
	font-weight: 500;
	color: #333;
}


.category-filter .btn-group {
	display: flex;
	flex-wrap: wrap;
}

.btn-group>.btn-group:not(:last-child)>.btn, .btn-group>.btn:not(:last-child):not(.dropdown-toggle) {
	margin: 5px;
    border-radius: 20px;
    padding: 8px 20px;
    font-weight: 500;
}

.btn-group>.btn:last-child:not(.dropdown-toggle) {
    margin: 5px;
    border-radius: 20px;
    padding: 8px 20px;
    font-weight: 500;
}

.category-filter .btn:hover {
	color: #fff;
}

.category-filter .btn:active {
	color: #fff;
}

.category-filter .btn-warning {
	color: #fff;
}

/* HTMX transition effects */
.htmx-swapping {
	opacity: 0;
	transition: opacity 200ms ease-out;
}

.htmx-settling {
	opacity: 1;
	transition: opacity 200ms ease-in;
}

#products-container {
	transition: opacity 200ms ease-in-out;
}

/* Pagination Styles */
.pagination-container {
	margin-top: 40px;
	margin-bottom: 20px;
}

.pagination {
	gap: 5px;
}

.pagination .page-item {
	margin: 0;
}

.pagination .page-link {
	border: 2px solid #ffc107;
	color: #333;
	background: white;
	padding: 10px 16px;
	border-radius: 8px;
	font-weight: 500;
	transition: all 0.3s ease;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 5px;
}

.pagination .page-link:hover {
	background: #ffc107;
	color: white;
	border-color: #ffc107;
	transform: translateY(-2px);
	box-shadow: 0 4px 8px rgba(255, 193, 7, 0.3);
}

.pagination .page-item.active .page-link {
	background: #ffc107;
	color: white;
	border-color: #ffc107;
	font-weight: bold;
	box-shadow: 0 4px 8px rgba(255, 193, 7, 0.3);
}

.pagination .page-item.disabled .page-link {
	border-color: #e0e0e0;
	color: #999;
	background: #f8f9fa;
	cursor: not-allowed;
	opacity: 0.6;
}

.pagination .page-item.disabled .page-link:hover {
	transform: none;
	box-shadow: none;
	background: #f8f9fa;
	color: #999;
}

.pagination-info {
	color: #666;
	font-size: 14px;
	margin-top: 10px;
}

/* Responsive pagination */
@media (max-width: 768px) {
	.pagination .page-link {
		padding: 8px 12px;
		font-size: 14px;
	}

	.pagination {
		gap: 3px;
	}
}

/* Loading indicator for HTMX requests */
.htmx-request #products-container {
	opacity: 0.6;
	pointer-events: none;
	position: relative;
}

.htmx-request #products-container::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 50px;
	height: 50px;
	border: 4px solid #f3f3f3;
	border-top: 4px solid #ffc107;
	border-radius: 50%;
	animation: spin 1s linear infinite;
	z-index: 1000;
}

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