/* Iranian national (شخصی) license plate — display + interactive input */

.tb-iran-plate {
  --tb-plate-blue: #003399;
  --tb-plate-border: #1a1a1a;
  --tb-plate-divider: #9ca3af;
  --tb-plate-bg: #ffffff;
  --tb-plate-ink: #0a0a0a;
  --tb-plate-muted: #d4d4d8;
  --tb-plate-flag-g: #239f40;
  --tb-plate-flag-r: #da0000;

  display: inline-flex;
  flex-direction: row !important;
  align-items: stretch;
  box-sizing: border-box;
  direction: ltr !important;
  unicode-bidi: isolate;
  background: var(--tb-plate-bg);
  border: 1.5px solid var(--tb-plate-border);
  border-radius: 0.28em;
  overflow: hidden;
  line-height: 1;
  font-family: Vazirmatn, Tahoma, sans-serif;
  font-weight: 700;
  color: var(--tb-plate-ink);
  vertical-align: middle;
  width: 14.5em;
  height: 3em;
}

.tb-iran-plate:not(.tb-iran-plate--input) {
  user-select: none;
  width: 11.5em;
  height: 2.45em;
}

.tb-iran-plate--sm {
  font-size: 11px;
}

.tb-iran-plate--md {
  font-size: 14px;
}

.tb-iran-plate--lg {
  font-size: 18px;
}

.tb-iran-plate--input {
  width: min(100%, 18.5em);
  max-width: 100%;
}

.tb-iran-plate--input.tb-iran-plate--lg {
  font-size: clamp(15px, 2.6vw, 18px);
  height: 3.25em;
}

.tb-iran-plate__blue {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1em;
  width: 1.7em;
  flex-shrink: 0;
  background: var(--tb-plate-blue);
  color: #fff;
  padding: 0.15em 0.12em;
}

.tb-iran-plate--input .tb-iran-plate__blue {
  width: 1.85em;
}

.tb-iran-plate__flag {
  display: block;
  width: 1.1em;
  height: 0.66em;
  border-radius: 0.04em;
  background: linear-gradient(
    to bottom,
    var(--tb-plate-flag-g) 0 33.33%,
    #fff 33.33% 66.66%,
    var(--tb-plate-flag-r) 66.66% 100%
  );
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.15);
}

.tb-iran-plate__ir,
.tb-iran-plate__iran {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 0.44em;
  letter-spacing: 0.02em;
  line-height: 1.05;
  text-align: center;
  color: #fff;
}

.tb-iran-plate__iran {
  font-size: 0.4em;
  letter-spacing: 0.04em;
}

.tb-iran-plate__main {
  display: flex;
  flex-direction: row !important;
  flex: 1 1 auto;
  align-items: center;
  justify-content: space-evenly;
  gap: 0.2em;
  padding: 0 0.35em;
  min-width: 0;
  direction: ltr !important;
}

.tb-iran-plate__series,
.tb-iran-plate__number,
.tb-iran-plate__letter,
.tb-iran-plate__region > span {
  font-variant-numeric: tabular-nums;
}

.tb-iran-plate__series,
.tb-iran-plate__number {
  font-size: 1.15em;
  letter-spacing: 0.02em;
}

.tb-iran-plate__letter {
  font-size: 1.05em;
  min-width: 1.1em;
  text-align: center;
}

.tb-iran-plate__region {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.15em;
  border-left: 1.5px solid var(--tb-plate-divider);
  border-inline-start: 1.5px solid var(--tb-plate-divider);
  padding: 0 0.15em;
  direction: ltr !important;
}

.tb-iran-plate--input .tb-iran-plate__region {
  width: 2.6em;
}

.tb-iran-plate__region > span {
  font-size: 1.15em;
}

.tb-iran-plate-fallback {
  display: inline-block;
  font-family: Vazirmatn, Tahoma, sans-serif;
  font-weight: 600;
  direction: ltr;
  unicode-bidi: isolate;
}

/* Interactive plate field */
.tb-iran-plate-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
}

.tb-iran-plate-field__label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #4b5563;
  margin-bottom: 0;
}

.tb-iran-plate__control {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  color: var(--tb-plate-ink);
  font: inherit;
  font-weight: 700;
  text-align: center;
  padding: 0;
  margin: 0;
  outline: none;
  min-width: 0;
  box-shadow: none;
  border-radius: 0.15em;
}

.tb-iran-plate__control:focus {
  background: rgba(0, 51, 153, 0.08);
  outline: 2px solid rgba(0, 51, 153, 0.35);
  outline-offset: 1px;
}

.tb-iran-plate__control::placeholder {
  color: var(--tb-plate-muted);
  font-weight: 600;
  opacity: 1;
}

input.tb-iran-plate__series.tb-iran-plate__control {
  width: 1.75em;
  font-size: 1.15em;
}

input.tb-iran-plate__number.tb-iran-plate__control {
  width: 2.4em;
  font-size: 1.15em;
}

.tb-iran-plate__region .tb-iran-plate__control {
  width: 100%;
  font-size: 1.15em;
}

/* Letter select inside plate — searchable, plate-styled chrome */
.tb-iran-plate__letter-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 1.7em;
  max-width: 2.6em;
}

