/**
 * WP Lu Ban Ruler - Stylesheet
 * Layout mô phỏng trang đối thủ: https://wordpress.dabilab.com/thuoc-lo-ban/
 */

/* ==================== CSS Variables ==================== */
:root {
	/* Colors - Override từ settings */
	--luban-primary: #8b5cf6;
	--luban-good: #e74c3c;
	--luban-bad: #34495e;
	--luban-bg: #f4f5fb;
	--luban-border: #e5e7eb;
	--luban-text: #111827;
	--luban-muted: #6b7280;
	--luban-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.1);

	/* Typography */
	--luban-font-family: -apple-system, BlinkMacSystemFont, 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ==================== PAGE WRAPPER ==================== */
.wp-luban-ruler-container {
	padding: 0 16px;
	font-family: var(--luban-font-family);
	color: var(--luban-text);
}

.nkd-loban-ruler-container {
	background: #ffffff;
	border-radius: 18px;
	box-shadow: var(--luban-shadow);
	position: relative;
	overflow: hidden;
	padding: 0 10px 10px;
}

/* ==================== HEADER ==================== */
/* .nkd-loban-ruler-header-box {
	position: sticky;
	top: 0;
	background: linear-gradient(135deg, #111827 0%, #020617 100%);
	margin: -24px -20px 24px;
	padding: 20px 20px 18px;
	box-shadow: 0 1px 0 rgba(148, 163, 184, 0.25);
	z-index: 5;
} */

.nkd-loban-ruler-app-title {
	font-size: 22px;
	line-height: 1.3;
	color: #1f2937;
	margin: 0 0 12px;
}

.nkd-loban-ruler-text-center {
	text-align: center;
}

.nkd-loban-ruler-uppercase {
	text-transform: uppercase;
}

.nkd-loban-ruler-font-bold {
	font-weight: 700;
}

.nkd-loban-ruler-flex {
	display: flex;
}

.nkd-loban-ruler-flex-col {
	flex-direction: column;
}

.nkd-loban-ruler-items-center {
	align-items: center;
}

.nkd-loban-ruler-justify-center {
	justify-content: center;
	gap: 10px;
}
.nkd-loban-ruler-input-group {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}
.nkd-loban-ruler-header-box .nkd-loban-ruler-main-input {
	width: 200px;
    font-size: 2.25rem;
    font-weight: 700;
    text-align: center;
    color: #ea580c;
    border: 2px solid #fbbf24;
    border-radius: 0.5rem;
    padding: 0.5rem;
    outline: none;
	height: 50px;
    transition: all 0.2s;

    margin-bottom: 0;
}
.nkd-loban-ruler-main-input::-webkit-inner-spin-button,
.nkd-loban-ruler-main-input::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.nkd-loban-ruler-unit-label {
    font-size: 1.5rem;
    font-weight: 700;
    color: #6b7280;
    line-height: 1;
}

.nkd-loban-ruler-nav-buttons {
	margin-top: 10px;
	display: inline-flex;
	gap: 4px;
}

.nkd-loban-ruler-nav-btn {
	border-radius: 999px;
	border: 1px solid rgba(148, 163, 184, 0.6);
	padding: 4px 10px;
	background: rgba(15, 23, 42, 0.8);
	color: #e5e7eb;
	font-size: 12px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.15s ease-out;
}

.nkd-loban-ruler-nav-btn:hover {
	background: #0ea5e9;
	border-color: #0ea5e9;
	color: #0b1120;
}

.nkd-loban-ruler-nav-btn:active {
	transform: translateY(1px) scale(0.98);
}

.nkd-loban-ruler-instruction-text {
	margin: 14px auto 0;
	max-width: 480px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	color: var(--luban-text);
	font-size: 13px;
}

.nkd-loban-ruler-instruction-icon {
	width: 18px;
	height: 18px;
	border-radius: 999px;
	background: rgba(15, 23, 42, 0.9);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: 700;
	color: #0ea5e9;
	border: 1px solid rgba(148, 163, 184, 0.6);
}

/* ==================== ACTION BAR ==================== */
.nkd-loban-ruler-action-buttons-bar {
	margin: 20px 0 16px;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: flex-start;
}

.nkd-loban-ruler-action-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border-radius: 999px;
	border: 1px solid var(--luban-border);
	background: #f9fafb;
	color: #111827;
	font-size: 13px;
	padding: 6px 12px;
	cursor: not-allowed; /* tạm thời disable chức năng nâng cao */
	opacity: 0.7;
}

.nkd-loban-ruler-bookmarks-toggle {
	background: #0f172a;
	color: #e5e7eb;
	border-color: #1f2937;
}

/* ==================== ALERT ==================== */
.nkd-loban-ruler-alert {
	margin: 4px 0 18px;
	padding: 10px 12px;
	border-radius: 10px;
	font-size: 13px;
	display: flex;
	align-items: center;
	gap: 6px;
}

