@import url("https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;700&display=swap");

:root {
  --primary-color: #007bff;
  --secondary-color: #6c757d;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: rgb(240, 64, 64);
  --info-color: #17a2b8;
  --light-color: #f8f9fa;
  --dark-color: #343a40;
  --bg-color: #f0f2f5;
  --font-family: "Vazirmatn", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--dark-color);
  line-height: 1.6;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 15px;
}

.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

header .header-icon {
  font-size: 1.5rem;
  color: var(--primary-color);
}

header h1 {
  color: var(--dark-color);
  font-weight: 700;
  font-size: 1.4rem;
}

.card {
  background: #fff;
  padding: 0.5rem;
  border-radius: 12px;
  box-shadow: 0 2px 5px dimgray;
  margin-bottom: 8px;
}

.input-label {
  display: block;
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
  text-align: center;
}

#username-input {
  width: 100%;
  padding: 0 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-family: var(--font-family);
  font-size: 1.8rem;
  font-weight: 500;
  margin-bottom: 1rem;
  text-align: center;
  letter-spacing: 1px;
}

#username-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}
#final-message-payment-info {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}
#final-message-payment-info i {
  font-size: 1.2rem;
  margin-left: 8px;
  vertical-align: text-top;
}
#check-status-btn {
  width: 100%;
  padding: 12px 20px;
  border: none;
  background-color: var(--primary-color);
  color: #fff;
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 0.3s;
}

#check-status-btn:hover {
  background-color: #0056b3;
}

.hidden {
  display: none !important;
}

#service-info,
#package-selection {
  background: #fff;
  padding: 0.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
  margin-top: 0.5rem;
  animation: fadeIn 0.5s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.info-item {
  background-color: var(--light-color);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  text-align: center;
}

.info-item-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-bottom: 4px;
}

.info-item-header i {
  font-size: 0.9rem;
}

.info-item-header span {
  font-size: 0.75rem;
  color: var(--secondary-color);
  font-weight: 500;
}

.info-item strong {
  font-size: 1rem;
  font-weight: 700;
  display: block;
  color: var(--dark-color);
}

.info-item-username {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 5px;
}

.info-item-username strong {
  display: inline;
  font-size: 1.1rem;
  letter-spacing: 1.5px;
}

.info-item-username i {
  font-size: 1.1rem;
}

.icon-user {
  color: var(--secondary-color);
}

.icon-total {
  color: var(--primary-color);
}
.icon-remaining {
  color: var(--success-color);
}
.icon-expiry {
  color: var(--warning-color);
}
.icon-days {
  color: var(--info-color);
}

.alert {
  padding: 0.25rem 1rem;
  border-radius: 8px;
  text-align: center;
  margin-bottom: 0.5rem;
  font-weight: 700;
  font-size: 0.9rem;
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  display: block;
  align-items: center;
  animation: fadeIn 0.5s;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  padding-top: 0.5rem;
}

.btn-action {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.btn-renew {
  background-color: var(--success-color);
}
.btn-renew:hover {
  background-color: #218838;
}

.btn-add-volume {
  background-color: var(--info-color);
}
.btn-add-volume:hover {
  background-color: #138496;
}

#package-selection h3 {
  text-align: center;
  margin-bottom: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
}

.package-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.package-item {
  padding: 0.25rem 1rem;
  border: 2px solid #eee;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}

.package-item:hover {
  border-color: var(--primary-color);
  background-color: #e7f3ff;
}

.package-item.selected {
  border-color: darkmagenta;
  background-color: darkmagenta; /* MODIFIED: Using primary color for consistency */
  color: #fff;
  box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
}

.package-item .volume {
  font-size: 1rem;
  font-weight: 700;
}

.package-item .price {
  font-size: 0.85rem;
  color: var(--secondary-color);
}

.package-item.selected .price {
  color: #fff;
  opacity: 0.9;
}

.payment-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.btn-payment {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

#online-payment-btn {
  background-color: var(--success-color);
}
#card-payment-btn {
  background-color: var(--primary-color);
}

.btn-payment:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: #fff;
  padding: 1.5rem;
  border-radius: 15px;
  width: 100%;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* ADDED: Specific style for the final message modal text container */
