/**
 * Receipt Settings page styles.
 *
 * @package    OliverPOS
 * @subpackage OliverPOS/assets/css
 * @since      1.2.0
 */

/* --------------------------------------------------------
   Layout: two-panel builder
   -------------------------------------------------------- */
.oliver-pos-receipt-builder {
	display: flex;
	gap: 24px;
	margin-top: 20px;
	align-items: flex-start;
}

.oliver-pos-receipt-settings-panel {
	flex: 1 1 55%;
	min-width: 0;
}

.oliver-pos-receipt-preview-panel {
	flex: 0 0 340px;
	position: sticky;
	top: 40px;
}

@media screen and (max-width: 1200px) {
	.oliver-pos-receipt-builder {
		flex-direction: column;
	}

	.oliver-pos-receipt-preview-panel {
		position: static;
		flex: 1 1 auto;
		width: 100%;
		max-width: 400px;
		margin: 0 auto;
	}
}

/* --------------------------------------------------------
   Template header card
   -------------------------------------------------------- */
.oliver-pos-receipt-template-header {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 16px;
	margin-bottom: 16px;
	display: flex;
	gap: 24px;
	align-items: center;
	flex-wrap: wrap;
}

.oliver-pos-receipt-template-meta {
	display: flex;
	gap: 16px;
	align-items: center;
	flex: 1;
}

.oliver-pos-receipt-template-meta label {
	display: flex;
	align-items: center;
	gap: 8px;
}

.oliver-pos-receipt-template-meta input[type="text"] {
	width: 240px;
}

.oliver-pos-receipt-paper-width {
	display: flex;
	gap: 12px;
	align-items: center;
}

.oliver-pos-receipt-paper-width label {
	display: flex;
	align-items: center;
	gap: 4px;
	cursor: pointer;
}

.oliver-pos-toggle-label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	white-space: nowrap;
}

/* --------------------------------------------------------
   Section list & cards
   -------------------------------------------------------- */
.oliver-pos-sections-header {
	margin-bottom: 8px;
}

.oliver-pos-sections-header h3 {
	margin-bottom: 2px;
}

.oliver-pos-sections-list {
	margin-bottom: 12px;
}

.oliver-pos-section-card {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	margin-bottom: 4px;
	transition: box-shadow 0.15s;
}

.oliver-pos-section-card.ui-sortable-helper {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.oliver-pos-section-card.ui-sortable-placeholder {
	visibility: visible !important;
	background: #f0f0f1;
	border: 2px dashed #c3c4c7;
	height: 44px;
}

.oliver-pos-section-card-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 11px 14px;
	cursor: pointer;
	user-select: none;
}

.oliver-pos-section-drag {
	cursor: grab;
	color: #999;
	font-size: 18px;
}

.oliver-pos-section-drag:active {
	cursor: grabbing;
}

/* Section type icon in header */
.oliver-pos-section-icon {
	font-size: 16px;
	width: 16px;
	height: 16px;
	color: #999;
	flex-shrink: 0;
}

.oliver-pos-section-title {
	flex: 1;
	font-weight: 600;
	font-size: 13px;
	color: #1d2327;
}

/* Left border accent on expanded cards */
.oliver-pos-section-card.is-expanded {
	border-left: 3px solid var(--oliver-primary, #1ba2a6);
}

.oliver-pos-section-card[data-disabled="true"] .oliver-pos-section-title {
	color: #999;
	text-decoration: line-through;
}

.oliver-pos-section-toggle {
	cursor: pointer;
}

/* Delete icon — visible on hover */
.oliver-pos-section-remove-icon {
	background: none;
	border: none;
	cursor: pointer;
	color: #d63638;
	padding: 0;
	font-size: 16px;
	width: 20px;
	height: 20px;
	opacity: 0;
	transition: opacity 0.15s;
}

.oliver-pos-section-card:hover .oliver-pos-section-remove-icon {
	opacity: 0.6;
}

.oliver-pos-section-remove-icon:hover {
	opacity: 1 !important;
}

.oliver-pos-section-expand {
	background: none;
	border: none;
	cursor: pointer;
	color: #787c82;
	padding: 0;
	font-size: 20px;
	transition: transform 0.2s;
}

.oliver-pos-section-card.is-expanded .oliver-pos-section-expand {
	transform: rotate(180deg);
}

.oliver-pos-section-card-body {
	padding: 12px 16px 16px 40px;
	border-top: 1px solid #f0f0f1;
}

/* --------------------------------------------------------
   Section field rows
   -------------------------------------------------------- */
.oliver-pos-field-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 4px 0;
}

