body {
  font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
  background: radial-gradient(circle at 63% 30%, #f3f8ff 40%, #e3eefe 100%);
  margin: 0;
  min-height: 100vh;
  direction: rtl;
  color: #22315b;
  letter-spacing: 0.01em;
  transition: background 0.4s;
}

main {
  max-width: 900px;
  margin: 44px auto;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 6px 32px #a9b4ec30;
  padding: 38px 18px 32px 18px;
  position: relative;
  min-height: 72vh;
}

.filter-section h2 {
  font-size: 1.17rem;
  margin-bottom: 13px;
  color: #185887;
  text-align: right;
}

.proto-filters-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 10px 15px;
  margin-bottom: 22px;
}

.proto-checkbox-label {
  border-radius: 8px;
  font-weight: 500;
  color: #2a4e7b;
  padding: 7px 18px 7px 13px;
  border: 1.3px solid #bdd5f7;
  background: #f0f6fb;
  display: flex;
  align-items: center;
  font-size: 15px;
  cursor: pointer;
  transition: border 0.12s, background 0.13s;
  box-shadow: 0 1px 6px #68c9f20c;
}

.proto-checkbox-label.checked {
  background: #d8ecfc;
  border: 1.4px solid #5dbdff;
  color: #1867ae;
  box-shadow: 0 1px 10px #7fdfff1a;
}

.proto-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #2b83db;
  margin-left: 8px;
  cursor: pointer;
}

#process-btn, #fetch-latest-btn {
  display: inline-block;
  margin: 0 8px 36px 0;
  background: linear-gradient(92deg, #fc7b41 0%, #ffbb44 100%);
  color: #fff;
  border: none;
  padding: 14px 38px;
  font-size: 1.16rem;
  font-weight: 800;
  border-radius: 13px;
  cursor: pointer;
  box-shadow: 0 2px 15px #fda65f44;
  transition: background 0.16s, box-shadow 0.18s;
  text-shadow: 0 1px 1px #bb620d44;
  letter-spacing: 0.01em;
}
#process-btn:hover:not(:disabled), #fetch-latest-btn:hover:not(:disabled),
#process-btn:focus:not(:disabled), #fetch-latest-btn:focus:not(:disabled) {
  background: #ff9800;
  outline: none;
}

.global-message {
  text-align: center;
  font-weight: bold;
  font-size: 1.06em;
  padding: 4px 0 10px 0;
}
#loading { color: #317be8; display: none; }
#error { color: #d91a2a; min-height: 18px; }

.summary-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 30px;
  margin-top: 10px;
}