#final-message-text {
  text-align: right; /* Ensure text inside is right-aligned */
}

.modal-content p {
  margin-bottom: 0.5rem;
  text-align: center;
}
.modal-content strong {
  color: #0056b3;
  font-size: 1.2rem;
}

.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.modal-content button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-family: var(--font-family);
  font-size: 1rem;
  cursor: pointer;
  flex: 1;
}

.modal-close-btn {
  background-color: var(--primary-color);
  color: #fff;
}

.btn-success {
  background-color: var(--success-color);
  color: #fff;
}
.btn-danger {
  background-color: var(--danger-color);
  color: #fff;
}

/* Loading Modal Styles */
#loading-modal {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 2000;
}

.loading-spinner {
  border: 8px solid #f3f3f3;
  border-top: 8px solid var(--primary-color);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1.5s linear infinite;
}

.loading-text {
  color: white;
  margin-top: 20px;
  font-size: 1.2rem;
  font-weight: bold;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.alert ul {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: right;
}

.alert ul li {
  margin-bottom: 5px;
}

.alert ul li:last-child {
  margin-bottom: 0;
}
.alert::before {
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  content: "\f071";
  font-size: 1.2rem;
  color: var(--danger-color);
  margin-left: 10px;
  animation: fadeWarning 1s ease-in-out infinite;
}
/* Styles for Confirmation Modal Details */
.confirmation-details {
  text-align: right;
  background-color: var(--light-color);
  padding: 0.5rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid #e9ecef;
}

.confirmation-details p {
  margin-bottom: 0.5rem;
  font-size: 1rem;
  color: #333;
  text-align: right !important;
}

.confirmation-details p:last-child {
  margin-bottom: 0;
}

.confirmation-details strong {
  color: var(--primary-color);
}

/* MODIFIED: Improved .modal-warning style */

.modal-warning .fas,
.modal-warning .fa-exclamation-triangle {
  font-size: 1.5em;
}
.modal-warning .fa-info-circle {
  font-size: 1.5em;
  color: blue;
}
.input-card{
  background-color: #d5d5d5;
}
/* Desktop Styles */
@media (min-width: 768px) {
  .alert {
    display: block;
  }
  .btn-action {
    max-width: 50%;
  }
  .container {
    max-width: 600px;
  }
  .info-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .btn-payment {
    max-width: 50%;
  }
  #username-input,
  #check-status-btn,
  #alert-message,
  .info-item-username {
    width: 50%;
    margin-left: auto;
    margin-right: auto;
    display: block;
  }

  #check-status-btn {
    display: block;
  }

  .input-label {
    text-align: center;
  }

}

/* =============================================== */
/* === Styles for Admin Note in Final Modal    === */
/* =============================================== */

.admin-note {
  text-align: right;
  background-color: #f0f8ff; /* A light blue background */
  padding: 0.3rem;
  border-radius: 8px;
  margin: 1rem 0; /* Add space above and below */
  border: 1px solid #b8daff;
  font-size: 0.95rem;
  line-height: 1.7;
}

.admin-note p {
  margin-bottom: 0 !important; /* Override default paragraph margin */
  text-align: center;
  font-size: 0.8rem;
}
/* ============================================= */
/* === استایل‌های بخش نتایج جستجوی چندگانه === */
/* ============================================= */

#search-results-container {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background-color: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.results-header {
  font-size: 1rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
  text-align: center;
}

#search-results-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.search-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #f9f9f9;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  font-size: 1rem;
  direction: ltr;
}

.search-result-item:hover {
  background-color: #e2e6ea;
  border-color: var(--primary-color);
}

.search-result-item span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.search-result-item span i {
  color: #007bff;
}

.search-result-item:hover .result-username,
.search-result-item:hover .result-servername {
  color: #0056b3;
}

.search-result-item i {
  color: #007bff;
}
/* ============================================= */
/* === استایل‌های هدر مودال نهایی کاربر === */
/* ============================================= */

#final-message-modal .modal-content h3 {
  padding: 3px 15px;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 10px; /* فاصله بین آیکون و متن */
}

#final-message-modal .modal-content h3.msg-success {
  background-color: #d4edda; /* سبز روشن */
  color: #155724; /* سبز تیره */
  border: 1px solid #c3e6cb;
}

