/*
 * Sim Store — trang danh sách / chi tiết sim.
 * Mọi màu là biến CSS: theme ghi đè trong :root hoặc .sim-store mà không sửa file này.
 */
.sim-store {
    --sim-accent: #d0021b;          /* phần đuôi số, giá ở trang chi tiết */
    --sim-head: #15803d;            /* phần đầu số */
    --sim-buy-bg: #ffc107;          /* nút Mua ngay */
    --sim-buy-color: #1f2937;
    --sim-border: #e5e7eb;
    --sim-soft: #f5f6f8;            /* nền dải tiêu đề, đầu bảng */
    --sim-muted: #6b7280;
    margin: 16px 0 40px;
    font-size: 14px;
}
.sim-store a { text-decoration: none; }
/* Một phần trang đứng riêng trong element Page Builder: khoảng cách do builder quyết định. */
.sim-store--section { margin: 0; }
.sim-store--section > .sim-box:last-child, .sim-store--section > .sim-filter { margin-bottom: 0; }
.sim-store.is-loading .sim-store__results { opacity: .45; pointer-events: none; transition: opacity .15s; }

/* ---------------------------------------------------------------- nút chung */
.sim-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 4px; padding: 6px 14px; background: var(--sim-buy-bg); color: var(--sim-buy-color); font-weight: 600; cursor: pointer; white-space: nowrap; }
.sim-btn:hover { filter: brightness(.95); color: var(--sim-buy-color); }
.sim-btn--buy { padding: 4px 12px; font-weight: 500; }
.sim-btn--search { border-radius: 0 4px 4px 0; padding: 0 16px; }

