/* ============================================================
   AI Ürün Tasarımcısı — arayüz stili
   Dikey, ferah form düzeni; yumuşak gradyanlı zemin üzerinde
   yüzen bir kart. Mobilde sıkışıklığı önlemek için bol boşluk.
   ============================================================ */

:root {
	--aipd-ink: #17171d;
	--aipd-muted: #7c8290;
	--aipd-border: #e8e6ee;
	--aipd-field-bg: #f5f6f9;
	--aipd-cyan: #0090a8;
	--aipd-magenta: #c23670;
}

/* ---------- Tema çakışması koruması ----------
   Bazı temalar 'button', '.button', 'select', 'textarea' gibi genel
   seçicilere kendi stillerini uygular ve bunlar eklenti arayüzüne
   sızabilir. 'all: unset' ile önce tüm miras/varsayılan stilleri
   sıfırlıyoruz. :where() kullanılarak bu reset kuralının CSS
   özgüllüğü SIFIR yapılır — böylece aşağıdaki normal .aipd-* sınıf
   kuralları, özgüllük hesabına bakılmaksızın HER ZAMAN reset'i ezer. */
:where(.aipd-modal-overlay button, .aipd-open-modal-btn) {
	all: unset;
	box-sizing: border-box;
	cursor: pointer;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:where(.aipd-modal-overlay select, .aipd-modal-overlay textarea, .aipd-modal-overlay input[type="file"]) {
	all: unset;
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Aç butonları ---------- */

.aipd-trigger-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 14px;
}

.aipd-open-modal-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 11px 20px;
	background: var(--aipd-ink);
	color: #fff !important;
	border: none;
	border-radius: 999px;
	font-weight: 600;
	letter-spacing: 0.01em;
	transition: transform 0.15s ease, background 0.15s ease;
}

.aipd-open-modal-btn:hover {
	background: var(--aipd-cyan);
	transform: translateY(-1px);
}

.aipd-open-modal-btn-secondary {
	background: #fff !important;
	color: var(--aipd-ink) !important;
	border: 1.5px solid var(--aipd-border);
}

.aipd-open-modal-btn-secondary:hover {
	border-color: var(--aipd-cyan);
	background: #fff !important;
	color: var(--aipd-cyan) !important;
}

.aipd-form-subtitle {
	font-size: 13px;
	color: var(--aipd-muted);
	margin: -10px 0 20px;
}

.aipd-file-badge {
	flex-shrink: 0;
	width: 38px;
	height: 38px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--aipd-ink);
	color: #fff;
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 0.02em;
	border-radius: 8px;
}

/* ---------- Modal kabuğu ---------- */

.aipd-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(15, 18, 25, 0.55);
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.aipd-modal {
	position: relative;
	width: 100%;
	max-width: 550px;
	max-height: 90vh;
	overflow-y: auto;
	border-radius: 24px;
	padding: 34px 28px 28px;
	box-shadow: 0 30px 70px rgba(0, 0, 0, 0.3);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--aipd-ink);
	background:
		radial-gradient(ellipse 90% 50% at 50% 0%, #e3f1ff 0%, rgba(227, 241, 255, 0) 70%),
		#fdfdfe;
}

.aipd-modal-close {
	display: flex;
	align-items: center;
	justify-content: center;
	position: absolute;
	top: 16px;
	right: 18px;
	background: rgba(23, 23, 29, 0.06);
	border: none;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	color: var(--aipd-ink);
	width: 32px;
	height: 32px;
	border-radius: 50%;
	transition: background 0.15s ease;
	z-index: 2;
}

.aipd-modal-close:hover {
	background: rgba(23, 23, 29, 0.12);
}

.aipd-form-title {
	font-size: 22px;
	font-weight: 700;
	margin: 0 0 22px;
	padding-right: 30px;
}

/* ---------- Form alanları ---------- */

.aipd-field {
	margin-bottom: 18px;
}

