/**
 * Admin styles for Popup Coupon Generator for WooCommerce
 */

.popucoge-header-actions {
	margin: 20px 0;
}

.popucoge-status-badge {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 3px;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
}

.popucoge-status-badge.status-active {
	background-color: #00a32a;
	color: #ffffff;
}

.popucoge-status-badge.status-inactive {
	background-color: #d63638;
	color: #ffffff;
}

.popucoge-popup-page .form-table th {
	width: 200px;
}

.popucoge-popup-page .required {
	color: #d63638;
}

/* Popup editor (tabbed) */
.popucoge-popup-editor .popucoge-popup-tabs {
	margin: 20px 0 0;
	padding-top: 0;
}

.popucoge-popup-editor .popucoge-tab-panels {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-top: none;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
	margin-bottom: 24px;
}

/* !important: tab visibility must not be overridden by stray inline display (e.g. legacy jQuery .toggle on panels). */
.popucoge-popup-editor .popucoge-tab-panel {
	display: none !important;
	padding: 0;
}

.popucoge-popup-editor .popucoge-tab-panel.is-active {
	display: block !important;
}

.popucoge-panel-card {
	padding: 20px 24px 8px;
	max-width: 920px;
}

.popucoge-panel-card h3 {
	margin: 0 0 16px;
	font-size: 14px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: #1d2327;
	border-bottom: 1px solid #dcdcde;
	padding-bottom: 10px;
}

.popucoge-panel-card .form-table th {
	width: 220px;
	padding-top: 16px;
	vertical-align: top;
}

.popucoge-panel-card .form-table td {
	padding-top: 16px;
}

.popucoge-panel-card .form-table {
	width: 100%;
	table-layout: fixed;
}

.popucoge-panel-card .form-table th,
.popucoge-panel-card .form-table td {
	overflow-wrap: anywhere;
}

.popucoge-panel-card .form-table input[type="text"],
.popucoge-panel-card .form-table input[type="email"],
.popucoge-panel-card .form-table input[type="number"],
.popucoge-panel-card .form-table input[type="tel"],
.popucoge-panel-card .form-table input[type="date"],
.popucoge-panel-card .form-table select,
.popucoge-panel-card .form-table textarea {
	width: 100%;
	box-sizing: border-box;
}

.popucoge-checkbox-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 20px;
	margin: 4px 0 0;
}

.popucoge-check-label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-weight: 500;
}

/* Contacts: Details modal */
.popucoge-contacts-col-details {
	width: 100px;
	text-align: center;
	white-space: nowrap;
}

.popucoge-contact-details-btn .dashicons {
	line-height: 1.4;
	vertical-align: text-bottom;
}

.popucoge-contact-details-modal {
	position: fixed;
	inset: 0;
	z-index: 1000000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
}

.popucoge-contact-details-modal.popucoge-contact-details-modal--hidden {
	display: none !important;
}

.popucoge-contact-details-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
}

.popucoge-contact-details-modal__panel {
	position: relative;
	z-index: 1;
	background: #fff;
	border-radius: 4px;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
	max-width: 560px;
	width: 100%;
	max-height: 85vh;
	overflow: auto;
}

.popucoge-contact-details-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 20px;
	border-bottom: 1px solid #dcdcde;
}

.popucoge-contact-details-modal__header h2 {
	margin: 0;
	font-size: 1.1rem;
}

.popucoge-contact-details-modal__close.button-link {
	font-size: 24px;
	line-height: 1;
	text-decoration: none;
	color: #50575e;
}

.popucoge-contact-details-modal__body {
	padding: 16px 20px;
}

.popucoge-contact-details-dl {
	margin: 0;
	display: grid;
	grid-template-columns: minmax(120px, 34%) 1fr;
	gap: 8px 16px;
}

.popucoge-contact-details-dl dt {
	margin: 0;
	font-weight: 600;
	color: #1d2327;
}

.popucoge-contact-details-dl dd {
	margin: 0;
	word-break: break-word;
}

.popucoge-contact-details-subheading {
	margin: 20px 0 10px;
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #1d2327;
}

.popucoge-contact-details-modal__footer {
	margin: 0;
	padding: 12px 20px 18px;
	border-top: 1px solid #dcdcde;
	text-align: right;
}

body.popucoge-modal-open {
	overflow: hidden;
}

.popucoge-popup-submit {
	margin-top: 8px;
	padding-top: 16px;
	border-top: 1px solid #dcdcde;
}

.popucoge-form-source-switch-wrap {
	display: inline-flex;
	align-items: center;
	gap: 10px;
}

.popucoge-form-source-label {
	font-weight: 500;
	color: #6c7781;
}

.popucoge-form-source-label.is-active {
	color: #1d2327;
}

.popucoge-switch {
	position: relative;
	display: inline-block;
	width: 46px;
	height: 24px;
}

.popucoge-switch input {
	opacity: 0;
	width: 0;
	height: 0;
}

.popucoge-slider {
	position: absolute;
	cursor: pointer;
	inset: 0;
	background-color: #b4bcc2;
	border-radius: 999px;
	transition: 0.2s;
}

