/* ===== Card Setting Page (card-setting.php) ===== */
.card-type-selector {
	display: flex;
	gap: 15px;
}

.type-option input {
	display: none;
}

.type-option .option-box {
	width: 100px;
	height: 80px;
	border: 1px solid var(--st-border-lighter);
	border-radius: var(--st-radius-xl);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	background: var(--st-bg-primary);
	color: var(--st-text-lightest);
	transition: all 0.2s;
}

.type-option .option-box i {
	font-size: 24px;
	margin-bottom: 5px;
}

.type-option input:checked+.option-box {
	border-color: var(--st-primary);
	color: var(--st-primary);
	background: var(--st-primary-lighter);
	font-weight: bold;
}

.card-editor-container {
	display: flex;
	gap: 20px;
	overflow-x: auto;
	padding-bottom: 20px;
	align-items: flex-start;
	background: #dfe6ed;
	padding: 30px;
	border-radius: 10px;
}

.card-preview-area {
	display: flex;
	gap: 20px;
}

.card-item {
	width: 280px;
	min-height: 150px;
	background: var(--st-bg-primary);
	border-radius: var(--st-radius-xl);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	position: relative;
	padding: 20px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
}

.card-delete-btn {
	position: absolute;
	top: -10px;
	right: -10px;
	width: 24px;
	height: 24px;
	background: var(--st-danger);
	color: var(--st-text-inverse);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	font-size: 14px;
	display: none;
}

.card-item:hover .card-delete-btn {
	display: flex;
}

.card-text-content {
	cursor: pointer;
	min-height: 60px;
	border: 1px dashed transparent;
	padding: 5px;
}

.card-text-content:hover {
	border-color: var(--st-primary);
	background: #f9fcff;
}

.card-image-content {
	cursor: pointer;
	min-height: 120px;
	background: var(--st-bg-secondary);
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--st-radius-xl);
	margin-bottom: 10px;
	position: relative;
	overflow: hidden;
}

.card-image-content img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.card-image-placeholder {
	color: #aaa;
	font-size: 14px;
}

.card-item-title {
	font-weight: bold;
	margin-bottom: 4px;
	font-size: 16px;
}

.card-item-desc {
	white-space: pre-line;
	color: var(--st-text-light-gray);
	font-size: 13px;
}

.card-list-items {
	margin-top: 10px;
}

.card-list-row {
	display: flex;
	gap: 10px;
	padding: 10px 0;
	border-bottom: 1px solid var(--st-border-light);
	cursor: pointer;
}

.card-list-row:last-child {
	border-bottom: none;
}

.card-list-thumb {
	width: 40px;
	height: 40px;
	background: var(--st-border-light);
	border-radius: var(--st-radius-xs);
	flex-shrink: 0;
}

.card-list-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: var(--st-radius-xs);
}

.card-list-info {
	flex: 1;
}

.card-list-title {
	font-size: 14px;
	font-weight: bold;
}

.card-list-desc {
	font-size: 12px;
	color: #888;
}

.add-list-item-btn {
	text-align: center;
	padding: 8px;
	color: var(--st-primary);
	cursor: pointer;
	font-size: 13px;
	font-weight: 500;
}

.card-buttons-area {
	margin-top: 15px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.card-btn {
	width: 100%;
	padding: 10px;
	border: 1px solid #e1e1e1;
	border-radius: var(--st-radius-xl);
	background: #f9f9f9;
	color: var(--st-text-dark);
	text-align: center;
	font-size: 14px;
	cursor: pointer;
	position: relative;
	box-sizing: border-box;
}

.card-btn.add-action {
	color: var(--st-primary);
	border: 1px dashed var(--st-primary);
	background: var(--st-bg-primary);
}

.card-btn:hover {
	background: #f0f0f0;
}

.card-btn .remove-btn-icon {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--st-danger);
	font-size: 16px;
	display: none;
}

.card-btn:hover .remove-btn-icon {
	display: block;
}

.add-card-placeholder {
	width: 280px;
	height: 250px;
	border: 2px dashed #ccc;
	border-radius: var(--st-radius-xl);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	background: rgba(255, 255, 255, 0.4);
	transition: all 0.2s;
}

.add-card-placeholder:hover {
	border-color: var(--st-primary);
	background: rgba(255, 255, 255, 0.6);
}

.add-card-placeholder i {
	font-size: 40px;
	color: #888;
}

