/* ==========================================================================
   VARIABLES
   ========================================================================== */
:root {
	--color-primary: #ffda00;
	--color-secondary: #f0f0f0;
	--color-text: #333;
	--color-text-light: #666;
	--color-text-lighter: #999;
	--color-success: #2c7613;
	--color-success-light: #d4edda;
	--color-success-dark: #155724;
	--color-blue: #007bff;
	--color-purple: #6f42c1;
	--color-border: #ddd;
	--color-border-light: #eee;
	--color-bg: #fff;
	--color-bg-light: #f5f5f5;
	--color-bg-lighter: #fafafa;
	--color-bg-dark: #222;

	--shadow-default: 0 1px 4px rgba(0, 0, 0, 0.08);
	--shadow-hover: 0 16px 35px -14px rgba(95, 95, 95, 1);

	--border-radius-sm: 3px;
	--border-radius: 4px;

	--transition-default: 0.3s ease;

	--max-width: 1200px;
}

/* ==========================================================================
   COMMON STYLES
   ========================================================================== */

/* Common card structure for product details and ranking table */
.product_details-card, .ranking-table-compact {
	margin: 1.25rem auto;
	width: 100%;
	max-width: var(--max-width);
	font-family: Arial, sans-serif;
	color: var(--color-text);
	border-radius: var(--border-radius);
	box-shadow: var(--shadow-default);
	overflow: hidden;
}

/* Shared link styles */
.btn, .product-link {
	text-decoration: none;
	cursor: pointer;
	transition: var(--transition-default);
	border-radius: var(--border-radius);
	font-weight: 500;
	display: inline-block;
	text-align: center;
}

/* Shared price styles */
.price-block__current, .product-price {
	font-weight: bold;
	color: var(--color-success);
}

/* ==========================================================================
   PRODUCT DETAILS CARD
   ========================================================================== */

/* Card layout */
.product_details-card {
	background: var(--color-bg);
	border: 1px solid var(--color-border);
}

.product_details-card__header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.75rem 1.25rem;
	border-bottom: 1px solid var(--color-border-light);
}

.product_details-card__body {
	display: flex;
	flex-direction: column;
	padding: 1.25rem;
}

@media (min-width: 768px) {
	.product_details-card__body {
		flex-direction: row;
		justify-content: space-around;
	}
}

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

@media (min-width: 768px) {
	.product-info {
		flex: 2;
		padding-right: 1.25rem;
		border-right: 1px solid var(--color-border-light);
		margin-bottom: 0;
	}
}

/* Purchase column */
.purchase {
	padding-top: 1.25rem;
	border-top: 1px solid var(--color-border);
}

@media (min-width: 768px) {
	.purchase {
		flex: 1;
		padding-left: 1.25rem;
		padding-top: 0;
		border-left: 1px solid var(--color-border);
		border-top: none;
	}
}

/* Rank and expert rating */
.rank {
	display: flex;
	align-items: baseline;
	background: var(--color-bg-dark);
	color: var(--color-bg);
	padding: 0.5rem 0.75rem;
	border-radius: var(--border-radius);
	margin-bottom: 0.75rem;
}

.rank__number {
	font-size: 1.5rem;
	font-weight: bold;
	margin-right: 0.375rem;
}

.rank__label {
	font-size: 0.75rem;
	text-transform: uppercase;
}

.expert-rating {
	font-size: 1rem;
	margin-bottom: 1rem;
}

.expert-rating__stars {
	color: gold;
	margin: 0 0.25rem;
}

.expert-rating__score {
	font-weight: bold;
}

/* Title and user ratings */
.product-info__title {
	font-size: 2rem;
	margin-bottom: 0.5rem;
}

.product-info__rating {
	margin-bottom: 1rem;
}

.stars {
	color: gold;
	margin-right: 0.375rem;
}

.reviews {
	color: var(--color-text-light);
}

/* Image and promotions */
.product-info__main {
	display: flex;
	flex-direction: column;
	margin-bottom: 1.25rem;
}

@media (min-width: 576px) {
	.product-info__main {
		flex-direction: row;
	}
}

.product-info__image {
	width: 100%;
	max-width: 200px;
	height: auto;
	border-radius: var(--border-radius);
	margin-bottom: 1rem;
}

@media (min-width: 576px) {
	.product-info__image {
		margin-right: 1.25rem;
		margin-bottom: 0;
		width: 200px;
        object-fit: contain;
	}
}