.oliver-pos-field-row > label {
	min-width: 110px;
	flex-shrink: 0;
	font-size: 12.5px;
	color: #50575e;
}

.oliver-pos-field-row > label strong {
	font-weight: 500;
}

.oliver-pos-field-row .regular-text {
	max-width: 260px;
}

.oliver-pos-field-row select {
	min-width: 120px;
}

/* --------------------------------------------------------
   Two-column checkbox grid
   -------------------------------------------------------- */
.oliver-pos-checkbox-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 2px 16px;
	margin-bottom: 6px;
}

.oliver-pos-field-checkbox {
	padding: 3px 0;
}

.oliver-pos-field-checkbox label {
	display: flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	min-width: auto;
	font-size: 12.5px;
}

/* (Remove button moved to header trash icon) */

/* --------------------------------------------------------
   Alignment icon button group
   -------------------------------------------------------- */
.oliver-pos-align-row {
	gap: 8px;
}

.oliver-pos-align-group {
	display: inline-flex;
	border: 1px solid #c3c4c7;
	border-radius: 6px;
	overflow: hidden;
}

.oliver-pos-align-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 30px;
	background: #fff;
	border: none;
	border-right: 1px solid #c3c4c7;
	cursor: pointer;
	padding: 0;
	color: #787c82;
	transition: background 0.12s, color 0.12s;
}

.oliver-pos-align-btn:last-child {
	border-right: none;
}

.oliver-pos-align-btn:hover {
	background: #f0f0f1;
	color: #1d2327;
}

