/* ============================================================
   سامانه رصد کشتی و مجوزها — Minimalism theme
   نزدیک به تک‌رنگ، خطوط مویی، فاصله‌گذاری هدفمند
   ============================================================ */

:root {
  --ink: #111111;
  --ink-soft: #555555;
  --muted: #767676;
  --line: #e7e7e7;
  --line-strong: #d4d4d4;
  --surface: #fafafa;
  --danger: #8a2f2f;
  --danger-line: #e8cccc;
  --max: 1120px;
  --radius: 12px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(17, 17, 17, 0.05);
  --shadow-md: 0 12px 32px rgba(17, 17, 17, 0.09);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: #ffffff;
  color: var(--ink);
  font-family: "Vazirmatn", "Segoe UI", Tahoma, ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

.muted {
  color: var(--muted);
}

/* ---------------- Header ---------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.version {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13.5px;
}

.header-nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.header-nav a:hover {
  color: var(--ink);
}

.user-name {
  color: var(--muted);
  font-size: 13px;
}

.inline-form {
  display: inline;
}

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--ink);
  color: #ffffff;
  border: 1px solid var(--ink);
  padding: 11px 24px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.4;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  background: #262626;
  border-color: #262626;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(17, 17, 17, 0.14);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: none;
}

.btn-ghost:hover {
  background: var(--surface);
  border-color: var(--ink);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.btn-small {
  padding: 7px 14px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

/* ---------------- Main ---------------- */

main.main {
  padding: 44px 0 72px;
  min-height: calc(100vh - 210px);
}

.notice {
  border: 1px solid var(--line);
  border-right: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 14px 18px;
  font-size: 13.5px;
  margin-bottom: 32px;
  color: var(--ink);
}

/* ---------------- Search ---------------- */

.search-stage {
  min-height: calc(100vh - 240px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 0 72px;
}

.search-stage--top {
  display: block;
  min-height: 0;
  padding: 0 0 34px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 34px;
}

.search-stage .search-form {
  width: min(640px, 100%);
}

.search-box {
  position: relative;
  width: 100%;
}

.suggestions {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  z-index: 30;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 300px;
  overflow-y: auto;
  animation: sug-in 0.14s ease;
}

@keyframes sug-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.suggestions[hidden] {
  display: none;
}

.suggestions li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  font-size: 13.5px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.12s ease;
}

.suggestions li:hover,
.suggestions li.is-active {
  background: var(--surface);
}

.sug-code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 9px;
}

.sug-meta {
  color: var(--muted);
  font-size: 12px;
  text-align: left;
}

.search-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.search-field {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-row input {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  padding: 14px 46px 14px 22px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-row input::placeholder {
  color: #a3a3a3;
}

.search-row input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(17, 17, 17, 0.07);
}

.search-row .btn {
  border-radius: 999px;
  padding-left: 28px;
  padding-right: 28px;
  font-size: 14.5px;
}

.search-icon {
  position: absolute;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

/* ---------------- Sections ---------------- */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.empty {
  color: var(--muted);
  font-size: 14px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  margin: 0;
}

/* ---------------- Results table ---------------- */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: #ffffff;
}

.table-wrap::-webkit-scrollbar {
  height: 8px;
}

.table-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 1020px;
}

.data-table th {
  text-align: right;
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  padding: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}

