/**
 * CanonTurkiye UI components.
 */

/* Buttons */
.ct-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--ct-space-2);
	padding: 0.625rem 1.25rem;
	font: inherit;
	font-weight: 600;
	font-size: 0.9375rem;
	line-height: 1.4;
	border: 1px solid transparent;
	border-radius: var(--ct-radius-md);
	cursor: pointer;
	text-decoration: none;
	transition: background var(--ct-transition), color var(--ct-transition), border-color var(--ct-transition), transform var(--ct-transition);
}

.ct-btn:hover,
.ct-btn:focus-visible {
	text-decoration: none;
	transform: translateY(-1px);
}

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

.ct-btn--primary:hover,
.ct-btn--primary:focus-visible {
	background: var(--ct-color-brand-dark);
	color: var(--ct-color-text-inverse);
}

.ct-btn--secondary {
	background: var(--ct-color-surface);
	color: var(--ct-color-text);
	border-color: var(--ct-color-border-strong);
}

.ct-btn--secondary:hover,
.ct-btn--secondary:focus-visible {
	border-color: var(--ct-color-brand);
	color: var(--ct-color-brand);
}

.ct-btn--ghost {
	background: transparent;
	color: var(--ct-color-text);
}

.ct-btn--sm {
	padding: 0.375rem 0.875rem;
	font-size: 0.8125rem;
}

.ct-btn--lg {
	padding: 0.875rem 1.75rem;
	font-size: 1rem;
}

/* Cards */
.ct-card {
	background: var(--ct-color-surface);
	border: 1px solid var(--ct-color-border);
	border-radius: var(--ct-radius-lg);
	overflow: hidden;
	transition: box-shadow var(--ct-transition), border-color var(--ct-transition);
}

.ct-card:hover {
	box-shadow: var(--ct-shadow-md);
	border-color: var(--ct-color-border-strong);
}

.ct-card__link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.ct-card__link:hover {
	color: inherit;
}

.ct-card__media {
	aspect-ratio: 4 / 3;
	background: var(--ct-color-surface-2);
	overflow: hidden;
}

.ct-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ct-card__body {
	padding: var(--ct-space-5);
}

.ct-card__title {
	font-size: 1rem;
	margin: 0 0 var(--ct-space-2);
}

.ct-card__meta {
	font-size: 0.8125rem;
	color: var(--ct-color-text-muted);
	margin: 0 0 var(--ct-space-2);
}

.ct-card__badges {
	display: flex;
	flex-wrap: wrap;
	gap: var(--ct-space-2);
	margin-bottom: var(--ct-space-3);
}

.ct-card__excerpt {
	font-size: 0.8125rem;
	color: var(--ct-color-text-muted);
	margin: 0;
	line-height: 1.5;
}

.ct-card__media img.is-placeholder,
.ct-product-single__gallery img.is-placeholder,
.ct-product-image.is-placeholder {
	object-fit: contain;
	padding: var(--ct-space-4);
	background: linear-gradient(145deg, var(--ct-color-surface-2), var(--ct-color-surface));
}

.ct-product-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	min-height: 180px;
	padding: var(--ct-space-4);
	background: linear-gradient(145deg, #1a1a2e 0%, #2c3e50 100%);
	color: #a8b2c1;
	text-align: center;
}

.ct-product-placeholder__icon {
	width: 72px;
	height: 52px;
	border: 3px solid #667788;
	border-radius: 10px;
	position: relative;
	margin-bottom: var(--ct-space-3);
}

.ct-product-placeholder__icon::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 28px;
	height: 28px;
	margin: -14px 0 0 -14px;
	border: 3px solid #8899aa;
	border-radius: 50%;
}

.ct-product-placeholder__icon::after {
	content: '';
	position: absolute;
	top: -14px;
	left: 50%;
	width: 34px;
	height: 14px;
	margin-left: -17px;
	background: #445566;
	border-radius: 4px 4px 0 0;
}

.ct-product-placeholder__label {
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.ct-card__media .ct-product-placeholder,
.ct-card__media .ct-product-image {
	width: 100%;
	height: 100%;
}

.ct-card__media-fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	font-size: 2rem;
	color: var(--ct-color-text-muted);
}