.popucoge-slider::before {
	content: "";
	position: absolute;
	height: 18px;
	width: 18px;
	left: 3px;
	top: 3px;
	background-color: #fff;
	border-radius: 50%;
	transition: 0.2s;
}

.popucoge-switch input:checked + .popucoge-slider {
	background-color: #2271b1;
}

.popucoge-switch input:checked + .popucoge-slider::before {
	transform: translateX(22px);
}

.popucoge-form-fields-builder {
	max-width: 100%;
}

.popucoge-fields-list {
	display: grid;
	gap: 10px;
}

.popucoge-field-card {
	border: 1px solid #dcdcde;
	border-radius: 4px;
	padding: 10px;
	background: #fff;
}

.popucoge-field-card-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(260px, 1fr));
	gap: 10px 14px;
}

.popucoge-field-col {
	display: grid;
	gap: 10px;
}

.popucoge-field-card-grid p {
	margin: 0;
}

.popucoge-field-card-grid label {
	display: inline-block;
	margin-bottom: 4px;
	font-weight: 600;
}

.popucoge-field-card-grid select {
	width: 100%;
	max-width: 100%;
}

.popucoge-field-actions {
	margin: 10px 0 0;
}

.popucoge-field-actions .button-small {
	margin-right: 4px;
}

/* Statistics page */
.popucoge-stats-overview {
	margin: 20px 0;
}

.popucoge-stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 20px;
	margin: 20px 0;
}

.popucoge-stat-box {
	background: #fff;
	border: 1px solid #ccd0d4;
	border-radius: 4px;
	padding: 20px;
	text-align: center;
}

.popucoge-stat-box h3 {
	margin: 0 0 10px;
	font-size: 14px;
	font-weight: 600;
	color: #666;
	text-transform: uppercase;
}

.popucoge-stat-value {
	font-size: 32px;
	font-weight: 700;
	color: #2271b1;
	margin: 0;
}

.popucoge-stats-automations {
	margin-top: 40px;
}

.popucoge-stats-automations h2 {
	margin-bottom: 20px;
}

.popucoge-stats-automations table {
	margin-top: 20px;
}

.popucoge-stats-automations small {
	display: block;
	margin-top: 5px;
}

/* Settings page */
.popucoge-settings .form-table th {
	width: 250px;
}

.popucoge-automation-page .form-table th {
	width: 250px;
}

/* Responsive */
@media (max-width: 782px) {
	.popucoge-stats-grid {
		grid-template-columns: 1fr;
	}

	.popucoge-panel-card .form-table,
	.popucoge-panel-card .form-table tbody,
	.popucoge-panel-card .form-table tr,
	.popucoge-panel-card .form-table th,
	.popucoge-panel-card .form-table td {
		display: block;
		width: 100%;
	}

	.popucoge-panel-card .form-table th {
		padding: 12px 0 6px;
	}

	.popucoge-panel-card .form-table td {
		padding: 0 0 12px;
	}

	.popucoge-field-card-grid {
		grid-template-columns: 1fr;
	}
}

/* Popup editor: Design tab — 3×3 position grid (inset-area style) */
.popucoge-design-position-fieldset {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.popucoge-design-grid {
	display: inline-flex;
	flex-direction: column;
	gap: 4px;
	padding: 12px;
	background: #f6f7f7;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	max-width: 100%;
}

.popucoge-design-grid-row {
	display: flex;
	gap: 4px;
	justify-content: center;
}

.popucoge-design-cell {
	flex: 0 0 auto;
	width: 104px;
	min-height: 56px;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 3px;
}

.popucoge-design-cell--anchor {
	background: linear-gradient(180deg, #fff6e5 0%, #ffe8cc 100%);
	border-color: #dba617;
	flex-direction: column;
	gap: 2px;
	padding: 4px 2px;
}

.popucoge-design-anchor-label {
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #996800;
	line-height: 1.2;
	text-align: center;
}

.popucoge-design-choice {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	min-height: 48px;
	margin: 0;
	padding: 6px 4px;
	cursor: pointer;
	box-sizing: border-box;
	border-radius: 2px;
	text-align: center;
}

.popucoge-design-choice--center {
	min-height: 36px;
}

.popucoge-design-choice input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.popucoge-design-choice-text {
	font-size: 11px;
	line-height: 1.25;
	font-weight: 500;
	color: #1d2327;
}

.popucoge-design-choice:hover .popucoge-design-choice-text {
	color: #2271b1;
}

.popucoge-design-choice:has(input:focus-visible) {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.popucoge-design-choice:has(input:checked) {
	background: #2271b1;
	box-shadow: inset 0 0 0 1px #135e96;
}

.popucoge-design-choice:has(input:checked) .popucoge-design-choice-text {
	color: #fff;
}

.popucoge-design-cell--anchor .popucoge-design-choice:has(input:checked) {
	background: #b32d2e;
	box-shadow: inset 0 0 0 1px #8a2424;
}

@media (max-width: 600px) {
	.popucoge-design-cell {
		width: 88px;
		min-height: 50px;
	}

	.popucoge-design-choice-text {
		font-size: 10px;
	}
}