.aipd-field > label {
	display: block;
	font-size: 13px;
	font-weight: 700;
	margin-bottom: 7px;
	color: var(--aipd-ink);
}

.aipd-optional-tag {
	font-weight: 400;
	font-size: 11px;
	color: var(--aipd-muted);
}

#aipd-prompt-input {
	display: block;
	width: 100%;
	box-sizing: border-box;
	resize: vertical;
	border: 1.5px solid var(--aipd-border);
	border-radius: 12px;
	padding: 12px 14px;
	font-size: 14px;
	font-family: inherit;
	background: var(--aipd-field-bg);
	transition: border-color 0.15s ease, background 0.15s ease;
}

#aipd-prompt-input:focus {
	outline: none;
	border-color: var(--aipd-cyan);
	background: #fff;
}

/* ---------- Dropzone (logo yükleme) ---------- */

.aipd-collapsible-label {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	background: none;
	border: none;
	padding: 4px 0 7px;
	font-size: 13px;
	font-weight: 700;
	color: var(--aipd-ink);
	cursor: pointer;
	text-align: left;
}

.aipd-collapsible-arrow {
	transition: transform 0.15s ease;
	color: var(--aipd-muted);
	flex-shrink: 0;
}

.aipd-collapsible-label.is-open .aipd-collapsible-arrow {
	transform: rotate(180deg);
}

.aipd-dropzone {
	border: 1.5px dashed var(--aipd-border);
	border-radius: 12px;
	background: var(--aipd-field-bg);
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease;
	padding: 14px;
}

.aipd-dropzone:hover,
.aipd-dropzone.is-dragover {
	border-color: var(--aipd-cyan);
	background: #eef8fa;
}

.aipd-dropzone-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 4px;
	color: var(--aipd-muted);
	padding: 6px 0;
}

.aipd-dropzone-text {
	font-size: 13px;
	font-weight: 600;
	color: var(--aipd-ink);
}

.aipd-dropzone-hint {
	font-size: 11px;
	letter-spacing: 0.03em;
}

.aipd-dropzone-filled {
	align-items: center;
	gap: 10px;
}

.aipd-dropzone-filled img {
	width: 38px;
	height: 38px;
	object-fit: cover;
	border-radius: 8px;
	border: 1px solid var(--aipd-border);
	background: #fff;
}

.aipd-dropzone-filled span {
	flex: 1;
	font-size: 13px;
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.aipd-chip-remove {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--aipd-ink);
	color: #fff;
	border: none;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	line-height: 1;
	font-size: 14px;
	cursor: pointer;
	flex-shrink: 0;
}

/* ---------- Ebat dropdown ---------- */

.aipd-select-wrap {
	position: relative;
}

.aipd-select-wrap::after {
	content: "";
	position: absolute;
	right: 14px;
	top: 50%;
	width: 8px;
	height: 8px;
	border-right: 2px solid var(--aipd-muted);
	border-bottom: 2px solid var(--aipd-muted);
	transform: translateY(-70%) rotate(45deg);
	pointer-events: none;
}

.aipd-select-wrap select {
	display: block;
	width: 100%;
	appearance: none;
	-webkit-appearance: none;
	box-sizing: border-box;
	border: 1.5px solid var(--aipd-border);
	border-radius: 12px;
	padding: 11px 36px 11px 14px;
	font-size: 14px;
	font-family: inherit;
	background: var(--aipd-field-bg);
	cursor: pointer;
	transition: border-color 0.15s ease;
}

.aipd-select-wrap select:focus {
	outline: none;
	border-color: var(--aipd-cyan);
}

/* ---------- Renk Seçeneği: pill grup + renk seçiciler ---------- */

.aipd-pill-group {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 10px;
}

.aipd-pill {
	display: inline-flex;
	align-items: center;
	border: none;
	background: var(--aipd-field-bg);
	color: var(--aipd-ink);
	border-radius: 999px;
	padding: 8px 16px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.15s ease;
}