/* Badges */
.ct-badge {
	display: inline-flex;
	align-items: center;
	padding: 0.125rem 0.5rem;
	font-size: 0.75rem;
	font-weight: 600;
	border-radius: var(--ct-radius-full);
	background: var(--ct-color-surface-2);
	color: var(--ct-color-text-muted);
}

.ct-badge--brand {
	background: var(--ct-color-brand-light);
	color: var(--ct-color-brand-dark);
}

.ct-badge--success {
	background: #d1fae5;
	color: var(--ct-color-success);
}

.ct-badge--muted {
	background: var(--ct-color-surface-alt, #f1f5f9);
	color: var(--ct-color-text-muted);
}

.ct-spec-table tr.is-diff th,
.ct-spec-table tr.is-diff td {
	background: var(--ct-color-brand-light, #fff7ed);
}

[data-theme="dark"] .ct-badge--success,
:root:not([data-theme="light"]) .ct-badge--success {
	background: #064e3b;
	color: #6ee7b7;
}

/* Forms */
.ct-input,
.ct-select {
	width: 100%;
	padding: 0.625rem 0.875rem;
	font: inherit;
	color: var(--ct-color-text);
	background: var(--ct-color-surface);
	border: 1px solid var(--ct-color-border);
	border-radius: var(--ct-radius-md);
	transition: border-color var(--ct-transition);
}

.ct-input:focus,
.ct-select:focus {
	outline: none;
	border-color: var(--ct-color-brand);
}

.ct-label {
	display: block;
	font-size: 0.875rem;
	font-weight: 600;
	margin-bottom: var(--ct-space-2);
}

.ct-form-row {
	margin-bottom: var(--ct-space-4);
}

/* Search */
.ct-search {
	display: flex;
	gap: var(--ct-space-2);
}

.ct-search__input {
	flex: 1;
}

/* Tabs */
.ct-tabs__nav {
	display: flex;
	flex-wrap: wrap;
	gap: var(--ct-space-1);
	border-bottom: 1px solid var(--ct-color-border);
	margin-bottom: var(--ct-space-6);
}

.ct-tabs__btn {
	padding: var(--ct-space-3) var(--ct-space-4);
	font: inherit;
	font-weight: 600;
	font-size: 0.875rem;
	color: var(--ct-color-text-muted);
	background: none;
	border: none;
	border-bottom: 2px solid transparent;
	cursor: pointer;
	margin-bottom: -1px;
	transition: color var(--ct-transition), border-color var(--ct-transition);
}

.ct-tabs__btn[aria-selected="true"],
.ct-tabs__btn:hover {
	color: var(--ct-color-brand);
}

.ct-tabs__btn[aria-selected="true"] {
	border-bottom-color: var(--ct-color-brand);
}

.ct-tabs__panel[hidden] {
	display: none;
}

/* Spec table */
.ct-spec-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9375rem;
}

.ct-spec-table th,
.ct-spec-table td {
	padding: var(--ct-space-3) var(--ct-space-4);
	text-align: left;
	border-bottom: 1px solid var(--ct-color-border);
}

.ct-spec-table th {
	width: 40%;
	font-weight: 600;
	color: var(--ct-color-text-muted);
}

/* Filter panel */
.ct-filters {
	background: var(--ct-color-surface);
	border: 1px solid var(--ct-color-border);
	border-radius: var(--ct-radius-lg);
	padding: var(--ct-space-5);
}

.ct-filters__group {
	margin-bottom: var(--ct-space-5);
}

.ct-filters__title {
	font-size: 0.8125rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--ct-color-text-muted);
	margin-bottom: var(--ct-space-3);
}

.ct-filters__options {
	display: flex;
	flex-direction: column;
	gap: var(--ct-space-2);
}

.ct-filters__option {
	display: flex;
	align-items: center;
	gap: var(--ct-space-2);
	font-size: 0.875rem;
	cursor: pointer;
}

.ct-filters-mobile-bar {
	display: none;
	margin-bottom: var(--ct-space-4);
}

.ct-filters-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	z-index: 90;
}

.ct-filters__header,
.ct-filters__footer {
	display: none;
}

body.ct-filters-locked {
	overflow: hidden;
}