.data-table td {
  padding: 15px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.data-table th:first-child,
.data-table td:first-child {
  padding-right: 18px;
}

.data-table th:last-child,
.data-table td:last-child {
  padding-left: 18px;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr {
  transition: background 0.12s ease;
}

.data-table tbody tr:hover {
  background: var(--surface);
}

.mono {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.row-depleted td {
  color: var(--ink-soft);
}

.arrival-cell {
  white-space: nowrap;
}

.days {
  display: block;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.sub {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.tag {
  display: inline-block;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  margin-right: 6px;
  white-space: nowrap;
  vertical-align: middle;
}

.tag-depleted {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface);
}

.tag-expired {
  color: var(--danger);
  border-color: var(--danger-line);
}

.permit {
  font-variant-numeric: tabular-nums;
}

.permit.expired {
  color: var(--danger);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------------- Checkbox ---------------- */

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.check input {
  width: 15px;
  height: 15px;
  accent-color: #111111;
  cursor: pointer;
}

/* ---------------- Login ---------------- */

.auth-wrap {
  display: flex;
  justify-content: center;
  padding: 32px 0;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 40px 34px;
  background: #ffffff;
}

.auth-head h1 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 600;
}

.field {
  margin-top: 20px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.field input {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  padding: 12px 14px;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--ink);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(17, 17, 17, 0.07);
}

.field-error {
  display: block;
  color: var(--danger);
  font-size: 12.5px;
  margin-top: 6px;
}

.field-error:empty,
.validation-summary:empty {
  display: none;
}

.validation-summary {
  color: var(--danger);
  font-size: 13px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.validation-summary ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-card .btn-block {
  margin-top: 26px;
}

/* ---------------- Upload dialog ---------------- */

.dialog {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0;
  width: min(480px, calc(100vw - 32px));
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
}

.dialog::backdrop {
  background: rgba(17, 17, 17, 0.38);
}

.dialog form {
  padding: 30px 28px;
}

.dialog-title {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 600;
}

.dialog p {
  margin: 0 0 20px;
  font-size: 13.5px;
}

.file-field {
  display: block;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 18px;
  font-size: 13px;
  color: var(--muted);
}

.file-field span {
  display: block;
  margin-bottom: 10px;
}

.file-field input {
  width: 100%;
  font-size: 13px;
  font-family: inherit;
}

.dialog-actions {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 24px;
}

/* ---------------- Footer ---------------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0;
  font-size: 12.5px;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.dot {
  color: var(--line-strong);
}

/* ---------------- Error page ---------------- */

.empty-page {
  max-width: 480px;
  padding: 40px 0;
}

.empty-page h1 {
  font-size: 20px;
  margin: 0 0 8px;
}

.empty-page a {
  margin-top: 18px;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 720px) {
  .container {
    padding: 0 16px;
  }

  .header-inner {
    height: auto;
    padding-top: 12px;
    padding-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .header-nav {
    gap: 12px;
    flex-wrap: wrap;
  }

  main.main {
    padding-top: 28px;
    padding-bottom: 56px;
  }

  .search-stage {
    min-height: calc(100vh - 210px);
    padding: 24px 0 48px;
  }

  .search-stage--top {
    padding-bottom: 22px;
    margin-bottom: 22px;
  }

  .search-row {
    flex-direction: column;
  }

  .search-row .btn {
    padding-top: 13px;
    padding-bottom: 13px;
  }

  .section-head {
    flex-wrap: wrap;
    gap: 6px;
  }

  .data-table th,
  .data-table td {
    padding-top: 12px;
    padding-bottom: 12px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .auth-wrap {
    padding-top: 8px;
  }

  .auth-card {
    padding: 30px 22px;
  }

  .dialog form {
    padding: 24px 20px;
  }

  .dialog-actions {
    flex-direction: column;
  }

  .dialog-actions .btn {
    width: 100%;
  }

  .footer-inner {
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .brand {
    font-size: 14px;
  }

  .brand .version {
    display: none;
  }

  .header-nav {
    gap: 10px;
    font-size: 12.5px;
  }

  .search-row input {
    padding-top: 13px;
    padding-bottom: 13px;
    padding-right: 44px;
    padding-left: 18px;
    font-size: 14.5px;
  }

  .section-head h2 {
    font-size: 14.5px;
  }

  .data-table th:first-child,
  .data-table td:first-child {
    padding-right: 14px;
  }

  .data-table th:last-child,
  .data-table td:last-child {
    padding-left: 14px;
  }

  .auth-card {
    padding: 26px 18px;
  }
}
