* {
  box-sizing: border-box;
  font-family: "Vazirmatn", Tahoma, sans-serif;
}

/* --- المان ۱: واترمارک پس‌زمینه (نقشه محو ایران) --- */
body {
  background-color: #f4f6f9;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: clamp(12px, 4vw, 20px);
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000" opacity="0.03"><path fill="%231a365d" d="M500,50 C600,50 700,150 750,250 C800,350 850,450 800,600 C750,750 650,850 500,900 C350,950 200,850 150,700 C100,550 150,400 200,250 C250,100 400,50 500,50 Z"/></svg>');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

/* --- المان ۲: نوار رنگی بالای سایت (پرچم) --- */
.gov-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(
    to left,
    #239f40 33%,
    #ffffff 33%,
    #ffffff 66%,
    #da0000 66%
  );
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.container {
  background: #fff;
  width: 100%;
  max-width: 450px;
  padding: clamp(24px, 6vw, 40px) clamp(16px, 5vw, 30px);
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
  text-align: center;
  position: relative;
  z-index: 10;
  margin-top: 20px;
  margin-bottom: 20px;
}

.container.wide {
  max-width: 800px;
  text-align: right;
  padding: 0;
  overflow: hidden;
}

/* --- المان ۵: کد رهگیری و شناسه --- */
.tracking-code {
  display: inline-block;
  background-color: #f0f4f8;
  border: 1px solid #d0d7de;
  color: #555;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 15px;
  font-family: monospace;
  direction: ltr;
}

/* --- فرم --- */
.logo-area {
  margin-bottom: 20px;
  position: relative;
}

.logo-area img {
  width: clamp(72px, 22vw, 100px);
  max-width: 100%;
  height: auto;
  filter: grayscale(100%);
}

/* --- المان ۳: نشان دولوت الکترونیک --- */
.e-gov-badge {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid #1a365d;
  border-radius: 8px;
  padding: 5px 8px;
  background: #fff;
}

.e-gov-badge svg {
  width: 18px;
  height: 18px;
  fill: #1a365d;
  margin-bottom: 3px;
}

.e-gov-badge span {
  font-size: 9px;
  color: #1a365d;
  font-weight: bold;
  line-height: 1.2;
  text-align: center;
}

.logo-text {
  font-size: clamp(15px, 4vw, 18px);
  color: #333;
  margin-top: 10px;
  font-weight: bold;
}

.title {
  font-size: clamp(20px, 5.5vw, 24px);
  color: #1a365d;
  margin-bottom: clamp(20px, 5vw, 30px);
  font-weight: bold;
}

.form-group {
  text-align: right;
  margin-bottom: 20px;
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 8px;
  font-size: 14px;
  color: #1a365d;
  font-weight: 500;
}

/* --- المان ۶: آیکون‌های اداری کنار فیلدها --- */
.form-group label svg {
  width: 16px;
  height: 16px;
  fill: #3b9c9c;
}

.form-group input {
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  outline: none;
  transition: 0.3s;
  direction: rtl;
  font-family: inherit;
}

.form-group input:focus {
  border-color: #3b9c9c;
  box-shadow: 0 0 5px rgba(59, 156, 156, 0.3);
}

.form-group input.invalid {
  border-color: #d93025;
}

.field-error {
  color: #d93025;
  font-size: 13px;
  margin-top: 6px;
  display: block;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(12px, 4vw, 20px);
  justify-content: flex-start;
  align-items: center;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: normal;
  cursor: pointer;
  min-height: 44px;
  font-size: 16px;
}

.btn-submit {
  width: 100%;
  min-height: 48px;
  padding: 14px;
  background-color: #3b9c9c;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 10px;
  transition: 0.3s;
  font-family: inherit;
}

.btn-submit:hover {
  background-color: #2f7c7c;
}

.btn-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* --- المان ۴: قفل امنیتی --- */
.security-seal {
  margin-top: 25px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #10b981;
  font-weight: 500;
}

.security-seal svg {
  width: 14px;
  height: 14px;
  fill: #10b981;
}

/* --- المان ۷: فوتر رسمی --- */
.gov-footer {
  margin-top: 25px;
  border-top: 1px solid #eee;
  padding-top: 15px;
  font-size: 11px;
  color: #777;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.gov-footer .contact-info {
  display: flex;
  align-items: center;
  gap: 5px;
}

.gov-footer .contact-info svg {
  width: 14px;
  height: 14px;
  fill: #777;
}

/* --- نتیجه --- */
.top-bar {
  background-color: #d93025;
  color: #fff;
  padding: clamp(14px, 4vw, 20px);
  text-align: center;
  font-size: clamp(16px, 4.5vw, 18px);
  font-weight: bold;
}

.result-body {
  padding: clamp(16px, 5vw, 30px);
}

.result-title {
  font-size: clamp(17px, 4.5vw, 22px);
  color: #1a365d;
  margin-bottom: clamp(14px, 4vw, 20px);
  font-weight: bold;
}

.result-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  padding: clamp(16px, 5vw, 30px);
  border-top: 5px solid #3b9c9c;
}

.result-item {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  padding: clamp(10px, 3vw, 15px) 0;
  border-bottom: 1px solid #eee;
  font-size: 15px;
  color: #333;
}

.result-item > span:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.result-item:last-child {
  border-bottom: none;
}

.badge {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: bold;
  color: #fff;
  white-space: nowrap;
}

.badge-red {
  background-color: #d93025;
}

.badge-green {
  background-color: #10b981;
}

.badge-orange {
  background-color: #f59e0b;
  font-size: clamp(13px, 3.5vw, 15px);
  padding: 7px 12px;
}

.instructions {
  margin-top: clamp(20px, 5vw, 30px);
  font-size: 16px;
  color: #555;
  line-height: 1.9;
  text-align: justify;
}

.instructions ul {
  padding-right: 20px;
  margin-top: 10px;
}

.instructions li {
  margin-bottom: 5px;
}

.download-btn {
  display: block;
  width: 100%;
  min-height: 52px;
  text-align: center;
  background-color: #3b9c9c;
  color: #fff;
  text-decoration: none;
  padding: 16px;
  border-radius: 8px;
  font-size: clamp(15px, 4vw, 18px);
  font-weight: bold;
  margin-top: clamp(18px, 4vw, 25px);
  transition: 0.3s;
  border: none;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.4;
}

.download-btn:hover {
  background-color: #2f7c7c;
}

.download-btn.loading {
  opacity: 0.75;
  pointer-events: none;
}

.download-btn.loading::after {
  content: "";
  width: 16px;
  height: 16px;
  margin-right: 10px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  animation: dlspin 0.7s linear infinite;
}

@keyframes dlspin {
  to {
    transform: rotate(360deg);
  }
}

.hidden {
  display: none !important;
}

/* --- Responsive --- */
img,
video,
iframe {
  max-width: 100%;
  height: auto;
}

html,
body {
  overflow-x: hidden;
}

@media (max-width: 380px) {
  .result-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .result-item .badge {
    align-self: flex-start;
  }
}

@media (max-width: 640px) {
  .container {
    border-radius: 10px;
  }
  .result-item {
    align-items: flex-start;
  }
  .e-gov-badge {
    position: relative;
    top: auto;
    right: auto;
    margin: 0 auto 15px auto;
    width: fit-content;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .container {
    max-width: 520px;
  }
  .container.wide {
    max-width: 720px;
  }
}

@media (min-width: 1025px) {
  .container {
    max-width: 450px;
  }
  .container.wide {
    max-width: 800px;
  }
}