.summary-minicards-row {
  display: flex;
  gap: 21px;
  justify-content: center;
  margin-bottom: 7px;
  flex-wrap: wrap;
}
.minicard {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 32px 12px 32px;
  background: linear-gradient(112deg, #f5fbff 0%, #d8eefa 100%);
  border-radius: 12px;
  box-shadow: 0 2px 14px #bee8fd22;
  min-width: 108px;
  max-width: 220px;
  border: 1.2px solid #deecf9;
  position: relative;
  margin-bottom: 2px;
}
.minicard-title {
  font-size: 13.7px;
  font-weight: 700;
  color: #1e68c0;
  margin-bottom: 3px;
  letter-spacing: .01em;
}
.minicard-value {
  font-size: 30px;
  color: #055188;
  font-weight: 800;
  letter-spacing: 2px;
}
.minicard-icon {
  position: absolute;
  top: 8px;
  left: 12px;
  font-size: 20px;
  color: #87b8f8;
  opacity: .55;
}

.summary-bar-list {
  margin: 0 auto 0 auto;
  max-width: 490px;
  width: 100%;
  background: #f3faff;
  border-radius: 11px;
  box-shadow: 0 2px 8px #e7f2ff12;
  padding: 16px 18px 11px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.summary-bar-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  font-size: 15px;
  width: 100%;
  padding: 2px 0;
  justify-content: stretch;
}
.summary-bar-label, .summary-bar-count {
  width: 78px;
  flex-shrink: 0;
  flex-basis: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.summary-bar-label {
  color: #2576a1;
  font-weight: 800;
  text-align: right;
  font-size: 1em;
  border-top-right-radius: 7px;
  border-bottom-right-radius: 7px;
  background: #f2faff;
  border-right: 2.5px solid #ecf7ff;
}

.summary-bar-count {
  color: #226abb;
  font-size: 17px;
  font-weight: 800;
  text-align: left;
  letter-spacing: 1px;
  border-top-left-radius: 7px;
  border-bottom-left-radius: 7px;
  background: #f2faff;
  border-left: 2.5px solid #ecf7ff;
}
.summary-bar-outer {
  flex: 1 1 auto;
  background: #e6eefc;
  height: 17px;
  min-width: 0;
  align-items: center;
  display: flex;
  border: 1.2px solid #70c5fe38;
  border-radius: 0;
  margin: 0;
  max-width: none;
}
.summary-bar-inner {
  background: linear-gradient(90deg, #2096f3 33%, #70e9d6 100%);
  height: 100%;
  border-radius: 0;
  transition: width 0.34s;
}

.cards-list-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 21px;
  width: 100%;
}

.type-card {
  box-sizing: border-box;
  width: 100%;
  max-width: 510px;
  min-width: 260px;
  margin: 0 auto 22px auto;
  background: #f4fafd;
  border-radius: 15px;
  box-shadow: 0 2px 16px #2ed1f710;
  padding: 22px 19px 18px 19px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  position: relative;
  transition: box-shadow .17s;
}
.type-card:hover { box-shadow: 0 6px 26px #2e7cd530; }
.typecard-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 11px;
  flex-wrap: wrap;
}
.typecard-title {
  font-weight: bold;
  font-size: 18px;
  color: #0e85d4;
  letter-spacing: 0.002em;
}
.type-total {
  background: #e0f3ff;
  color: #1976d2;
  font-size: 13.1px;
  border-radius: 8px;
  padding: 3.5px 14px;
  margin-right: auto;
}
.typecard-actions {
  margin-bottom: 10px;
  display: flex;
  gap: 13px;
  flex-wrap: wrap;
}
.copy-btn, .download-btn {
  background: linear-gradient(90deg, #88ecd6 65%, #70bcf5 100%);
  border: none;
  border-radius: 9px;
  color: #167;
  font-weight: 800;
  font-size: 14px;
  padding: 7px 17px;
  cursor: pointer;
  box-shadow: 0 2px 10px #4ffbd573;
  transition: box-shadow 0.13s, background 0.15s;
}
.copy-btn:hover:not(:disabled) { background: #5fcdb1; color:#123; }
.download-btn {
  background: linear-gradient(90deg, #b5e0ff 62%, #6ab8f7 110%);
  color:#045;
  box-shadow: 0 2px 9px #b8ebff30;
}
.download-btn:hover:not(:disabled) { background: #6cb8eb; }
.copy-btn:disabled, .download-btn:disabled { opacity: 0.43;}
.expand-switch {
  margin:13px 0 0 0;
  background: #f4f8fa;
  color: #158bd1;
  border: 1.3px solid #b7d2e9;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  padding: 7px 27px;
  cursor: pointer;
  align-self: center;
  transition: border 0.13s, background 0.12s, color 0.14s;
}
.expand-switch.showmode {
  background: #fffbe2 !important;
  color: #fea624 !important;
  border-color: #fec150 !important;
}
.expand-switch:hover { background: #dbe8f7;}
.typecard-content { margin-top:13px; display:none; width:100%; box-sizing: border-box; }

.config-batch-panel {
  background: #f1fbfa;
  border-radius: 10px;
  box-shadow: 0 1px 8px #8bddf124;
  padding: 13px 6px 13px 6px;
  margin: 8px 0 13px 0;
  box-sizing: border-box;
  border: 1.2px solid #e0f3fd;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.config-batch-header {
  font-weight: 800;
  font-size: 13.4px;
  margin-bottom: 5px;
  color: #1c76a7;
}

/* Fixed textarea preview */
.config-preview-box {
  box-sizing: border-box;
  display: block;
  font-family: monospace, consolas, "Fira Mono";
  width: 100vw;
  max-width: 100%;
  min-width: 0;
  font-size: 13px;
  background: #eaf2fe;
  color: #134b77;
  padding: 8px 4px;
  border-radius: 7px;
  border: 1px solid #c4d8f7;
  min-height: 50px;
  max-height: 120px;
  margin-bottom: 7px;
  overflow-y: auto;
  overflow-x: auto;
  white-space: pre-wrap;
  direction: ltr;
  resize: vertical;
  line-height: 1.6;
}

.config-actions-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 6px 0 2px 0;
}

/* Tooltip for copy action */
.copy-tooltip {
  display: none;
  position: fixed;
  z-index: 99999;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #1fd494;
  color: #fff;
  font-size: 15.7px;
  font-weight: 800;
  padding: 14px 26px;
  border-radius: 13px;
  box-shadow: 0 2px 34px #23a27aaa;
  text-align: center;
  opacity: 0.97;
  pointer-events: none;
  white-space: nowrap;
  user-select: none;
  transition: opacity 0.2s;
}

/* Processing status styles */
#processing-status {
  display: none;
  margin-top: 16px;
  text-align: center;
  user-select: none;
  font-weight: 900;
  font-size: 1.4rem;
  color: #1867ae;
  letter-spacing: 0.008em;
  white-space: nowrap;
  direction: rtl;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  min-height: 36px;
}

#processing-icon {
  font-size: 2.6rem;
  color: #0f4497;
  user-select: none;
  transition: color 0.25s ease;
}

#processing-text {
  display: inline-block;
  line-height: 1.1;
}

#processing-timer {
  font-weight: 900;
  font-size: 1.7rem;
  color: #ee7d2f;
  min-width: 38px;
  text-align: right;
}

/* Footer */
footer {
  width: 100%;
  margin: 0;
  padding: 0;
  background: #f5fbff !important;
  border-top: 1.1px solid #e6f4fa;
  margin-top: 45px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.footer-content {
  color: #227;
  font-size: 13px;
  padding: 15px 28px 13px 28px;
  text-align: center;
  opacity: 0.7;
  font-family: Tahoma, 'Vazirmatn', Arial, sans-serif;
  user-select: none;
  margin: 0 auto;
  width: 100%;
  max-width: 700px;
  background: #fff;
  border-radius: 19px;
  box-shadow: 0 1px 7px #b4d1ef17;
  display: block;
}

/* Responsive */
@media (max-width: 700px) {
  main { max-width: 99vw; padding: 11vw 2vw 7vw 2vw; }
  .cards-list-section, .summary-section { gap: 10px;}
  .summary-bar-list { max-width: 99vw; padding: 4vw;}
  .summary-bar-label, .summary-bar-count { font-size: 0.97em;}
  .config-preview-box {
    font-size: 11.3px;
    max-width: 98vw;
    max-height: 70px;
    padding: 3vw 2vw;
  }
  .footer-content { font-size: 11.7px; padding: 11px 8vw 9px 8vw; }
}

@media (max-width: 540px) {
  .minicard { min-width: 67px; padding: 10px 5.5vw; font-size: 13px;}
  .minicard-value { font-size: 10vw; }
  #process-btn, #fetch-latest-btn { padding: 3vw 7vw; font-size: 1em;}
  .type-card { max-width: none; min-width: 0; padding: 15px 2vw;}
  .config-batch-panel { padding-left: 1vw; padding-right: 1vw;}
  .config-preview-box {
    font-size: 10.6px;
    max-height: 52px;
    min-height: 20px;
    padding: 2vw 1vw;
  }
  .footer-content { font-size: 10.5px; padding: 8px 2vw 7px 2vw; }
}