/* ---------------------------------------------------------------- bộ lọc */
.sim-filter { background: var(--sim-soft); border: 1px solid var(--sim-border); border-radius: 6px; padding: 12px; margin-bottom: 16px; }
.sim-filter__top { display: grid; grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(140px, 1fr)); gap: 8px; }
.sim-filter__search { display: flex; }
.sim-filter__search .form-control { border-radius: 4px 0 0 4px; font-size: 16px; letter-spacing: .3px; }
.sim-filter__hint { font-size: 12px; color: var(--sim-muted); margin: 6px 0 4px; }
.sim-filter__hint code { background: #fff; border: 1px solid var(--sim-border); border-radius: 3px; padding: 0 4px; color: inherit; font-size: 12px; }
.sim-filter__bottom { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.sim-filter__label { color: var(--sim-muted); margin-right: 2px; }

.sim-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
/* Chip phải là khối chứa của ô input ẩn: không thì input (absolute) thoát khỏi hàng chip cuộn ngang
   trên điện thoại và kéo giãn cả trang theo chiều ngang. */
.sim-chip, .sim-digit, .sim-check { position: relative; }
.sim-chip input, .sim-digit input, .sim-check input { position: absolute; opacity: 0; pointer-events: none; }
.sim-chip span { display: inline-block; padding: 6px 14px; border: 1px solid var(--sim-border); border-radius: 4px; background: #fff; cursor: pointer; transition: border-color .15s; }
.sim-chip span:hover { border-color: #9ca3af; }
.sim-chip input:checked + span { border-color: var(--sim-buy-bg); background: var(--sim-buy-bg); color: var(--sim-buy-color); font-weight: 600; }
.sim-chip--network span { color: var(--chip-color); font-weight: 700; min-width: 104px; text-align: center; padding: 4px 10px; line-height: 0; }
/* Logo nhà mạng (SimHelper::networkLogo) — SVG tỉ lệ ~3.7:1, chỉ cố định chiều cao. */
.sim-logo { display: inline-block; height: 24px; width: auto; max-width: 100%; vertical-align: middle; }
.sim-logo--text { height: auto; line-height: 1.4; }
.sim-chip--network .sim-logo--text { line-height: 24px; }
.sim-table__network .sim-logo { height: 20px; }
.sim-tabs__tab .sim-logo { height: 22px; }
.sim-chip--network input:checked + span { background: #fff; color: var(--chip-color); border-color: var(--chip-color); box-shadow: inset 0 0 0 1px var(--chip-color); }
.sim-chip input:focus-visible + span, .sim-digit input:focus-visible + span, .sim-check input:focus-visible + span { outline: 2px solid #2563eb; outline-offset: 2px; }

.sim-digit span { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 1px solid var(--sim-border); border-radius: 4px; background: #fff; cursor: pointer; font-weight: 600; }
.sim-digit input:checked + span { background: #374151; color: #fff; border-color: #374151; text-decoration: line-through; }
.sim-check { margin-left: 12px; cursor: pointer; }
.sim-check span::before { content: ''; display: inline-block; width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; border: 1px solid #9ca3af; border-radius: 3px; background: #fff; }
.sim-check input:checked + span::before { background: var(--sim-buy-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%231f2937' stroke-width='2'/%3E%3C/svg%3E") center/12px no-repeat; border-color: var(--sim-buy-bg); }

/* ---------------------------------------------------------------- bố cục */
.sim-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.sim-layout--3 { grid-template-columns: 240px minmax(0, 1fr) 240px; }
.sim-box { background: #fff; border: 1px solid var(--sim-border); border-radius: 6px; margin-bottom: 16px; overflow: hidden; }
.sim-box > :not(.sim-box__title):not(.sim-list):not(.sim-store__results) { margin-left: 12px; margin-right: 12px; }
.sim-box__title { margin: 0; padding: 10px 12px; background: var(--sim-soft); border-bottom: 1px solid var(--sim-border); font-size: 15px; font-weight: 700; text-transform: uppercase; }
.sim-store__intro { padding: 12px 0; line-height: 1.7; }

/* ---------------------------------------------------------------- sidebar */
.sim-side__box { border: 1px solid var(--sim-border); border-radius: 6px; margin-bottom: 16px; overflow: hidden; background: #fff; }
.sim-side__title { padding: 10px 12px; background: var(--sim-soft); border-bottom: 1px solid var(--sim-border); font-weight: 700; }
.sim-side__title i { color: var(--sim-muted); margin-right: 4px; }
.sim-side ul { list-style: none; margin: 0; padding: 0; }
.sim-side li + li { border-top: 1px solid var(--sim-border); }
.sim-side li a { display: block; padding: 7px 14px; color: #374151; }
.sim-side li a:hover { background: var(--sim-soft); color: var(--sim-accent); }
.sim-side li a.is-active { color: var(--sim-accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--sim-accent); }

/* ---------------------------------------------------------------- bảng */
.sim-list { padding: 10px 12px 12px; }
.sim-list__summary { margin-bottom: 8px; color: var(--sim-muted); }
.sim-list__empty { padding: 36px 16px; text-align: center; border: 1px dashed var(--sim-border); border-radius: 6px; color: var(--sim-muted); }
.sim-table-wrap { overflow-x: auto; }
.sim-table { width: 100%; border-collapse: collapse; }
.sim-table th, .sim-table td { padding: 7px 8px; border: 1px solid var(--sim-border); text-align: center; vertical-align: middle; }
.sim-table thead th { background: var(--sim-soft); font-weight: 700; white-space: nowrap; }
.sim-table tbody tr:nth-child(even) { background: #fcfcfd; }
.sim-table tbody tr:hover { background: #fff8e1; }
.sim-table__stt { width: 52px; color: var(--sim-muted); }
.sim-table__number a { font-size: 17px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
.sim-table__price { font-weight: 700; white-space: nowrap; }
.sim-table__points { width: 64px; }
.sim-table__network { font-weight: 500; }
.sim-table__buy { width: 100px; }
.sim-no__head { color: var(--sim-head); }
.sim-no__tail { color: var(--sim-accent); }
.sim-list__pagination { margin-top: 14px; display: flex; justify-content: center; }

.sim-badge { display: inline-block; font-size: 11px; line-height: 1; padding: 3px 6px; margin: 2px 0 2px 4px; border-radius: 3px; background: #f3f4f6; color: #374151; vertical-align: 3px; font-weight: 500; }
.sim-badge--hot { background: #fef3c7; color: #92400e; }

/* ---------------------------------------------------------------- chi tiết */
.sim-detail__summary { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; align-items: center; padding: 14px 0; }
.sim-detail__facts { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 12px; margin: 0; }
.sim-detail__facts dt { color: var(--sim-muted); font-weight: 400; text-align: right; }
.sim-detail__facts dd { margin: 0; }
.sim-detail__number { font-size: 24px; font-weight: 800; letter-spacing: .5px; line-height: 1.2; }
.sim-detail__price { font-size: 20px; font-weight: 700; color: var(--sim-head); }
.sim-detail__words { display: block; color: var(--sim-muted); }
.sim-detail__held { margin-bottom: 14px; padding: 8px 12px; border-radius: 4px; background: #fef3c7; color: #92400e; }
.sim-detail__contact { padding: 12px 0; color: var(--sim-muted); }
.sim-detail__procedure { padding: 10px 0; line-height: 1.7; }
.sim-detail__procedure ol { margin: 0 0 6px; padding-left: 20px; }
.sim-detail__procedure p { margin: 0; }

/* Thẻ SIM vẽ bằng CSS, màu theo nhà mạng. */
.sim-card { position: relative; aspect-ratio: 1.58; border-radius: 12px; padding: 16px; color: #fff; overflow: hidden;
    background: linear-gradient(135deg, var(--card-color) 0%, color-mix(in srgb, var(--card-color) 55%, #000) 100%); box-shadow: 0 6px 18px rgba(0, 0, 0, .15); }
.sim-card::after { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.sim-card__chip { width: 46px; height: 34px; border-radius: 6px; background: linear-gradient(135deg, #f7e7a1, #caa64a); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.sim-card__brand { position: absolute; top: 16px; right: 16px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; z-index: 1; }
.sim-card__number { position: absolute; left: 16px; right: 16px; bottom: 16px; padding: 6px 10px; border-radius: 6px; background: #fff; color: #111827; font-size: 20px; font-weight: 700; letter-spacing: 1.5px; text-align: center; font-variant-numeric: tabular-nums; z-index: 1; }

/* ---------------------------------------------------------------- form đặt số */
.sim-order { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; padding: 14px 0; }
.sim-order.is-loading { opacity: .6; pointer-events: none; }
.sim-order__title { grid-column: 1 / -1; font-size: 17px; font-weight: 700; }
.sim-order__field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.sim-order__field--full { grid-column: 1 / -1; }
.sim-order__field span { font-size: 13px; color: var(--sim-muted); }
.sim-order__field b { color: var(--sim-accent); }
.sim-order .form-control.is-invalid { border-color: var(--sim-accent); }
.sim-order__trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.sim-order__actions { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 4px; }
.sim-btn--order { flex-direction: column; gap: 0; min-width: 240px; padding: 10px 24px; background: #f97316; color: #fff; font-size: 16px; text-transform: uppercase; }
.sim-btn--order:hover { color: #fff; }
.sim-btn--order small { font-size: 12px; font-weight: 400; text-transform: none; opacity: .9; }
.sim-order__hotline a { font-size: 18px; font-weight: 700; color: #2563eb; }
.sim-order__result { grid-column: 1 / -1; }
.sim-order__result.is-error { padding: 8px 12px; border-radius: 4px; background: #fef2f2; color: #b91c1c; }
.sim-order__done { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; padding: 14px; border-radius: 6px; background: #ecfdf5; color: #065f46; }
.sim-order__done i { font-size: 22px; }

/* ---------------------------------------------------------------- đơn hàng mới */
.sim-recent li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; }
.sim-recent__name { font-weight: 500; max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sim-recent__phone { color: var(--sim-muted); font-size: 13px; }
.sim-recent__meta { text-align: right; }
.sim-recent__badge { display: inline-block; padding: 3px 8px; border-radius: 3px; background: #f97316; color: #fff; font-size: 12px; white-space: nowrap; }
.sim-recent__date { display: block; margin-top: 4px; color: var(--sim-muted); font-size: 12px; }

/* ---------------------------------------------------------------- element */
.sim-el { margin: 0; }
.sim-el__title { margin-bottom: 10px; font-size: 18px; font-weight: 700; text-transform: uppercase; }
.sim-el .sim-list { padding: 0; }
.sim-el__more { margin-top: 12px; text-align: center; }
.sim-el--search .sim-filter__search { max-width: 640px; }
.sim-el--search .sim-btn--search { padding: 0 20px; }
a.sim-chip span { color: var(--chip-color); }
.sim-tag-grid { display: grid; grid-template-columns: repeat(var(--sim-cols, 4), minmax(0, 1fr)); gap: 8px; }
.sim-tag-grid__item { display: block; padding: 10px 12px; border: 1px solid var(--sim-border); border-radius: 6px; background: #fff; color: #374151; font-weight: 500; text-align: center; }
.sim-tag-grid__item:hover { border-color: var(--sim-accent); color: var(--sim-accent); }
.sim-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.sim-tabs__tab { padding: 7px 16px; border: 1px solid var(--sim-border); border-radius: 4px; background: #fff; color: var(--chip-color); font-weight: 700; cursor: pointer; }
.sim-tabs__tab.is-active { border-color: var(--chip-color); box-shadow: inset 0 0 0 1px var(--chip-color); }

/* Bố cục Page Builder: cột danh mục và cột nội dung là hai cột của builder, không có khe giữa. */
@media (min-width: 992px) {
    .sim-store--section > .sim-side { margin-right: 16px; }
}

/* ---------------------------------------------------------------- màn hình nhỏ */
@media (max-width: 991px) {
    .sim-layout, .sim-layout--3 { grid-template-columns: minmax(0, 1fr); }
    .sim-layout__left { order: 2; }
    .sim-layout__right { order: 3; }
    /* Bố cục Page Builder: cột HTML đứng trước (danh mục) xếp chồng lên TRÊN danh sách.
       Đẩy cột danh mục + cột "SimRecentOrdersElement" xuống dưới, chỉ trong hàng có khối chính của
       plugin (element đặt riêng ở trang chủ không bị ảnh hưởng). Mốc 991px trùng mốc
       xếp chồng của builder (widthTablet / widthMobile = 100%). */
    .build-content:has(> .build-column .SimIndexResultsElement, > .build-column .SimDetailSummaryElement) > .build-column:has(.SimIndexSidebarElement),
    .build-content:has(> .build-column .SimIndexResultsElement, > .build-column .SimDetailSummaryElement) > .build-column:has(.SimDetailSidebarElement) { order: 2; }
    .build-content:has(> .build-column .SimIndexResultsElement, > .build-column .SimDetailSummaryElement) > .build-column:has(.SimRecentOrdersElement) { order: 3; }
    .sim-filter__top { grid-template-columns: 1fr 1fr; }
    .sim-filter__search, .sim-filter__top select[name="sx"] { grid-column: 1 / -1; }
}
@media (max-width: 575px) {
    .sim-table__stt, .sim-table__points, .sim-table__network { display: none; }
    .sim-table th, .sim-table td { padding: 6px 4px; }
    .sim-table__buy { width: auto; }
    .sim-btn--buy { padding: 4px 8px; font-size: 13px; }
    .sim-table__number a { font-size: 15px; }
    .sim-chip--network span { min-width: 0; }
    /* Hàng nút nhà mạng / giá: một dòng cuộn ngang thay vì 3–4 dòng chiếm hết màn hình. */
    .sim-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
    .sim-chip { flex: 0 0 auto; }
    .sim-chip span { white-space: nowrap; }
    .sim-detail__summary { grid-template-columns: minmax(0, 1fr); }
    .sim-card { max-width: 280px; }
    .sim-detail__facts { grid-template-columns: 110px minmax(0, 1fr); }
    .sim-order { grid-template-columns: 1fr; }
    .sim-tag-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sim-tabs { flex-wrap: nowrap; overflow-x: auto; }
    .sim-tabs__tab { flex: 0 0 auto; }
}