.nkd-loban-ruler-alert-info {
	background: #ecfeff;
	color: #0f766e;
	border: 1px solid #99f6e4;
}

/* ==================== RULER AREA ==================== */
.nkd-loban-ruler-ruler-container {
	margin-top: 10px;
	padding: 16px 14px 14px;
	border-radius: 14px;
	background: radial-gradient(circle at top left, #eff6ff 0, #f9fafb 40%, #f3f4f6 100%);
	border: 1px solid #e5e7eb;
}

.nkd-loban-ruler-center-line {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 2px;
	background: rgba(234, 88, 12, 0.4);
	transform: translateX(-50%);
	z-index: 8;
}

.nkd-loban-ruler-ruler-label {
	font-size: 12px;
	font-weight: 600;
	margin-bottom: 4px;
}

.nkd-loban-ruler-label-blue {
	color: #1d4ed8;
}

.nkd-loban-ruler-label-orange {
	color: #ea580c;
}

.nkd-loban-ruler-label-gray {
	color: #4b5563;
	margin-bottom: 10px;
}

/* Giữ nguyên cấu trúc canvas cũ nhưng style theo layout mới */
.luban-ruler-wrapper {
	margin-top: 6px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	position: relative; /* để vạch giữa bám theo toàn bộ khối thước */
}

.luban-ruler-row {
	display: grid;
	gap: 10px;
	align-items: center;
	padding: 10px;
	background: #ffffff;
	border-radius: 10px;
	border: 1px solid #e5e7eb;
	overflow: hidden;
}

.luban-ruler-label {
	font-weight: 600;
	color: #111827;
	font-size: 12px;
	text-align: center;
}

.luban-ruler-canvas-wrapper {
	position: relative;
	overflow-x: auto;
	overflow-y: hidden;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	background: #ffffff;
	cursor: grab;
	scrollbar-width: thin;
	scrollbar-color: #0ea5e9 #e5e7eb;
	min-width: 100%;
	width: 100%;
}

.luban-ruler-canvas-wrapper::-webkit-scrollbar {
	height: 8px;
}

.luban-ruler-canvas-wrapper::-webkit-scrollbar-track {
	background: #e5e7eb;
}

.luban-ruler-canvas-wrapper::-webkit-scrollbar-thumb {
	background: #0ea5e9;
	border-radius: 999px;
}

.luban-ruler-canvas-wrapper.grabbing {
	cursor: grabbing;
}

.luban-ruler-canvas {
	display: block;
	height: 80px;
}

.luban-ruler-marker {
	position: absolute;
	top: 0;
	left: 50%;
	width: 2px;
	height: 100%;
	background: #f97316;
	pointer-events: none;
	z-index: 10;
	transform: translateX(-50%);
	box-shadow: 0 0 6px rgba(248, 113, 22, 0.5);
}

.luban-ruler-marker::before {
	content: '';
	position: absolute;
	top: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 0;
	height: 0;
	border-left: 6px solid transparent;
	border-right: 6px solid transparent;
	border-top: 10px solid #f97316;
}

/* ==================== RESULT CARDS (3 THƯỚC) ==================== */
.nkd-loban-ruler-results-box {
	margin-top: 18px;
}

.nkd-loban-ruler-result-item {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 10px 10px 8px;
	border-radius: 12px;
	background: #ffffff;
	border: 1px solid #e5e7eb;
	margin-bottom: 8px;
}

.nkd-loban-ruler-result-header {
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 2px;
}

.nkd-loban-ruler-text-good {
	color: #15803d;
}

.nkd-loban-ruler-text-bad {
	color: #b91c1c;
}

.nkd-loban-ruler-result-type-label {
	font-weight: 500;
	color: #4b5563;
}

.nkd-loban-ruler-result-detail {
	margin: 0;
	font-size: 13px;
	color: #111827;
}

.nkd-loban-ruler-highlight-val {
	font-weight: 700;
}

.nkd-loban-ruler-badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	font-size: 11px;
	border-radius: 999px;
	font-weight: 600;
}

.nkd-loban-ruler-badge-good {
	background: #dcfce7;
	color: #15803d;
}

.nkd-loban-ruler-badge-bad {
	background: #fee2e2;
	color: #b91c1c;
}

.nkd-loban-ruler-desc-box {
	margin-top: 4px;
	font-size: 12px;
	color: #4b5563;
}

.nkd-loban-ruler-divider {
	height: 1px;
	background: #e5e7eb;
	margin: 6px 0;
}

/* ==================== GUIDE + TABLE ==================== */
.nkd-loban-ruler-guide-and-table {
	margin-top: 22px;
	
	gap: 18px;
	align-items: flex-start;
}

.nkd-loban-ruler-guide-box {
	border-radius: 14px;
	padding: 14px 14px 12px;
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	margin-bottom: 16px;
}

.nkd-loban-ruler-guide-title {
	margin: 0 0 10px;
	font-size: 15px;
	font-weight: 700;
	color: #111827;
}

