/* ============================================================
   Ecohomes Orders — Pesanan Saya
   Reference: 4.Pesanan_Saya.png
   Inherits CSS variables from eh-myaccount.css.
   ============================================================ */

.eh-orders-wrap {
	flex: 1;
	min-width: 0;
	--eh-ink:     #1E293B;
	--eh-muted:   #64748B;
	--eh-line:    #EDF0F4;
	--eh-track:   #EAECF0;
	--eh-tint:    #EAF8F0;
	--eh-card-sh: 0 1px 3px rgba(16,24,40,.06);
	color: var(--eh-ink);
}

/* ── Widen account content area ── */
.woocommerce-account .container:has(.eh-orders-wrap) { width: 100% !important; max-width: 1360px !important; }
.woocommerce-account .dashboard-wrap:has(.eh-orders-wrap) > [class*="col-"]:first-child { flex: 0 0 19%; max-width: 19%; }
.woocommerce-account .dashboard-wrap:has(.eh-orders-wrap) > [class*="col-"]:last-child  { flex: 0 0 81%; max-width: 81%; }

/* ── Buttons ── */
.eh-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	padding: 9px 16px; border-radius: 8px; font-size: .85rem; font-weight: 600;
	text-decoration: none; cursor: pointer; border: 1px solid transparent; line-height: 1.2;
	transition: background .15s, color .15s, border-color .15s;
}
.eh-btn .dashicons { font-size: 16px; width: 16px; height: 16px; }
.eh-btn-primary   { background: var(--eh-green, #2ECC71); color: #fff; border-color: var(--eh-green, #2ECC71); }
.eh-btn-primary:hover { background: var(--eh-green-dark, #27AE60); border-color: var(--eh-green-dark, #27AE60); color: #fff; }
.eh-btn-outline   { background: #fff; color: var(--eh-ink); border-color: #DCE1E8; }
.eh-btn-outline:hover, .eh-btn-outline.eh-btn-active { background: var(--eh-tint); color: var(--eh-green-dark); border-color: var(--eh-green); }
.eh-btn-sm { padding: 7px 14px; font-size: .8rem; }
.eh-btn-xs { padding: 5px 12px; font-size: .75rem; border-radius: 6px; }

/* ── Page header ── */
.eh-orders-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.eh-orders-header .eh-page-title { font-size: 1.5rem; color: var(--eh-ink); margin: 0; }
.eh-page-subtitle { margin: 6px 0 0; color: var(--eh-muted); font-size: .9rem; }
.eh-last-updated  { font-size: .78rem; color: var(--eh-muted); white-space: nowrap; flex-shrink: 0; }

/* ── Stat cards ── */
.eh-orders-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.eh-orders-stats .eh-stat-card {
	position: relative; display: grid;
	grid-template-columns: 44px 1fr;
	grid-template-areas: "icon label" "icon value" "link link";
	column-gap: 12px; row-gap: 2px; text-align: left;
	background: #fff; border: 1px solid var(--eh-line); border-radius: 12px;
	box-shadow: var(--eh-card-sh); padding: 16px;
}
.eh-orders-stats .eh-stat-icon {
	grid-area: icon; width: 44px; height: 44px; border-radius: 11px;
	background: var(--eh-tint); color: var(--eh-green-dark);
	display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.eh-orders-stats .eh-stat-label { grid-area: label; align-self: end; font-size: .8rem; color: var(--eh-muted); margin: 0; }
.eh-orders-stats .eh-stat-value { grid-area: value; align-self: start; font-size: 1.7rem; font-weight: 700; color: var(--eh-ink); line-height: 1.1; }
.eh-stat-link {
	grid-area: link; margin-top: 12px; display: inline-flex; align-items: center; gap: 4px;
	font-size: .8rem; font-weight: 600; color: var(--eh-green-dark); text-decoration: none;
}
.eh-stat-link .dashicons { font-size: 15px; width: 15px; height: 15px; transition: transform .15s; }
.eh-stat-link:hover { color: var(--eh-green); }
.eh-stat-link:hover .dashicons { transform: translateX(3px); }
.eh-stat-card--blue    .eh-stat-icon { background: #E7F1FF; color: #1F6FEB; }
.eh-stat-card--orange  .eh-stat-icon { background: #FFF3E6; color: #E8821A; }
.eh-stat-card--success .eh-stat-icon { background: #E8F8EF; color: #1E9E59; }

/* ── Layout ── */
.eh-orders-layout { display: grid; grid-template-columns: minmax(0,1fr) 240px; gap: 20px; align-items: start; }
.eh-orders-main   { min-width: 0; }

/* ── Toolbar ── */
.eh-orders-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.eh-orders-tabs    { display: flex; flex-wrap: wrap; gap: 6px; }
.eh-orders-tab {
	display: inline-flex; align-items: center; gap: 4px; padding: 7px 14px;
	border-radius: 999px; font-size: .81rem; font-weight: 500; color: var(--eh-muted);
	text-decoration: none; white-space: nowrap; border: 1px solid var(--eh-line); background: #fff;
	transition: all .15s;
}
.eh-orders-tab:hover       { color: var(--eh-green-dark); border-color: var(--eh-green); }
.eh-orders-tab--active     { background: var(--eh-green); color: #fff !important; border-color: var(--eh-green); font-weight: 600; }
.eh-tab-count              { font-size: .76rem; opacity: .85; }

/* ── Filter ── */
.eh-orders-filter          { margin-bottom: 14px; padding: 12px; background: #fff; border: 1px solid var(--eh-line); border-radius: 12px; }
.eh-orders-filter[hidden]  { display: none !important; }
.eh-filter-search          { position: relative; }
.eh-filter-search .dashicons { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #94A3B8; font-size: 18px; }
.eh-search-input {
	width: 100%; height: 38px; padding: 0 12px 0 36px; box-sizing: border-box;
	border: 1px solid #DCE1E8; border-radius: 8px; font-size: .84rem; color: var(--eh-ink); background: #fff;
}
.eh-search-input:focus { outline: none; border-color: var(--eh-green); box-shadow: 0 0 0 3px rgba(46,204,113,.12); }

/* ── Result count ── */
.eh-result-row   { margin-bottom: 10px; }
.eh-result-count { font-size: .82rem; color: var(--eh-muted); }

/* ── Orders table ── */
.eh-orders-table-wrap {
	background: #fff;
	border: 1px solid var(--eh-line);
	border-radius: 12px;
	box-shadow: var(--eh-card-sh);
	overflow-x: auto;
}
.eh-orders-table {
	width: 100%;
	min-width: 660px;
	border-collapse: collapse;
	font-size: .79rem;
}

/* Header row */
.eh-orders-table thead th {
	text-align: left;
	padding: 10px 8px 10px 10px;
	font-size: .67rem;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--eh-muted);
	background: #F8FAFC;
	border-bottom: 1px solid var(--eh-line);
	white-space: nowrap;
}
.eh-orders-table thead th:first-child { padding-left: 14px; border-radius: 12px 0 0 0; }
.eh-orders-table thead th:last-child  { padding-right: 14px; border-radius: 0 12px 0 0; }

/* Body cells */
.eh-orders-table tbody td {
	padding: 12px 8px 12px 10px;
	border-bottom: 1px solid var(--eh-line);
	vertical-align: middle;
}
.eh-orders-table tbody td:first-child { padding-left: 14px; }
.eh-orders-table tbody td:last-child  { padding-right: 14px; }
.eh-orders-table tbody tr:last-child td { border-bottom: none; }
.eh-orders-table tbody tr:hover { background: #FAFBFC; }

/* Column widths — tuned to fit ~700px main column */
.eh-orders-table th:nth-child(1), .eh-orders-table td:nth-child(1) { width: 13%; min-width: 90px;  } /* Pesanan */
.eh-orders-table th:nth-child(2), .eh-orders-table td:nth-child(2) { width: 10%; min-width: 80px;  } /* Waktu */
.eh-orders-table th:nth-child(3), .eh-orders-table td:nth-child(3) { width: 9%;  min-width: 70px;  } /* Tipe */
.eh-orders-table th:nth-child(4), .eh-orders-table td:nth-child(4) { width: 14%; min-width: 100px; } /* Nama Produk */
.eh-orders-table th:nth-child(5), .eh-orders-table td:nth-child(5) { width: 9%;  min-width: 66px;  } /* No. Resi */
.eh-orders-table th:nth-child(6), .eh-orders-table td:nth-child(6) { width: 12%; min-width: 90px;  } /* Metode */
.eh-orders-table th:nth-child(7), .eh-orders-table td:nth-child(7) { width: 10%; min-width: 74px;  } /* Total */
.eh-orders-table th:nth-child(8), .eh-orders-table td:nth-child(8) { width: 9%;  min-width: 66px;  } /* Status */
.eh-orders-table th:nth-child(9), .eh-orders-table td:nth-child(9) { width: 14%; min-width: 110px; } /* Aksi */

/* Product cell (col 1: thumb + order #) */
.eh-prod-cell     { display: flex; align-items: center; gap: 8px; }
.eh-prod-thumb    { width: 40px; height: 40px; border-radius: 7px; object-fit: cover; border: 1px solid var(--eh-line); flex-shrink: 0; }
.eh-prod-id       { min-width: 0; }
.eh-order-number  { display: block; font-weight: 700; color: var(--eh-green-dark); text-decoration: none; font-size: .8rem; white-space: nowrap; }
.eh-order-number:hover { text-decoration: underline; }

/* Generic cell typography */
.eh-cell-val   { display: block; font-size: .79rem; color: var(--eh-ink); font-weight: 500; }
.eh-cell-sub   { display: block; font-size: .71rem; color: var(--eh-muted); margin-top: 2px; }
.eh-cell-muted { color: #B6BECB; }
.eh-prod-name  { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }

/* Total column */
.eh-cell-total { display: block; font-weight: 700; color: var(--eh-green-dark); font-size: .81rem; }

/* Action column — stack two buttons vertically */
.eh-col-actions   { white-space: nowrap; }
.eh-actions-stack { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }

/* Badges */
.eh-orders-table .eh-badge { display: inline-block; white-space: nowrap; }

/* ── Empty state ── */
.eh-orders-empty { padding: 48px 24px; text-align: center; color: var(--eh-muted); }
.eh-orders-empty .dashicons { font-size: 44px; width: 44px; height: 44px; color: #CBD5E1; display: block; margin: 0 auto 12px; }
.eh-orders-empty p { margin: 0; font-size: .9rem; }

/* ── Pagination ── */
.eh-orders-pagination     { margin-top: 20px; }
.eh-orders-pagination ul  { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; justify-content: center; }
.eh-orders-pagination li a,
.eh-orders-pagination li span {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 36px; height: 36px; padding: 0 10px;
	border-radius: 8px; font-size: .83rem; font-weight: 500;
	text-decoration: none; border: 1px solid var(--eh-line);
	color: var(--eh-ink); background: #fff; transition: all .15s;
}
.eh-orders-pagination li a:hover,
.eh-orders-pagination .current span,
.eh-orders-pagination li span.current { background: var(--eh-green); color: #fff; border-color: var(--eh-green); }

/* ── Sidebar ── */
.eh-orders-sidebar { display: flex; flex-direction: column; gap: 16px; }
.eh-side-card  { background: #fff; border: 1px solid var(--eh-line); border-radius: 12px; padding: 16px; box-shadow: var(--eh-card-sh); }
.eh-side-title { font-size: .95rem; font-weight: 700; color: var(--eh-ink); margin: 0 0 14px; }
.eh-side-empty { font-size: .82rem; color: var(--eh-muted); text-align: center; padding: 12px 0; }
.eh-side-foot-link {
	display: inline-flex; align-items: center; gap: 4px; margin-top: 12px;
	font-size: .79rem; font-weight: 600; color: var(--eh-green-dark); text-decoration: none;
}
.eh-side-foot-link .dashicons { font-size: 14px; width: 14px; height: 14px; transition: transform .15s; }
.eh-side-foot-link:hover .dashicons { transform: translateX(3px); }

/* Unpaid orders list */
.eh-unpaid-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.eh-unpaid-item { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; }
.eh-unpaid-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; border: 1px solid var(--eh-line); display: block; }
.eh-unpaid-info  { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.eh-unpaid-name  { font-size: .8rem; font-weight: 600; color: var(--eh-ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eh-unpaid-name:hover { color: var(--eh-green-dark); }
.eh-unpaid-total { font-size: .76rem; font-weight: 600; color: var(--eh-green-dark); }

/* Help list */
.eh-help-intro { font-size: .8rem; color: var(--eh-muted); margin: 0 0 12px; line-height: 1.45; }
.eh-help-list  { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.eh-help-list li { border-top: 1px solid var(--eh-line); }
.eh-help-list li:first-child { border-top: none; }
.eh-help-list a, .eh-help-row-static { display: flex; align-items: center; gap: 12px; padding: 10px 0; text-decoration: none; }
.eh-help-ico { width: 34px; height: 34px; flex-shrink: 0; border-radius: 8px; background: var(--eh-tint); color: var(--eh-green-dark); display: flex; align-items: center; justify-content: center; font-size: 17px; }
.eh-help-text { display: flex; flex-direction: column; min-width: 0; }
.eh-help-text strong { font-size: .82rem; color: var(--eh-ink); }
.eh-help-text small  { font-size: .73rem; color: var(--eh-muted); }
.eh-help-list a:hover .eh-help-text strong { color: var(--eh-green-dark); }

/* ── Loading ── */
.eh-orders-list--loading { opacity: .5; pointer-events: none; }

/* ═══════════════════════════════════════════════════════════════
   Detail Pesanan page
   ═══════════════════════════════════════════════════════════════ */
.eh-order-detail-wrap { flex: 1; min-width: 0; }

.eh-back-link {
	display: inline-flex; align-items: center; gap: 6px;
	font-size: .82rem; font-weight: 600; color: var(--eh-muted);
	text-decoration: none; margin-bottom: 16px;
	transition: color .15s;
}
.eh-back-link .dashicons { font-size: 16px; width: 16px; height: 16px; }
.eh-back-link:hover { color: var(--eh-green-dark); }

.eh-detail-header   { margin-bottom: 20px; }
.eh-detail-title-row {
	display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
	margin-top: 4px;
}
.eh-detail-title-row .eh-page-title { font-size: 1.35rem; margin: 0; }
.eh-detail-title-row .eh-badge      { flex-shrink: 0; }

/* Two-column layout for detail page */
.eh-detail-layout { display: grid; grid-template-columns: minmax(0,1fr) 268px; gap: 20px; align-items: start; }
.eh-detail-main   { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.eh-detail-sidebar { display: flex; flex-direction: column; gap: 14px; }

/* Card shared style */
.eh-detail-card {
	background: #fff;
	border: 1px solid var(--eh-line);
	border-radius: 12px;
	padding: 18px 20px;
	box-shadow: var(--eh-card-sh);
}
.eh-detail-card-title {
	font-size: .9rem; font-weight: 700; color: var(--eh-ink);
	margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--eh-line);
}

/* Items list */
.eh-detail-items { display: flex; flex-direction: column; gap: 14px; }
.eh-detail-item  { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; }
.eh-detail-item-thumb {
	width: 56px; height: 56px; border-radius: 8px; object-fit: cover;
	border: 1px solid var(--eh-line); display: block;
}
.eh-detail-item-info  { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.eh-detail-item-name  { font-size: .85rem; font-weight: 600; color: var(--eh-ink); }
.eh-detail-item-qty   { font-size: .76rem; color: var(--eh-muted); }
.eh-detail-item-price { font-size: .78rem; color: var(--eh-green-dark); font-weight: 600; }
.eh-detail-item-subtotal { font-size: .85rem; font-weight: 700; color: var(--eh-ink); white-space: nowrap; }

/* Totals block */
.eh-detail-totals { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--eh-line); display: flex; flex-direction: column; gap: 8px; }
.eh-detail-total-row { display: flex; justify-content: space-between; align-items: center; font-size: .83rem; color: var(--eh-muted); }
.eh-detail-total-row span:last-child { color: var(--eh-ink); font-weight: 500; }
.eh-detail-total-row--discount span:last-child { color: #e74c3c; }
.eh-detail-total-row--grand { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--eh-line); }
.eh-detail-total-row--grand > span:first-child { font-size: .9rem; font-weight: 700; color: var(--eh-ink); }
.eh-detail-grand-total { font-size: 1.1rem; font-weight: 700; color: var(--eh-green-dark); }

/* Address */
.eh-detail-address { font-style: normal; font-size: .84rem; color: var(--eh-ink); line-height: 1.6; margin: 0; }
.eh-detail-address-phone { font-size: .82rem; color: var(--eh-muted); margin: 8px 0 0; display: flex; align-items: center; gap: 6px; }
.eh-detail-address-phone .dashicons { font-size: 16px; width: 16px; height: 16px; }

/* Notes */
.eh-detail-note { padding: 10px 0; border-bottom: 1px solid var(--eh-line); }
.eh-detail-note:last-child { border-bottom: none; padding-bottom: 0; }
.eh-detail-note-date { font-size: .72rem; color: var(--eh-muted); display: block; margin-bottom: 4px; }
.eh-detail-note-text { margin: 0; font-size: .83rem; color: var(--eh-ink); line-height: 1.5; }

/* Sidebar info rows */
.eh-detail-info-row {
	display: flex; justify-content: space-between; align-items: center;
	padding: 7px 0; border-bottom: 1px solid var(--eh-line); font-size: .82rem;
}
.eh-detail-info-row:last-of-type { border-bottom: none; }
.eh-detail-info-label { color: var(--eh-muted); flex-shrink: 0; margin-right: 8px; }
.eh-detail-info-val   { color: var(--eh-ink); font-weight: 500; text-align: right; }

/* Sidebar action buttons */
.eh-detail-actions { display: flex; flex-direction: column; gap: 8px; }
.eh-detail-actions .eh-btn { width: 100%; justify-content: center; }

/* ── Responsive: stacked card view on small phones only ── */
@media (max-width: 480px) {
	.eh-orders-table-wrap { border: none; box-shadow: none; background: transparent; overflow: visible; }
	.eh-orders-table { min-width: 0; }
	.eh-orders-table thead { display: none; }
	.eh-orders-table, .eh-orders-table tbody, .eh-orders-table tr, .eh-orders-table td { display: block; width: 100%; box-sizing: border-box; }
	.eh-order-row {
		background: #fff; border: 1px solid var(--eh-line); border-radius: 12px;
		box-shadow: var(--eh-card-sh); margin-bottom: 12px; padding: 6px 14px;
	}
	.eh-orders-table tbody td {
		border-bottom: 1px dashed var(--eh-line); padding: 9px 0;
		display: flex; justify-content: space-between; align-items: center; gap: 12px;
	}
	.eh-orders-table tbody tr td:last-child { border-bottom: none; }
	.eh-orders-table tbody td::before {
		content: attr(data-label); font-size: .7rem; font-weight: 700;
		text-transform: uppercase; letter-spacing: .04em; color: var(--eh-muted); flex-shrink: 0;
	}
	.eh-prod-cell     { flex-direction: row-reverse; }
	.eh-actions-stack { flex-direction: row; }
	.eh-orders-table tbody td > * { text-align: right; }
	.eh-col-actions   { text-align: right; }
}

/* ── Viewport responsiveness ── */
@media (max-width: 840px) {
	.eh-orders-layout { grid-template-columns: 1fr; }
	.eh-orders-stats  { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 980px) {
	.woocommerce-account .col-lg-9:has(.eh-orders-wrap),
	.woocommerce-account .col-md-8:has(.eh-orders-wrap) { flex: 0 0 100%; max-width: 100%; }
	.eh-detail-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
	.eh-orders-header  { flex-direction: column; }
	.eh-detail-sidebar { order: -1; }
}
@media (max-width: 560px) {
	.eh-orders-stats { grid-template-columns: 1fr; }
}
