/* TaqSet — all styles scoped under .tqset-modal injected at body level */

/* ── Modal overlay ──────────────────────────────────────────────────────── */
.tqset-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 999999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #1a202c;
  box-sizing: border-box;
}

.tqset-modal * { box-sizing: border-box; }

.tqset-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10,15,30,.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
  animation: tq-fade .2s ease both;
}

/* ── Drawer ─────────────────────────────────────────────────────────────── */
.tqset-drawer {
  position: relative;
  z-index: 1;
  background: #ffffff;
  width: 100%;
  max-width: 560px;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -12px 48px rgba(0,0,0,.22);
  animation: tq-up .28s cubic-bezier(0.32,.72,0,1) both;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 600px) {
  .tqset-modal { align-items: center; }
  .tqset-drawer { border-radius: 16px; margin: 20px; width: calc(100% - 40px); animation: tq-scale .22s cubic-bezier(0.32,.72,0,1) both; }
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.tqset-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 15px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.tqset-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  flex: 1;
  margin: 0;
  padding: 0;
}

.tqset-title svg { color: #667eea; flex-shrink: 0; }

.tqset-price-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.tqset-price-label {
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #9ca3af;
  font-weight: 600;
}

.tqset-price {
  font-size: 17px;
  font-weight: 800;
  color: #111827;
}

.tqset-price small {
  font-size: 11px;
  font-weight: 500;
  color: #9ca3af;
  margin-left: 2px;
}

.tqset-close {
  /* Hard reset */
  all: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f3f4f6;
  color: #6b7280;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.tqset-close:hover { background: #e5e7eb; }

/* ── Segment switcher ───────────────────────────────────────────────────── */
.tqset-segs {
  display: flex;
  gap: 8px;
  padding: 14px 16px;
  background: #f9fafb;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.tqset-seg {
  /* Hard reset — no theme can touch this */
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  padding: 9px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
  color: #6b7280;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  text-align: center;
  line-height: 1.3;
}

.tqset-seg:hover { border-color: #667eea; color: #4b5563; background: #f5f7ff; }

.tqset-seg.tqset-seg-on {
  background: #667eea;
  border-color: #667eea;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(102,126,234,.3);
}

/* ── Provider tabs ──────────────────────────────────────────────────────── */
.tqset-tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid #f0f0f0;
  padding: 0 16px;
  gap: 4px;
  flex-shrink: 0;
  scrollbar-width: none;
}
.tqset-tabs::-webkit-scrollbar { display: none; }

.tqset-tab {
  all: unset;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 12px;
  border-bottom: 2.5px solid transparent;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
  flex-shrink: 0;
  margin-bottom: -1px;
}

.tqset-tab:hover { color: #374151; }
.tqset-tab.tqset-tab-on { color: #667eea; border-bottom-color: #667eea; }

.tqset-tab img {
  width: 50px;
  height: 24px;
  object-fit: contain;
  display: block;
}

/* ── Sections & panels ──────────────────────────────────────────────────── */
.tqset-body { overflow-y: auto; flex: 1; }

.tqset-section { display: none; }
.tqset-section.tqset-on { display: block; }

.tqset-panel { display: none; }
.tqset-panel.tqset-on { display: block; }

.tqset-provhead {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px 0;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.tqset-provhead img {
  height: 28px;
  width: auto;
  max-width: 80px;
  object-fit: contain;
  display: block;
}

/* ── Table — fully scoped, no global cascade ────────────────────────────── */
.tqset-modal table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  display: table;
}

.tqset-modal thead { display: table-header-group; }
.tqset-modal tbody { display: table-row-group; }

.tqset-modal thead tr,
.tqset-modal tbody tr { display: table-row; }

.tqset-modal thead tr { background: #f9fafb; }
.tqset-modal tbody tr { background: transparent; }
.tqset-modal tbody tr:last-child td { border-bottom: none; }
.tqset-modal tbody tr:hover { background: #f9fafb; }

.tqset-modal th,
.tqset-modal td {
  display: table-cell;
  vertical-align: middle;
  text-align: left;
}

.tqset-modal th {
  padding: 9px 16px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: #9ca3af;
  border-bottom: 1px solid #f0f0f0;
}

.tqset-modal td {
  padding: 13px 16px;
  border-bottom: 1px solid #f9fafb;
  color: #374151;
  font-size: 14px;
}

/* Duration cell */
.tqset-dur strong { font-size: 18px; font-weight: 700; color: #111827; margin-right: 2px; }
.tqset-dur span   { font-size: 12px; color: #9ca3af; }

/* Monthly cell */
.tqset-monthly strong { font-size: 18px; font-weight: 800; color: #667eea; }
.tqset-monthly span   { font-size: 11px; color: #9ca3af; margin-left: 2px; }

/* Total cell */
.tqset-total { font-weight: 600; color: #374151; }
.tqset-total span { font-size: 11px; color: #9ca3af; margin-left: 2px; }

/* Interest cell */
.tqset-interest { color: #ef4444; font-weight: 500; }
.tqset-interest span { font-size: 11px; color: #9ca3af; margin-left: 2px; }

/* RTL */
.tqset-rtl .tqset-header,
.tqset-rtl .tqset-segs,
.tqset-rtl .tqset-tabs,
.tqset-rtl .tqset-provhead { direction: rtl; }

.tqset-rtl .tqset-price-wrap { align-items: flex-start; }
.tqset-rtl th,
.tqset-rtl td { text-align: right; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.tqset-footer {
  padding: 10px 20px 14px;
  font-size: 11px;
  color: #d1d5db;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
}

/* ── Animations ─────────────────────────────────────────────────────────── */
@keyframes tq-fade  { from { opacity:0 } to { opacity:1 } }
@keyframes tq-up    { from { transform:translateY(100%);opacity:0 } to { transform:translateY(0);opacity:1 } }
@keyframes tq-scale { from { transform:scale(.94);opacity:0 } to { transform:scale(1);opacity:1 } }