.nkd-loban-ruler-guide-box p {
	margin: 0 0 8px;
	font-size: 13px;
	color: #374151;
	line-height: 1.5;
}

.nkd-loban-ruler-guide-list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 13px;
	color: #111827;
}

.nkd-loban-ruler-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 999px;
	margin-right: 6px;
}

.nkd-loban-ruler-dot-blue {
	background: #2563eb;
}

.nkd-loban-ruler-dot-orange {
	background: #f97316;
}

.nkd-loban-ruler-dot-gray {
	background: #6b7280;
}

.nkd-loban-ruler-table-container {
	border-radius: 14px;
	padding: 14px 14px 10px;
	background: #ffffff;
	border: 1px solid #e5e7eb;
}

.nkd-loban-ruler-table-head-section {
	margin-bottom: 8px;
}

.nkd-loban-ruler-table-title {
	margin: 0 0 4px;
	font-size: 15px;
	font-weight: 700;
	color: #111827;
	display: flex;
	align-items: center;
	gap: 6px;
}

.nkd-loban-ruler-table-subtitle {
	margin: 0;
	font-size: 12px;
	color: #6b7280;
}

/* Tái sử dụng bảng chi tiết cũ */
.luban-result-section {
	margin-top: 4px;
	padding: 6px 0 0;
	background: transparent;
	border-radius: 0;
	border: none;
}

.luban-result-table-wrapper {
	overflow-x: auto;
}

.luban-result-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 12px;
	background: #ffffff;
	border-radius: 10px;
	overflow: hidden;
}

.luban-result-table thead {
	background: linear-gradient(135deg, #0f172a 0%, #020617 100%);
	color: #f9fafb;
}

.luban-result-table th {
	padding: 8px 6px;
	text-align: center;
	font-weight: 600;
	font-size: 14px;
	text-transform: uppercase;
	white-space: nowrap;
}

.luban-result-table tbody tr {
	border-bottom: 1px solid #e5e7eb;
	transition: background 0.15s ease;
}

.luban-result-table tbody tr:hover {
	background: #f9fafb;
}

.luban-result-table tbody tr.current-row {
	background: #fef3c7 !important;
	font-weight: 600;
}

.luban-result-table td {
	padding: 7px 6px;
	text-align: center;
	color: #111827;
	font-size: 14px;
}

.luban-table-empty {
	color: #9ca3af;
	font-style: italic;
	padding: 20px !important;
	text-align: center;
}

.good-cell {
	color: var(--luban-good);
	font-weight: 700;
}

.bad-cell {
	color: var(--luban-bad);
	font-weight: 600;
}

.meaning-good {
	color: var(--luban-good);
	font-size: 11px;
}

.meaning-bad {
	color: var(--luban-bad);
	font-size: 11px;
}

.rating-good {
	background: #dcfce7;
	color: #166534;
	font-weight: 700;
	padding: 3px 8px;
	border-radius: 999px;
	display: inline-block;
	font-size: 10px;
}

.rating-bad {
	background: #fee2e2;
	color: #b91c1c;
	font-weight: 600;
	padding: 3px 8px;
	border-radius: 999px;
	display: inline-block;
	font-size: 10px;
}

/* ==================== BOTTOM NUMBER ==================== */
.nkd-loban-ruler-bottom-number {
	margin-top: 20px;
	text-align: center;
}

.luban-number {
	display: inline-block;
	font-size: 40px;
	font-weight: 700;
	color: #0f172a;
	line-height: 1;
	font-family: 'SF Mono', ui-monospace, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
}

.luban-unit-display {
	display: inline-block;
	font-size: 16px;
	font-weight: 600;
	color: #6b7280;
	margin-left: 6px;
	vertical-align: baseline;
}

/* ==================== RESPONSIVE ==================== */
@media screen and (max-width: 1024px) {
	.nkd-loban-ruler-guide-and-table {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media screen and (max-width: 768px) {
	.wp-luban-ruler-container {
		margin-top: 24px;
	}

	.nkd-loban-ruler-container {
		padding: 18px 14px 24px;
	}

	.nkd-loban-ruler-header-box {
		margin: -18px -14px 18px;
		padding-inline: 14px;
	}

	.nkd-loban-ruler-app-title {
		font-size: 18px;
	}

	.nkd-loban-ruler-main-input {
		font-size: 22px;
		width: 110px;
	}

	.luban-ruler-row {
		grid-template-columns: 1fr;
	}

	.luban-ruler-label {
		text-align: left;
		border-right: none;
		border-bottom: 2px solid #0ea5e9;
		padding-bottom: 4px;
	}
}

@media screen and (max-width: 480px) {
	.nkd-loban-ruler-bottom-number .luban-number {
		font-size: 32px;
	}

	.nkd-loban-ruler-nav-buttons {
		flex-wrap: wrap;
		justify-content: center;
	}
}