.promotions {
	display: grid;
	grid-gap: 0.5rem;
}

@media (min-width: 576px) {
	.promotions {
		flex: 1;
	}
}

.promo-box {
	display: flex;
	align-items: center;
	padding: 0.5rem 0.75rem;
	font-size: 0.9rem;
	border: none;
	border-radius: var(--border-radius);
	cursor: pointer;
}

.promo-box .icon {
	margin-right: 0.375rem;
}

.promo-box--blue {
	background: var(--color-blue);
	color: var(--color-bg);
}

.promo-box--blue-outline {
	background: var(--color-bg);
	color: var(--color-blue);
	border: 1px solid var(--color-blue);
}

.promo-box--purple {
	background: var(--color-purple);
	color: var(--color-bg);
}

.promo-box--text {
	background: transparent;
	color: var(--color-text);
	text-align: left;
	padding: 0;
}

.promotions__more {
	font-size: 0.85rem;
	color: var(--color-blue);
	margin-top: 0.25rem;
}

/* Specifications */
.specs {
	list-style: none;
	margin: 1.25rem 0;
	padding-left: 0;
}

.specs li {
	margin-bottom: 0.375rem;
	font-size: 0.9rem;
}

.selectors label {
	display: block;
	margin-bottom: 0.625rem;
	font-size: 0.9rem;
}

.selectors select {
	margin-left: 0.5rem;
}

/* Price block */
.price-block {
	background: var(--color-bg-lighter);
	padding: 1rem;
	border: 1px solid var(--color-border-light);
	border-radius: var(--border-radius);
	text-align: center;
	margin-bottom: 1.25rem;
}

.price-block__code {
	font-size: 0.85rem;
	margin-bottom: 0.5rem;
}

.price-block__current {
	font-size: 2rem;
}

.price-block__main sup {
	font-size: 0.75rem;
}

.price-block__sub {
	font-size: 0.85rem;
	color: var(--color-text-light);
	margin-top: 0.5rem;
}

.price-block__sub del {
	color: var(--color-text-lighter);
}

.energy-rating {
	display: inline-block;
	background: var(--color-success-light);
	color: var(--color-success-dark);
	font-weight: bold;
	padding: 0.25rem 0.5rem;
	border-radius: var(--border-radius);
	margin-top: 0.75rem;
}

/* Buttons */
.btn {
	display: block;
	width: 93%;
	padding: 0.75rem;
	font-size: 1rem;
	border: none;
	margin-bottom: 0.625rem;
}

.btn--primary {
	background: var(--color-primary);
	color: var(--color-text);
}

.btn--secondary {
	background: var(--color-secondary);
	color: var(--color-text);
	border: 1px solid var(--color-border);
}

.btn--secondary:hover {
	background-color: transparent;
	box-shadow: var(--shadow-hover);
}

/* ==========================================================================
   RANKING TABLE
   ========================================================================== */

.ranking-table-compact {
	font-size: 0.875rem;
	line-height: 1.2;
	border-collapse: collapse;
}

/* Mobile styles first (base styles) */
.ranking-table-compact .ranking-row {
	position: relative;
	display: grid;
	grid-template-areas:
		"place place rating"
		"image name name"
		"image link link";
	grid-template-columns: 80px 1fr auto;
	grid-template-rows: auto auto auto;
	gap: 0.3125rem;
	padding: 0.625rem !important;
	border-bottom: 1px solid var(--color-border-light);
	min-height: auto;
	max-height: none;
	margin-bottom: 0;
}

.ranking-table-compact .ranking-header {
	display: none;
}

.ranking-table-compact .ranking-cell {
	padding: 0;
	border-bottom: none;
	overflow: visible;
}

/* Place cell styles */
.ranking-table-compact .place-cell {
	grid-area: place;
	justify-content: flex-start;
}

.ranking-table-compact .place-container {
	display: flex;
	flex-direction: row;
	align-items: center;
	background-color: var(--color-text);
	padding: 0.25rem 0.625rem;
	border-radius: var(--border-radius-sm);
	margin: 0 0 0.3125rem 0;
}

.ranking-table-compact .place-number {
	font-weight: bold;
	font-size: 0.875rem;
	color: var(--color-bg);
	margin-right: 0.3125rem;
}

.ranking-table-compact .place-text {
	font-size: 0.75rem;
	color: #ddd;
	text-transform: lowercase;
}