#final-message-modal .modal-content h3.msg-error {
  background-color: #f8d7da; /* قرمز روشن */
  color: #721c24; /* قرمز تیره */
  border: 1px solid #f5c6cb;
}

#final-message-modal .modal-content h3.msg-info {
  background-color: #d1ecf1; /* آبی روشن */
  color: #0c5460; /* آبی تیره */
  border: 1px solid #bee5eb;
}
#final-message-admin-note {
  font-size: 1rem;
}
#final-message-admin-note p {
  display: grid;
}

@keyframes fadeWarning {
  0%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}
#final-message-warning i {
  animation: fadeWarning 1s ease-in-out infinite;
}

#confirm-warning-text {
  color: rgb(223, 145, 0);
}
/* ============================================= */
/* === استایل برای آیتم‌های منقضی شده === */
/* ============================================= */
#volume-item-box,
#days-item-box {
  background-color: #edfaf0; /* سبز بسیار روشن */
  border-color: #c3e6cb;
  transition: background-color 0.3s ease, border-color 0.3s ease; /* انیمیشن نرم برای تغییر رنگ */
}
.info-item.expired-item {
  background-color: #fdf1f2 !important; /* قرمز بسیار روشن */
  border-color: #fcdade !important;
}

/* 
  یک wrapper برای آیکون که به تراز شدن کمک می‌کند
  و از به هم ریختگی جلوگیری می‌کند.
*/
.icon-wrapper {
  display: inline-flex; /* باعث می‌شود آیکون به درستی تراز شود */
  align-items: center;
  justify-content: center;
  flex-shrink: 0; /* از کوچک شدن آیکون جلوگیری می‌کند */
}

.modal-warning .fa-info-circle {
  color: #004085; /* آبی تیره */
}
/* ============================================= */
/* ============ استایل فوتر سایت (Updated) ============ */
/* ============================================= */

html {
  height: 100%;
}

body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.container {
  flex: 1 0 auto;
}

.site-footer {
  background-color: var(--dark-color);
  color: #bdc3c7; /* کمی روشن‌تر برای کنتراست بهتر */
  padding: 15px 0;
  text-align: center;
  font-size: 0.9rem;
  width: 100%;
  flex-shrink: 0;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  align-self: center;
  max-width: 400px;
}

.footer-content {
  margin: 0 auto;
  padding: 0 10px 0 0;
  display: grid;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
}
.agent-footer-content {
  margin: 0 auto;
  padding: 0 10px 0 0;
  display: grid;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10;
}
.agent-footer-content strong {
  font-size: 1.5rem;
  color: lightblue;
}
.agent-footer-content span {
  font-size: 1rem;
  color: lightgrey;
}
.footer-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-family);
}

.footer-item i {
  color: #f6f6f7;
  font-size: 1.2em;
}

.site-footer a {
  color: #b0d6f0;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease-in-out;
  padding: 4px 8px;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.05); /* یک پس‌زمینه بسیار محو */
  margin-left: 15px;
}

.site-footer a:hover {
  color: #b6d1e4;
  background-color: rgba(255, 255, 255, 0.1);
}

/* استایل برای چپ‌چین کردن شماره تلفن */
.ltr-link {
  direction: ltr;
  unicode-bidi: bidi-override;
}

.modal-warning {
  display: flex; /* برای تراز کردن آیکون و متن */
  align-items: center;
  gap: 10px; /* فاصله بین آیکون و متن */
  color: var(--warning-color); /* رنگ متن */
  border: 1px solid #ffeeba; /* حاشیه */
  padding: 12px 15px; /* پدینگ داخلی */
  border-radius: 8px;
  margin-top: 1rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: right;
  background-color: #fdf9ec;
}

/* 
  این استایل برای پاراگراف‌های هشدار در مودال نهایی است.
  این بخش صحیح بود و بدون تغییر باقی می‌ماند.
*/
p.flex-warning {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  /* این پاراگراف استایل‌های رنگ و پس‌زمینه را از والد خود (.modal-warning در HTML) به ارث می‌برد */
}

/* 
  یک wrapper برای آیکون که به تراز شدن کمک می‌کند.
  این بخش صحیح بود و بدون تغییر باقی می‌ماند.
*/
.icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* 
  رنگ آیکون‌ها برای خوانایی بهتر.
  این بخش صحیح بود و بدون تغییر باقی می‌ماند.