.ct-compare-toast {
	position: fixed;
	right: var(--ct-space-4);
	bottom: var(--ct-space-4);
	z-index: 120;
	max-width: min(420px, calc(100vw - 2rem));
	padding: var(--ct-space-4);
	box-shadow: var(--ct-shadow-lg);
	border-radius: var(--ct-radius-md);
}

@media (max-width: 899px) {
	.ct-filters-mobile-bar {
		display: block;
	}

	.ct-filters {
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		width: min(320px, 92vw);
		z-index: 100;
		border-radius: 0;
		transform: translateX(-105%);
		transition: transform var(--ct-transition);
		overflow: hidden;
		display: flex;
		flex-direction: column;
		padding: 0;
	}

	.ct-filters.is-open {
		transform: translateX(0);
	}

	.ct-filters__header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: var(--ct-space-4) var(--ct-space-5);
		border-bottom: 1px solid var(--ct-color-border);
	}

	.ct-filters__heading {
		margin: 0;
		font-size: 1rem;
	}

	.ct-filters__close {
		background: none;
		border: none;
		font-size: 1.5rem;
		line-height: 1;
		cursor: pointer;
		color: var(--ct-color-text-muted);
	}

	.ct-filters__body {
		flex: 1;
		overflow-y: auto;
		padding: var(--ct-space-5);
		-webkit-overflow-scrolling: touch;
	}

	.ct-filters__footer {
		display: flex;
		gap: var(--ct-space-3);
		padding: var(--ct-space-4) var(--ct-space-5);
		border-top: 1px solid var(--ct-color-border);
		background: var(--ct-color-surface);
	}

	.ct-filters__footer .ct-btn {
		flex: 1;
	}
}

/* Grid */
.ct-grid {
	display: grid;
	gap: var(--ct-space-5);
}

.ct-grid--2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.ct-grid--3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.ct-grid--4 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* Level cards */
.ct-level-card {
	display: flex;
	flex-direction: column;
	padding: var(--ct-space-6);
	background: var(--ct-color-surface);
	border: 1px solid var(--ct-color-border);
	border-radius: var(--ct-radius-lg);
	text-decoration: none;
	color: inherit;
	transition: border-color var(--ct-transition), box-shadow var(--ct-transition);
}

.ct-level-card:hover {
	border-color: var(--ct-color-brand);
	box-shadow: var(--ct-shadow-md);
	color: inherit;
}

.ct-level-card__icon {
	font-size: 2rem;
	margin-bottom: var(--ct-space-3);
}

.ct-level-card__title {
	font-size: 1.125rem;
	margin-bottom: var(--ct-space-2);
}

.ct-level-card__desc {
	font-size: 0.875rem;
	color: var(--ct-color-text-muted);
	margin: 0;
}

/* Compare */
.ct-compare-bar {
	position: sticky;
	bottom: 0;
	z-index: 100;
	background: var(--ct-color-surface);
	border-top: 1px solid var(--ct-color-border);
	box-shadow: var(--ct-shadow-lg);
	padding: var(--ct-space-4);
}

.ct-compare-slot {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 80px;
	border: 2px dashed var(--ct-color-border);
	border-radius: var(--ct-radius-md);
	font-size: 0.875rem;
	color: var(--ct-color-text-muted);
}

/* Alert */
.ct-alert {
	padding: var(--ct-space-4);
	border-radius: var(--ct-radius-md);
	font-size: 0.875rem;
}

.ct-alert--info {
	background: #dbeafe;
	color: #1e40af;
}

.ct-alert--warning {
	background: #fef3c7;
	color: #92400e;
}

[data-theme="dark"] .ct-alert--info,
:root:not([data-theme="light"]) .ct-alert--info {
	background: #1e3a5f;
	color: #93c5fd;
}

/* Loading */
.ct-loading {
	text-align: center;
	padding: var(--ct-space-10);
	color: var(--ct-color-text-muted);
}

.ct-spinner {
	display: inline-block;
	width: 24px;
	height: 24px;
	border: 2px solid var(--ct-color-border);
	border-top-color: var(--ct-color-brand);
	border-radius: 50%;
	animation: ct-spin 0.7s linear infinite;
}

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