.aipd-pill:hover {
	background: #e6e9ef;
}

.aipd-pill.is-active {
	background: var(--aipd-ink);
	color: #fff;
}

.aipd-swatches {
	display: flex;
	gap: 8px;
}

.aipd-swatch-item input[type="color"] {
	width: 34px;
	height: 34px;
	padding: 0;
	border: 1.5px solid var(--aipd-border);
	border-radius: 8px;
	cursor: pointer;
	background: none;
}

/* ---------- Durum / bilgi metinleri ---------- */

.aipd-remaining-info {
	font-size: 12px;
	color: var(--aipd-muted);
	margin-bottom: 14px;
}

.aipd-error-msg {
	color: var(--aipd-magenta);
	font-size: 13px;
	font-weight: 600;
	margin: -6px 0 14px;
}

/* ---------- Butonlar ---------- */

.aipd-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	border: none;
	border-radius: 999px;
	padding: 13px 22px;
	font-size: 14.5px;
	font-weight: 700;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
	font-family: inherit;
}

.aipd-btn-block {
	width: 100%;
}

.aipd-btn-primary {
	background: var(--aipd-ink);
	color: #fff;
}

.aipd-btn-primary:hover {
	background: var(--aipd-cyan);
	color: #fff;
}

.aipd-btn-primary:active {
	transform: scale(0.98);
}

.aipd-btn-primary:disabled {
	opacity: 0.6;
	cursor: default;
	transform: none;
}

.aipd-btn-ghost {
	background: transparent;
	color: var(--aipd-ink);
	border: 1.5px solid var(--aipd-border);
}

.aipd-btn-ghost:hover {
	border-color: var(--aipd-ink);
	color: var(--aipd-ink);
}

.aipd-btn-spinner {
	width: 15px;
	height: 15px;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: aipd-spin 0.7s linear infinite;
}

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

/* ---------- Adım 2: Önizleme ---------- */

.aipd-back-arrow {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: none;
	background: rgba(23, 23, 29, 0.06);
	color: var(--aipd-ink);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	margin-bottom: 14px;
	transition: background 0.15s ease;
}

.aipd-back-arrow:hover {
	background: rgba(23, 23, 29, 0.12);
}

#aipd-canvas-wrap {
	position: relative;
	border-radius: 16px;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 10px 30px rgba(30, 60, 110, 0.12);
	margin-bottom: 18px;
}

#aipd-preview-canvas {
	display: block;
	width: 100%;
	height: auto;
}

.aipd-step2-actions {
	display: flex;
	gap: 10px;
}

.aipd-step2-actions .aipd-btn {
	flex: 1;
}

.aipd-success-msg {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: #e6f7f2;
	color: #0a7a5a;
	border-radius: 12px;
	padding: 14px 16px;
	font-size: 14px;
	font-weight: 700;
	animation: aipd-pop-in 0.2s ease;
}

@keyframes aipd-pop-in {
	from { opacity: 0; transform: translateY(4px); }
	to { opacity: 1; transform: translateY(0); }
}

/* ---------- Üyelik gerekli ekranı ---------- */

.aipd-login-required {
	text-align: center;
	padding: 40px 6px 10px;
}

.aipd-login-icon {
	font-size: 30px;
	margin-bottom: 10px;
}

.aipd-login-text {
	font-size: 15px;
	color: var(--aipd-ink);
	margin-bottom: 20px;
}

.aipd-login-actions {
	display: flex;
	gap: 10px;
	justify-content: center;
}

.aipd-login-actions .aipd-btn {
	flex: 1;
	max-width: 160px;
}

/* ---------- Mobil ---------- */

@media (max-width: 480px) {
	.aipd-modal {
		padding: 28px 18px 22px;
		border-radius: 20px;
	}
	.aipd-form-title {
		font-size: 19px;
	}
	.aipd-field {
		margin-bottom: 15px;
	}
}