*/

.modal-warning .fa-info-circle {
  color: blue;
}
/* استایل برای هشدار سرویس غیرفعال */
.alert.alert-danger {
  background-color: #dc3545; /* قرمز اصلی */
  color: #ffffff; /* متن سفید */
  border-color: #bd2130;
  font-weight: 700;
}

.alert.alert-danger::before {
  content: "\f05e"; /* آیکون ban (ممنوع) */
  color: #ffffff;
}

/* ================================================== */
/* === START: ADDITIONS FOR NEW FEATURES          === */
/* ================================================== */

/* --- Request 2: Loading Modal Position --- */
/* Overriding the existing modal style to change alignment */
#loading-modal {
  justify-content: flex-start; /* Align items to the top */
  padding-top: 15vh; /* Add space from the top edge */
}

/* --- Request 3: Styles for Help Image Modal --- */
.help-image-content {
  max-width: 90vw; /* Allow modal to be wider on small screens */
  max-height: 90vh;
  overflow-y: auto;
}

/* Set a max-width for larger screens */
@media (min-width: 768px) {
  .help-image-content {
    max-width: 600px;
  }
}

#help-image-viewer {
  max-width: 100%; /* Make the image responsive inside the modal */
  height: auto;
  border-radius: 8px;
  border: 1px solid #ddd;
  margin-top: 1rem;
}

/* Container for the help link shown in the error message */
.help-link-container {
  margin-top: 1rem;
  text-align: center;
}

/* The "How to find username" link style */
#show-help-image-btn {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 5px;
  transition: background-color 0.2s;
}

#show-help-image-btn:hover {
  background-color: #e7f3ff;
  text-decoration: underline;
}

/* ================================================== */
/* === END: ADDITIONS FOR NEW FEATURES            === */
/* ================================================== */
.search-result-item.expired-result {
  background-color: #f8d7da; /* Light red background */
  border-color: #f5c6cb;
  color: #721c24; /* Dark red text */
}

.search-result-item.expired-result:hover {
  background-color: #f1b0b7; /* Slightly darker red on hover */
}

.search-result-item.expired-result span i {
  color: #dc3545; /* Red icon */
}

.warning-icon {
  color: #dc3545; /* Red warning icon */
  margin-right: 8px; /* Space between icon and username */
}

/* ======================================================== */
/* === START: Responsive Height for Final Message Modal === */
/* ======================================================== */

/*
  مرحله ۱: تغییر در تراز عمودی خود overlay
  به جای مرکزیت کامل (align-items: center)، آن را به بالا می‌چسبانیم
  و با padding کمی فاصله از بالا ایجاد می‌کنیم تا همیشه از بالا قابل مشاهده باشد.
*/
#final-message-modal.modal-overlay {
  align-items: flex-start; /* مودال را به بالای صفحه می‌چسباند */
  padding-top: 5vh;      /* 5 درصد از ارتفاع صفحه، از بالا فاصله می‌دهد */
  padding-bottom: 5vh;   /* فاصله از پایین برای اطمینان از دیده شدن دکمه‌ها */
}

/*
  مرحله ۲: محدود کردن ارتفاع و افزودن اسکرول
  حداکثر ارتفاع مودال را به 90 درصد ارتفاع صفحه محدود می‌کنیم.
  اگر محتوا بیشتر بود، اسکرول عمودی فعال می‌شود.
*/
#final-message-modal .modal-content {
  max-height: 90vh; /* حداکثر ارتفاع: 90% ارتفاع viewport */
  overflow-y: auto;  /* اگر محتوا بیشتر شد، اسکرول عمودی نمایش داده شود */
}

/* 
  یک استایل کوچک برای خوانایی بهتر در موبایل:
  پدینگ داخلی مودال را در صفحه‌های خیلی کوچک کمی کاهش می‌دهیم
  تا فضای بیشتری برای محتوا باقی بماند.
*/
@media (max-height: 600px) {
  #final-message-modal .modal-content {
    padding: 1rem;
  }
}

/* ====================================================== */
/* === END: Responsive Height for Final Message Modal === */
/* ====================================================== */