/* Card Setting Popup */
.sidetalk-popup-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.3);
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.sidetalk-popup {
	background: var(--st-bg-primary);
	width: 450px;
	border-radius: var(--st-radius-xl);
	box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
	overflow: hidden;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
}

.popup-header {
	padding: 15px 20px;
	border-bottom: 1px solid var(--st-border-light);
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.popup-header h4 {
	margin: 0;
	font-size: 16px;
	font-weight: bold;
}

.close-btn {
	background: none;
	border: none;
	font-size: 20px;
	cursor: pointer;
	color: var(--st-text-lightest);
}

.popup-body {
	padding: 20px;
	overflow: auto;
}

.popup-footer {
	padding: 15px 20px;
	border-top: 1px solid var(--st-border-light);
	text-align: right;
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}

#editPopup .sidetalk-popup.crop-dialog {
	width: min(560px, 95vw);
}

.popup-input-row {
	margin-bottom: 15px;
}

.popup-label {
	display: block;
	margin-bottom: 5px;
	font-size: 13px;
	font-weight: bold;
	color: var(--st-text-gray);
}

.popup-label span {
	float: right;
	font-weight: normal;
	color: var(--st-text-lightest);
	font-size: 12px;
}

.popup-label .required {
	color: var(--st-danger);
	margin-left: 2px;
}

.popup-text-input,
.popup-textarea {
	width: 100%;
	padding: 10px;
	border: 1px solid var(--st-border-lighter);
	border-radius: 6px;
	font-size: 14px;
	box-sizing: border-box;
}

.popup-textarea {
	height: 100px;
	resize: none;
}

.popup-input-group {
	display: flex;
	gap: 10px;
}

.popup-select {
	padding: 10px;
	border: 1px solid var(--st-border-lighter);
	border-radius: 6px;
	background: #f8f9fa;
	min-width: 100px;
}

.popup-help {
	font-size: 12px;
	color: #888;
	margin-top: 6px;
	line-height: 1.4;
}

/* Card Setting Image Upload */
.upload-preview-wrap {
	width: 100%;
	border-radius: 6px;
	overflow: hidden;
	background: var(--st-bg-secondary);
	margin-top: 10px;
	position: relative;
}

.upload-preview-wrap.aspect-2-1 {
	aspect-ratio: 2 / 1;
}

.upload-preview-wrap.aspect-1-1 {
	aspect-ratio: 1 / 1;
}

.upload-preview-wrap.crop-mode {
	aspect-ratio: initial !important;
}

.upload-preview-wrap img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

#pop_cropCanvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
	cursor: grab;
	touch-action: none;
}

#pop_cropCanvas:active {
	cursor: grabbing;
}

#pop_cropOverlay {
	position: absolute;
	inset: 0;
	display: none;
}

.pop-crop-shade {
	position: absolute;
	background: rgba(0, 0, 0, 0.38);
	pointer-events: none;
}

#pop_cropBox {
	position: absolute;
	border: 2px solid rgba(255, 255, 255, 0.95);
	border-radius: 10px;
	box-sizing: border-box;
	background: rgba(255, 255, 255, 0.00);
	touch-action: none;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25) inset;
}

.pop-crop-handle {
	position: absolute;
	width: 16px;
	height: 16px;
	background: rgba(255, 255, 255, 0.98);
	border-radius: 50%;
	border: 2px solid rgba(0, 0, 0, 0.25);
	box-sizing: border-box;
	touch-action: none;
}

.pop-crop-handle[data-h="nw"] {
	left: -8px;
	top: -8px;
	cursor: nwse-resize;
}

.pop-crop-handle[data-h="ne"] {
	right: -8px;
	top: -8px;
	cursor: nesw-resize;
}

.pop-crop-handle[data-h="sw"] {
	left: -8px;
	bottom: -8px;
	cursor: nesw-resize;
}

.pop-crop-handle[data-h="se"] {
	right: -8px;
	bottom: -8px;
	cursor: nwse-resize;
}

.media-upload-area {
	border: 1px dashed var(--st-border-lighter);
	border-radius: 6px;
	padding: 10px;
	text-align: center;
	background: #fcfcfc;
	margin-top: 5px;
}

.upload-preview {
	max-height: 150px;
	max-width: 100%;
	margin-top: 10px;
	border-radius: var(--st-radius-xs);
	display: none;
}