/* Image cell styles */
.ranking-table-compact .image-cell {
	grid-area: image;
	justify-content: flex-start;
	padding: 0;
}

.ranking-table-compact .image-cell img {
	width: 70px;
	height: 70px;
	object-fit: cover;
	border-radius: var(--border-radius-sm);
}

/* Name cell styles */
.ranking-table-compact .name-cell {
	grid-area: name;
	padding: 0;
}

.ranking-table-compact .product-title {
	font-size: 0.875rem;
	line-height: 1.2;
	font-weight: 500;
	margin-top: 0.125rem;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	max-height: 2.2em;
}

/* Grade cell styles */
.ranking-table-compact .grade-cell {
	grid-area: rating;
	justify-content: flex-end;
	padding: 0;
}

.ranking-table-compact .expert-grade {
	justify-content: flex-end;
	font-weight: bold;
	color: var(--color-text);
	font-size: 0.875rem;
	display: flex;
	align-items: center;
}

.ranking-table-compact .expert-grade--max {
	justify-content: flex-end;
	color: #7d7d7d;
	font-size: 0.75rem;
	display: flex;
	align-items: center;
}

/* Price cell styles */
.ranking-table-compact .price-cell {
	display: none;
}

/* Link cell styles */
.ranking-table-compact .link-cell {
	grid-area: link;
	justify-content: flex-start;
	padding: 0;
	margin-top: 0.3125rem;
}

.ranking-table-compact .product-link {
	background: none;
	border: none;
	color: var(--color-blue);
	padding: 0;
	font-size: 0.875rem;
	text-align: left;
}

/* Desktop styles */
@media (min-width: 768px) {
	.ranking-table-compact .ranking-row {
		display: flex;
		border-bottom: 1px solid var(--color-border-light);
		align-items: center;
		min-height: 40px;
		max-height: 100px;
		overflow: hidden;
		padding-left: 0.9375rem !important;
		padding-right: 0.9375rem !important;
		grid-template-areas: none;
		grid-template-columns: none;
		grid-template-rows: none;
		gap: 0;
	}

	.ranking-table-compact .ranking-header {
		display: flex;
		background-color: #f8f8f8;
		font-weight: 600;
		color: var(--color-text);
		font-size: 0.75rem;
		text-transform: uppercase;
		min-height: 32px;
		max-height: 32px;
	}

	.ranking-table-compact .ranking-cell {
		padding: 0.25rem 0.375rem;
		display: flex;
		align-items: center;
		height: 100%;
		overflow: hidden;
	}

	.ranking-table-compact .place-cell {
		flex: 0 0 80px;
		justify-content: center;
	}

	.ranking-table-compact .place-container {
		flex-direction: column;
		justify-content: center;
		background-color: #dcdcdc;
		padding: 0.1875rem 0.375rem;
		text-align: center;
		min-width: 60px;
		margin: 0;
	}

	.ranking-table-compact .place-number {
		color: var(--color-text);
		margin-right: 0;
	}

	.ranking-table-compact .place-text {
		font-size: 0.625rem;
		color: var(--color-text-light);
	}

	.ranking-table-compact .image-cell {
		flex: 0 0 110px;
		justify-content: center;
		margin: 0;
	}

	.ranking-table-compact .image-cell img {
		margin: 0.625rem 0;
	}

	.ranking-table-compact .name-cell {
		flex: 1 1 30%;
		margin: 0;
		padding: 0 0.375rem;
	}

	.ranking-table-compact .product-title {
		line-height: 1.1;
	}

	.ranking-table-compact .grade-cell {
		flex: 0 0 13%;
		justify-content: center;
		margin: 0;
	}

	.ranking-table-compact .expert-grade,
	.ranking-table-compact .expert-grade--max {
		justify-content: center;
	}

	.ranking-table-compact .price-cell {
		display: flex;
		flex: 0 0 13%;
		justify-content: center;
		margin: 0;
		padding: 0;
	}

	.ranking-table-compact .link-cell {
		flex: 0 0 15%;
		justify-content: center;
		margin: 0;
	}

	.ranking-table-compact .product-link {
		display: inline-block;
		padding: 0.1875rem 0.625rem;
		background-color: var(--color-secondary);
		color: var(--color-text);
		border-radius: var(--border-radius-sm);
		font-size: 0.75rem;
		border: 1px solid var(--color-border);
	}

	.ranking-table-compact .product-link:hover {
		background-color: transparent;
		box-shadow: var(--shadow-hover);
	}
}