.oliver-pos-align-btn.is-active {
	background: var(--oliver-primary, #1ba2a6);
	color: #fff;
}

.oliver-pos-align-btn .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

/* --------------------------------------------------------
   Logo section — compact layout
   -------------------------------------------------------- */
.oliver-pos-logo-compact {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.oliver-pos-logo-preview-area {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 64px;
}

.oliver-pos-logo-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	color: #999;
	font-size: 12px;
	padding: 12px;
	border: 1px dashed #ccc;
	border-radius: 6px;
	width: 100%;
	text-align: center;
}

.oliver-pos-logo-placeholder .dashicons {
	font-size: 28px;
	width: 28px;
	height: 28px;
	color: #bbb;
}

.oliver-pos-logo-actions {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

.oliver-pos-logo-actions .button {
	font-size: 12px;
	padding: 2px 10px;
	min-height: 28px;
}

.oliver-pos-logo-size-row {
	align-items: center;
	gap: 8px;
}

.oliver-pos-logo-slider {
	flex: 1;
	max-width: 180px;
	accent-color: var(--oliver-primary, #1ba2a6);
}

.oliver-pos-slider-value {
	font-size: 12px;
	color: #666;
	min-width: 36px;
	text-align: right;
}

/* --------------------------------------------------------
   Media picker (general / legacy)
   -------------------------------------------------------- */
.oliver-pos-media-field {
	align-items: flex-start;
}

.oliver-pos-media-picker {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.oliver-pos-media-preview {
	max-width: 200px;
	background: #f9f9f9;
	border: 1px solid #ddd;
	border-radius: 4px;
	padding: 8px;
}

.oliver-pos-media-preview img {
	display: block;
	max-width: 100%;
	height: auto;
}

.oliver-pos-media-buttons {
	display: flex;
	gap: 8px;
}

.oliver-pos-media-remove {
	color: #d63638;
	border-color: #d63638;
}

.oliver-pos-media-remove:hover {
	background: #d63638;
	color: #fff;
	border-color: #d63638;
}

/* --------------------------------------------------------
   Add section bar
   -------------------------------------------------------- */
.oliver-pos-add-section {
	display: flex;
	gap: 8px;
	margin-bottom: 24px;
	align-items: center;
}

.oliver-pos-add-section select {
	min-width: 180px;
}

/* --------------------------------------------------------
   Global styling card
   -------------------------------------------------------- */
.oliver-pos-global-styling,
.oliver-pos-email-settings {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 16px;
	margin-bottom: 16px;
}

.oliver-pos-global-styling h3,
.oliver-pos-email-settings h3 {
	margin-top: 0;
	margin-bottom: 12px;
}

/* --------------------------------------------------------
   Social media section
   -------------------------------------------------------- */
.oliver-pos-social-row {
	display: flex;
	gap: 8px;
	align-items: center;
	margin-bottom: 8px;
}

.oliver-pos-social-row select {
	min-width: 120px;
}

.oliver-pos-social-remove {
	color: #d63638;
	min-width: 32px;
}

.oliver-pos-social-add {
	margin-top: 4px;
}

/* --------------------------------------------------------
   Actions bar
   -------------------------------------------------------- */
.oliver-pos-receipt-actions {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-top: 16px;
	margin-bottom: 32px;
}

.oliver-pos-save-status {
	font-size: 13px;
	font-weight: 600;
}

.oliver-pos-save-status.is-success {
	color: #00a32a;
}

.oliver-pos-save-status.is-error {
	color: #d63638;
}

/* --------------------------------------------------------
   Preview panel — thermal receipt paper
   -------------------------------------------------------- */
.oliver-pos-receipt-preview-controls {
	margin-bottom: 8px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.oliver-pos-receipt-preview-controls h3 {
	margin: 0;
}

.oliver-pos-preview-badge {
	display: inline-block;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #fff;
	background: var(--oliver-primary, #1ba2a6);
	border-radius: 10px;
	padding: 2px 8px;
	line-height: 1.4;
}

.oliver-pos-receipt-preview {
	background: #e8e8e8;
	border-radius: 4px;
	padding: 16px;
	display: flex;
	justify-content: center;
}

.oliver-pos-receipt-paper {
	background: #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
	padding: 16px 12px 20px;
	font-family: "Courier New", Courier, monospace;
	font-size: 12px;
	line-height: 1.5;
	color: #000;
	max-width: 100%;
	word-break: break-word;
	position: relative;
}

.oliver-pos-receipt-paper::after {
	content: "";
	position: absolute;
	bottom: -6px;
	left: 0;
	right: 0;
	height: 6px;
	background: linear-gradient(135deg, #fff 33.33%, transparent 33.33%) 0 0,
		linear-gradient(225deg, #fff 33.33%, transparent 33.33%) 0 0;
	background-size: 8px 6px;
	background-repeat: repeat-x;
}

.oliver-pos-receipt-preview[data-width="80mm"] .oliver-pos-receipt-paper {
	width: 302px;
}

.oliver-pos-receipt-preview[data-width="58mm"] .oliver-pos-receipt-paper {
	width: 219px;
}

/* Preview typography */
.receipt-section {
	margin-bottom: 6px;
}

.receipt-section.align-left {
	text-align: left;
}

.receipt-section.align-center {
	text-align: center;
}

.receipt-section.align-right {
	text-align: right;
}

.receipt-section .receipt-logo img {
	max-width: 60%;
	height: auto;
}

.receipt-section .receipt-separator {
	overflow: hidden;
	white-space: nowrap;
	color: #555;
}

.receipt-section .receipt-text-small {
	font-size: 10px;
}

.receipt-section .receipt-text-normal {
	font-size: 12px;
}

.receipt-section .receipt-text-large {
	font-size: 16px;
}

.receipt-section .receipt-text-extra_large {
	font-size: 20px;
}

.receipt-section .receipt-bold {
	font-weight: bold;
}

.receipt-line-item {
	display: flex;
	justify-content: space-between;
	gap: 8px;
}

.receipt-line-item .item-name {
	flex: 1;
}

.receipt-modifier {
	padding-left: 16px;
	font-size: 11px;
	color: #444;
}

.receipt-totals-row {
	display: flex;
	justify-content: space-between;
}

.receipt-totals-row.is-total {
	font-weight: bold;
	border-top: 1px solid #000;
	padding-top: 4px;
	margin-top: 4px;
}

.receipt-barcode-placeholder {
	text-align: center;
	border: 1px dashed #999;
	padding: 8px;
	font-size: 10px;
	color: #666;
	margin: 4px 0;
}

/* Preview font-family overrides */
.oliver-pos-receipt-paper.font-default {
	font-family: "Courier New", Courier, monospace;
}

.oliver-pos-receipt-paper.font-monospace {
	font-family: "Courier New", Courier, monospace;
}

.oliver-pos-receipt-paper.font-sans-serif {
	font-family: Arial, Helvetica, sans-serif;
}

/* Preview spacing */
.oliver-pos-receipt-paper.spacing-compact .receipt-section {
	margin-bottom: 2px;
}

.oliver-pos-receipt-paper.spacing-normal .receipt-section {
	margin-bottom: 6px;
}

.oliver-pos-receipt-paper.spacing-comfortable .receipt-section {
	margin-bottom: 10px;
}

/* Receipt type tabs */
.oliver-pos-receipt-type-tabs {
	margin-bottom: 0;
}

/* ================================================================
   Receipt Builder — Oliver Design System Polish
   Inherits tokens from .oliver-pos-wrap in admin.css
   ================================================================ */

.oliver-pos-wrap .oliver-pos-receipt-template-header {
	border-color: var(--oliver-outline-variant);
	border-radius: var(--oliver-card-radius);
	box-shadow: var(--oliver-card-shadow);
}

.oliver-pos-wrap .oliver-pos-section-card {
	border-color: var(--oliver-outline-variant);
	border-radius: var(--oliver-card-radius);
}

.oliver-pos-wrap .oliver-pos-section-card.ui-sortable-helper {
	box-shadow: 0 4px 16px rgba(15, 35, 43, 0.12);
}

.oliver-pos-wrap .oliver-pos-section-card.ui-sortable-placeholder {
	background: var(--oliver-surface-container-low);
	border-color: var(--oliver-outline-variant);
}

.oliver-pos-wrap .oliver-pos-section-card-header {
	padding: 12px 16px;
}

.oliver-pos-wrap .oliver-pos-section-title {
	color: var(--oliver-on-surface);
}

.oliver-pos-wrap .oliver-pos-section-card-body {
	border-top-color: var(--oliver-surface-container-high);
}

.oliver-pos-wrap .oliver-pos-section-drag {
	color: var(--oliver-outline);
}

.oliver-pos-wrap .oliver-pos-section-expand {
	color: var(--oliver-outline);
}

.oliver-pos-wrap .oliver-pos-global-styling,
.oliver-pos-wrap .oliver-pos-email-settings {
	border-color: var(--oliver-outline-variant);
	border-radius: var(--oliver-card-radius);
	box-shadow: var(--oliver-card-shadow);
}

.oliver-pos-wrap .oliver-pos-global-styling h3,
.oliver-pos-wrap .oliver-pos-email-settings h3 {
	color: var(--oliver-on-surface);
}

.oliver-pos-wrap .oliver-pos-receipt-preview {
	background: var(--oliver-surface-container-high);
	border-radius: var(--oliver-card-radius);
}

.oliver-pos-wrap .oliver-pos-field-row > label {
	color: var(--oliver-on-surface-variant);
}

.oliver-pos-wrap .oliver-pos-section-remove-icon {
	color: var(--oliver-error);
}

.oliver-pos-wrap .oliver-pos-section-icon {
	color: var(--oliver-outline);
}

.oliver-pos-wrap .oliver-pos-section-card.is-expanded {
	border-left-color: var(--oliver-primary);
}

.oliver-pos-wrap .oliver-pos-align-group {
	border-color: var(--oliver-outline-variant);
}

.oliver-pos-wrap .oliver-pos-align-btn {
	border-color: var(--oliver-outline-variant);
}

.oliver-pos-wrap .oliver-pos-align-btn.is-active {
	background: var(--oliver-primary);
}

.oliver-pos-wrap .oliver-pos-preview-badge {
	background: var(--oliver-primary);
}

/* Section toggle as mini switch */
.oliver-pos-wrap .oliver-pos-section-toggle input[type="checkbox"] {
	-webkit-appearance: none;
	appearance: none;
	width: 32px;
	height: 18px;
	background: var(--oliver-outline-variant);
	border-radius: 9px;
	position: relative;
	cursor: pointer;
	transition: background 0.15s ease;
	margin: 0;
	border: none;
}

.oliver-pos-wrap .oliver-pos-section-toggle input[type="checkbox"]::before {
	display: none;
}

.oliver-pos-wrap .oliver-pos-section-toggle input[type="checkbox"]::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 14px;
	height: 14px;
	background: #fff;
	border-radius: 50%;
	transition: transform 0.15s ease;
	box-shadow: 0 1px 2px rgba(15, 35, 43, 0.15);
}

.oliver-pos-wrap .oliver-pos-section-toggle input[type="checkbox"]:checked {
	background: var(--oliver-primary);
}

.oliver-pos-wrap .oliver-pos-section-toggle input[type="checkbox"]:checked::after {
	transform: translateX(14px);
}

/* Receipt builder inputs */
.oliver-pos-wrap .oliver-pos-receipt-settings-panel input[type="text"],
.oliver-pos-wrap .oliver-pos-receipt-settings-panel select {
	border: 1px solid var(--oliver-outline-variant);
	border-radius: 6px;
	padding: 7px 12px;
	color: var(--oliver-on-surface);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.oliver-pos-wrap .oliver-pos-receipt-settings-panel input[type="text"]:focus,
.oliver-pos-wrap .oliver-pos-receipt-settings-panel select:focus {
	border-color: var(--oliver-primary);
	box-shadow: 0 0 0 3px var(--oliver-primary-lightest);
	outline: none;
}
