/**
 * Admin styles for Murls Discounts — Enterprise UX edition.
 *
 * @package Murls_Discounts
 * @since   2.0.0
 */

/* ─── Reset ─────────────────────────────────────────────── */
.mrd-wrap *, .mrd-wrap *::before, .mrd-wrap *::after { box-sizing: border-box; }

.mrd-wrap {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: #1a1f2e;
	max-width: 900px;
	padding: 0 0 60px;
	margin-top: 18px;
}

/* ─── Top bar ───────────────────────────────────────────── */
.mrd-topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: #0f172a;
	border-radius: 14px;
	padding: 14px 22px;
	margin-bottom: 20px;
}

.mrd-topbar-left, .mrd-topbar-right { display: flex; align-items: center; gap: 12px; }

.mrd-logo { display: flex; align-items: center; gap: 10px; }

.mrd-logo-icon {
	width: 28px; height: 28px;
	background: #6366f1;
	border-radius: 7px;
	display: flex; align-items: center; justify-content: center;
	color: #fff; font-size: 13px; font-weight: 700; flex-shrink: 0;
}

.mrd-logo-text { font-size: 15px; font-weight: 700; color: #f1f5f9; letter-spacing: -0.02em; }

.mrd-version {
	font-size: 11px; color: #64748b;
	background: #1e293b; padding: 2px 8px; border-radius: 20px; font-weight: 500;
}

.mrd-btn {
	display: inline-flex; align-items: center;
	padding: 6px 14px; border-radius: 7px;
	font-size: 12px; font-weight: 500;
	text-decoration: none; cursor: pointer; transition: all 0.15s;
}

.mrd-btn-ghost { color: #94a3b8; background: transparent; border: 1px solid #334155; }
.mrd-btn-ghost:hover { color: #f1f5f9; border-color: #475569; background: #1e293b; }

/* ─── Alert ─────────────────────────────────────────────── */
.mrd-alert {
	display: flex; align-items: center; gap: 10px;
	padding: 12px 16px; border-radius: 10px;
	font-size: 13px; font-weight: 500; margin-bottom: 18px;
}

.mrd-alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.mrd-alert-icon { font-size: 15px; font-weight: 700; }

/* ─── Stats row ─────────────────────────────────────────── */
.mrd-stats-row {
	display: grid; grid-template-columns: repeat(4, 1fr);
	gap: 10px; margin-bottom: 20px;
}

.mrd-stat-card {
	background: #fff; border: 0.5px solid #e2e8f0;
	border-radius: 12px; padding: 14px 16px;
}

.mrd-stat-label { font-size: 11px; color: #64748b; font-weight: 500; margin-bottom: 4px; line-height: 1.4; }
.mrd-stat-value { font-size: 22px; font-weight: 700; color: #0f172a; letter-spacing: -0.03em; line-height: 1; margin-bottom: 3px; }
.mrd-stat-period { font-size: 10px; color: #94a3b8; }

/* ─── Welcome banner ────────────────────────────────────── */
.mrd-welcome {
	display: flex; align-items: flex-start; gap: 14px;
	background: #eff6ff; border: 1px solid #bfdbfe;
	border-radius: 12px; padding: 16px 18px;
	margin-bottom: 20px;
}

.mrd-welcome-icon { font-size: 22px; line-height: 1; flex-shrink: 0; margin-top: 1px; }

.mrd-welcome-body strong { display: block; font-size: 13px; color: #1e40af; margin-bottom: 4px; }
.mrd-welcome-body p { font-size: 12px; color: #3b82f6; margin: 0; line-height: 1.55; }

/* ─── Section header ────────────────────────────────────── */
.mrd-section-header { margin-bottom: 14px; }
.mrd-section-title { font-size: 16px; font-weight: 700; color: #0f172a; margin: 0 0 3px; }
.mrd-section-desc { font-size: 12px; color: #64748b; margin: 0; line-height: 1.55; max-width: 640px; }

/* ─── Gateway cards ─────────────────────────────────────── */
.mrd-gateways { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }

.mrd-gateway-card {
	background: #fff; border: 1.5px solid #e2e8f0;
	border-radius: 14px; overflow: hidden;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.mrd-gateway-card.is-active {
	border-color: #6366f1;
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.06);
}

.mrd-gateway-card.is-unavailable { opacity: 0.6; }

/* Header */
.mrd-gateway-header {
	display: flex; align-items: center; justify-content: space-between;
	padding: 14px 18px; cursor: pointer; background: #fff;
	user-select: none; transition: background 0.15s; gap: 12px;
}

.mrd-gateway-header:hover { background: #fafbfc; }

.mrd-gateway-header-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.mrd-gateway-header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Toggle switch */
.mrd-toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; cursor: pointer; }
.mrd-toggle-input { opacity: 0; width: 0; height: 0; position: absolute; }
.mrd-toggle-slider { position: absolute; inset: 0; background: #cbd5e1; border-radius: 22px; transition: background 0.2s; }
.mrd-toggle-slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.mrd-toggle-input:checked + .mrd-toggle-slider { background: #6366f1; }
.mrd-toggle-input:checked + .mrd-toggle-slider::before { transform: translateX(18px); }
.mrd-toggle-input:disabled + .mrd-toggle-slider { opacity: 0.4; cursor: not-allowed; }

.mrd-gateway-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mrd-gateway-name { font-size: 14px; font-weight: 600; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrd-gateway-id { font-size: 10px; color: #94a3b8; font-family: monospace; }

/* Badges */
.mrd-badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.mrd-badge-green  { background: #dcfce7; color: #15803d; }
.mrd-badge-amber  { background: #fef3c7; color: #92400e; }
.mrd-badge-gray   { background: #f1f5f9; color: #64748b; }

/* Chevron */
.mrd-chevron { color: #94a3b8; transition: transform 0.25s; display: flex; align-items: center; flex-shrink: 0; }
.mrd-gateway-card.is-open .mrd-chevron { transform: rotate(180deg); }

/* Card body */
.mrd-gateway-body { display: none; border-top: 1px solid #f1f5f9; }
.mrd-gateway-card.is-open .mrd-gateway-body { display: block; }
.mrd-body-inner { padding: 18px 20px 22px; }

/* Unavailable */
.mrd-gateway-unavailable-body .mrd-body-inner { padding: 14px 20px; }

.mrd-unavailable-msg {
	display: flex; align-items: flex-start; gap: 12px;
	background: #fff7ed; border: 1px solid #fed7aa;
	border-radius: 10px; padding: 12px 14px;
}

.mrd-unavail-icon { font-size: 18px; flex-shrink: 0; line-height: 1.3; }
.mrd-unavailable-msg strong { display: block; font-size: 13px; color: #9a3412; margin-bottom: 3px; }
.mrd-unavailable-msg p { font-size: 12px; color: #c2410c; margin: 0; line-height: 1.5; }
.mrd-unavailable-msg a { color: #c2410c; }

/* ─── Section dividers ──────────────────────────────────── */
.mrd-section-divider {
	display: flex; align-items: center; gap: 8px;
	margin: 20px 0 14px;
}

.mrd-divider-first { margin-top: 0; }

.mrd-section-divider::before,
.mrd-section-divider::after { content: ''; flex: 1; height: 1px; background: #f1f5f9; }

.mrd-section-divider span {
	font-size: 10px; font-weight: 700; color: #94a3b8;
	text-transform: uppercase; letter-spacing: 0.09em; white-space: nowrap;
}

/* ─── Conditions intro ──────────────────────────────────── */
.mrd-conditions-intro {
	font-size: 12px; color: #64748b;
	background: #f8fafc; border: 1px solid #e8edf2;
	border-radius: 8px; padding: 9px 12px;
	margin-bottom: 14px; line-height: 1.5;
}

/* ─── Form fields ───────────────────────────────────────── */
.mrd-field { margin-bottom: 14px; }
.mrd-field:last-child { margin-bottom: 0; }

.mrd-field-group.mrd-field-inline { display: flex; gap: 16px; align-items: flex-start; }
.mrd-field-group.mrd-field-inline .mrd-field { flex: 1; }
.mrd-field-amount { max-width: 170px; }

.mrd-label {
	display: flex; align-items: center; gap: 6px;
	font-size: 12px; font-weight: 600; color: #475569;
	margin-bottom: 6px;
}

.mrd-label-optional { font-size: 10px; font-weight: 400; color: #94a3b8; background: #f1f5f9; padding: 1px 5px; border-radius: 4px; }

/* Type / mode tabs */
.mrd-type-tabs { display: inline-flex; background: #f1f5f9; border-radius: 8px; padding: 3px; gap: 2px; }

.mrd-type-tab {
	padding: 6px 12px; border-radius: 6px; border: none;
	background: transparent; font-size: 12px; font-weight: 500;
	color: #64748b; cursor: pointer; transition: all 0.15s; white-space: nowrap;
}

.mrd-type-tab:hover { color: #374151; background: #e2e8f0; }

.mrd-type-tab.is-active { background: #fff; color: #6366f1; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* Input with affix */
.mrd-input-affix { display: flex; align-items: stretch; }

.mrd-affix {
	display: flex; align-items: center; padding: 0 10px;
	background: #f8fafc; border: 1.5px solid #e2e8f0;
	font-size: 12px; font-weight: 600; color: #64748b;
	border-radius: 8px 0 0 8px; border-right: none; white-space: nowrap;
}

.mrd-input-affix .mrd-input { border-radius: 0 8px 8px 0; }

/* Core input */
.mrd-input {
	width: 100%; padding: 8px 11px;
	border: 1.5px solid #e2e8f0; border-radius: 8px;
	font-size: 13px; color: #1a1f2e; background: #fff;
	transition: border-color 0.15s, box-shadow 0.15s;
	appearance: none; font-family: inherit;
}

.mrd-input:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.mrd-input-wide { max-width: 400px; }
.mrd-value-input { max-width: 110px; }

/* Textarea */
.mrd-textarea {
	width: 100%; max-width: 480px; padding: 8px 11px;
	border: 1.5px solid #e2e8f0; border-radius: 8px;
	font-size: 13px; color: #1a1f2e; background: #fff;
	resize: vertical; font-family: inherit; line-height: 1.5;
	min-height: 60px; transition: border-color 0.15s, box-shadow 0.15s;
}

.mrd-textarea:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.1); }

/* Hint text */
.mrd-hint { font-size: 11px; color: #94a3b8; margin: 4px 0 0; line-height: 1.55; }
.mrd-hint-below-check { margin-top: 5px; padding-left: 24px; }

/* Inline checkbox */
.mrd-inline-check { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.mrd-check { width: 15px; height: 15px; accent-color: #6366f1; cursor: pointer; flex-shrink: 0; }
.mrd-check-label { font-size: 12px; font-weight: 500; color: #1a1f2e; }

/* Hidden */
.mrd-hidden { display: none !important; }

/* ─── Checkout preview ──────────────────────────────────── */
.mrd-checkout-preview {
	background: #f8fafc; border: 1px solid #e2e8f0;
	border-radius: 10px; padding: 12px 14px; margin-bottom: 14px;
}

.mrd-preview-label { font-size: 10px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }

.mrd-preview-box {
	background: #fff; border: 1px solid #e2e8f0;
	border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px;
}

.mrd-preview-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.mrd-preview-row-name { color: #374151; }
.mrd-preview-row-value { font-weight: 600; color: #374151; }
.mrd-preview-discount-name { color: #15803d; }
.mrd-preview-discount-value { color: #15803d; }

.mrd-preview-total-row {
	border-top: 1px solid #f1f5f9; padding-top: 6px;
	margin-top: 2px;
}

.mrd-preview-total-row .mrd-preview-row-name { font-weight: 600; font-size: 13px; color: #0f172a; }
.mrd-preview-total-row .mrd-preview-row-value { font-size: 11px; font-weight: 400; color: #94a3b8; }

/* ─── Schedule date row ─────────────────────────────────── */
.mrd-schedule-fields, .mrd-scope-fields, .mrd-notice-fields {
	margin-top: 2px; margin-bottom: 12px;
	padding: 14px 16px;
	background: #f8fafc; border: 1px solid #e8edf2; border-radius: 10px;
}

.mrd-schedule-fields .mrd-input,
.mrd-scope-fields .mrd-input,
.mrd-notice-fields .mrd-input,
.mrd-notice-fields .mrd-textarea { background: #fff; }

.mrd-date-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.mrd-date-field { flex: 1; min-width: 180px; }
.mrd-date-arrow { font-size: 16px; color: #94a3b8; padding-bottom: 10px; flex-shrink: 0; }
.mrd-date-icon { font-size: 13px; }

/* ─── Category select ───────────────────────────────────── */
.mrd-cat-select {
	width: 100%; max-width: 400px;
	border: 1.5px solid #e2e8f0; border-radius: 8px;
	font-size: 12px; color: #1a1f2e; background: #fff;
	padding: 3px 0; display: block;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.mrd-cat-select:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.mrd-cat-select option { padding: 5px 10px; font-size: 12px; }
.mrd-cat-select option:checked { background: #6366f1; color: #fff; }
.mrd-cat-count { color: #94a3b8; }

.mrd-no-cats {
	display: flex; align-items: center; gap: 8px;
	font-size: 12px; color: #64748b;
	background: #f8fafc; border: 1px dashed #e2e8f0;
	border-radius: 8px; padding: 10px 12px;
}

.mrd-no-cats a { color: #6366f1; text-decoration: none; font-weight: 500; }
.mrd-no-cats a:hover { text-decoration: underline; }

/* ─── SKU tag-pill input ────────────────────────────────── */
.mrd-sku-tag-wrap {
	display: flex; flex-wrap: wrap; align-items: center;
	gap: 5px; min-height: 38px; padding: 5px 8px;
	border: 1.5px solid #e2e8f0; border-radius: 8px;
	background: #fff; max-width: 400px; cursor: text;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.mrd-sku-tag-wrap:focus-within { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.1); }

.mrd-sku-tags { display: contents; }

.mrd-sku-pill {
	display: inline-flex; align-items: center; gap: 4px;
	background: #eef2ff; color: #4338ca;
	border: 1px solid #c7d2fe; border-radius: 20px;
	padding: 2px 8px; font-size: 11px; font-weight: 600;
	font-family: monospace; white-space: nowrap;
}

.mrd-sku-pill-remove {
	background: none; border: none; padding: 0;
	cursor: pointer; color: #6366f1; font-size: 13px;
	line-height: 1; display: flex; align-items: center;
	opacity: 0.6; transition: opacity 0.1s;
}

.mrd-sku-pill-remove:hover { opacity: 1; }

.mrd-sku-input {
	border: none !important; box-shadow: none !important;
	padding: 3px 4px !important; min-width: 160px; flex: 1;
	font-size: 12px; background: transparent; outline: none;
	color: #1a1f2e; font-family: inherit;
}

/* ─── Notice preview ────────────────────────────────────── */
.mrd-notice-preview { margin-top: 8px; }

.mrd-notice-preview-box {
	display: flex; align-items: flex-start; gap: 8px;
	background: #eff6ff; border: 1px solid #bfdbfe;
	border-radius: 8px; padding: 9px 12px;
	font-size: 12px; color: #1e40af; line-height: 1.5;
}

.mrd-notice-preview-icon { font-size: 14px; flex-shrink: 0; line-height: 1.4; }

/* ─── Scope mode hint swap ──────────────────────────────── */
.mrd-scope-hint-include, .mrd-scope-hint-exclude,
.mrd-min-hint-full, .mrd-min-hint-eligible { margin-top: 5px; }

/* ─── Form footer ───────────────────────────────────────── */
.mrd-form-footer { display: flex; align-items: center; gap: 16px; padding: 16px 0; }

.mrd-save-btn.button-primary {
	background: #6366f1 !important; border-color: #6366f1 !important;
	color: #fff !important; padding: 10px 26px !important;
	height: auto !important; font-size: 14px !important;
	font-weight: 600 !important; border-radius: 9px !important;
	box-shadow: none !important; transition: background 0.15s !important;
}

.mrd-save-btn.button-primary:hover { background: #4f46e5 !important; border-color: #4f46e5 !important; }

.mrd-footer-note { font-size: 11px; color: #94a3b8; margin: 0; line-height: 1.5; }

/* ─── Responsive ────────────────────────────────────────── */
@media ( max-width: 782px ) {
	.mrd-stats-row { grid-template-columns: 1fr 1fr; }
	.mrd-field-group.mrd-field-inline { flex-direction: column; gap: 0; }
	.mrd-date-row { flex-direction: column; gap: 8px; }
	.mrd-date-arrow { display: none; }
	.mrd-gateway-header { padding: 12px 14px; }
	.mrd-body-inner { padding: 14px 14px 16px; }
	.mrd-topbar { border-radius: 10px; padding: 11px 14px; }
}

@media ( max-width: 480px ) {
	.mrd-stats-row { grid-template-columns: 1fr; }
	.mrd-form-footer { flex-direction: column; align-items: flex-start; }
}