.tb-iran-plate__letter-slot .tb-lookup-wrap,
.tb-iran-plate__letter-lookup {
  position: relative;
  width: auto;
  min-width: 1.7em;
}

.tb-iran-plate__letter-slot .tb-lookup-display,
.tb-iran-plate__letter-lookup .tb-lookup-display {
  width: 2.1em !important;
  min-width: 1.7em;
  max-width: 2.6em;
  height: 1.6em;
  padding: 0 !important;
  margin: 0;
  border: none !important;
  border-radius: 0.15em !important;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  font: inherit !important;
  font-weight: 700 !important;
  font-size: 1.05em !important;
  line-height: 1.6em;
  text-align: center !important;
  color: #0a0a0a !important;
  -webkit-text-fill-color: #0a0a0a !important;
  caret-color: #0a0a0a !important;
  direction: rtl;
  color-scheme: light;
}

.tb-iran-plate__letter-slot .tb-lookup-display::placeholder,
.tb-iran-plate__letter-lookup .tb-lookup-display::placeholder {
  color: #a1a1aa !important;
  -webkit-text-fill-color: #a1a1aa !important;
  opacity: 1;
  font-weight: 700;
}

.tb-iran-plate__letter-slot .tb-lookup-display:focus,
.tb-iran-plate__letter-lookup .tb-lookup-display:focus {
  background: rgba(0, 51, 153, 0.08) !important;
  background-color: rgba(0, 51, 153, 0.08) !important;
  outline: 2px solid rgba(0, 51, 153, 0.35);
  outline-offset: 1px;
  color: #0a0a0a !important;
  -webkit-text-fill-color: #0a0a0a !important;
}

.tb-iran-plate__letter-slot .tb-lookup-clear,
.tb-iran-plate__letter-lookup .tb-lookup-clear {
  display: none !important;
}

/* Plate chrome is always authentic (white + black ink), including dark UI theme */
.tb-iran-plate,
.tb-iran-plate--input {
  color-scheme: light;
  background: #ffffff !important;
  color: #0a0a0a !important;
}

.tb-iran-plate .tb-iran-plate__control {
  color: #0a0a0a !important;
  -webkit-text-fill-color: #0a0a0a !important;
  caret-color: #0a0a0a !important;
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color-scheme: light;
}

.tb-iran-plate .tb-iran-plate__control::placeholder {
  color: #a1a1aa !important;
  -webkit-text-fill-color: #a1a1aa !important;
  opacity: 1;
}

.tb-iran-plate .tb-iran-plate__control:focus {
  background: rgba(0, 51, 153, 0.08) !important;
  background-color: rgba(0, 51, 153, 0.08) !important;
  outline: 2px solid rgba(0, 51, 153, 0.35);
  outline-offset: 1px;
  box-shadow: none !important;
  border-color: transparent !important;
}

html[data-theme="dark"] .tb-iran-plate,
html[data-theme="dark"] .tb-iran-plate--input,
[data-theme="dark"] .tb-iran-plate,
html.dark .tb-iran-plate {
  --tb-plate-bg: #ffffff;
  --tb-plate-ink: #0a0a0a;
  --tb-plate-muted: #a1a1aa;
  --tb-plate-border: #cbd5e1;
  background: #ffffff !important;
  color: #0a0a0a !important;
  border-color: #cbd5e1;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
  color-scheme: light;
}

html[data-theme="dark"] .tb-iran-plate .tb-iran-plate__control,
html[data-theme="dark"] .admin-app .tb-iran-plate .tb-iran-plate__control,
html[data-theme="dark"] .tb-iran-plate__letter-slot .tb-lookup-display,
html[data-theme="dark"] .tb-iran-plate__letter-lookup .tb-lookup-display,
html[data-theme="dark"] .admin-app .tb-iran-plate__letter-slot .tb-lookup-display,
html[data-theme="dark"] .admin-app .tb-iran-plate__letter-lookup .tb-lookup-display,
[data-theme="dark"] .tb-iran-plate .tb-iran-plate__control,
[data-theme="dark"] .tb-iran-plate__letter-slot .tb-lookup-display {
  color: #0a0a0a !important;
  -webkit-text-fill-color: #0a0a0a !important;
  caret-color: #0a0a0a !important;
  background: transparent !important;
  background-color: transparent !important;
}

html[data-theme="dark"] .tb-iran-plate .tb-iran-plate__control::placeholder,
html[data-theme="dark"] .tb-iran-plate__letter-slot .tb-lookup-display::placeholder,
html[data-theme="dark"] .admin-app .tb-iran-plate__letter-slot .tb-lookup-display::placeholder,
[data-theme="dark"] .tb-iran-plate .tb-iran-plate__control::placeholder,
[data-theme="dark"] .tb-iran-plate__letter-slot .tb-lookup-display::placeholder {
  color: #a1a1aa !important;
  -webkit-text-fill-color: #a1a1aa !important;
}

html[data-theme="dark"] .tb-iran-plate-field__label,
[data-theme="dark"] .tb-iran-plate-field__label {
  color: #d1d5db;
}
