/* ==========================================
   admin.css — نسخه قبلی + هدر جدید
   ========================================== */

@font-face {
  font-family: Vazir;
  src: url("https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn[wght].woff2") format("woff2");
  font-weight: 100 900;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: #fbfbfa;
  color: #1e293b;
  font-family: Vazir, Tahoma, sans-serif;
  line-height: 1.8;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; }
input, textarea, select { font-family: inherit; font-size: 16px; }
img { max-width: 100%; display: block; }

.container { width: min(1180px, calc(100% - 40px)); margin: auto; }

/* ============ هدر جدید پنل ============ */
.admin-header {
  height: 80px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid #f1e8d2;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.admin-nav-wrap {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 850;
  color: #1e293b;
  flex-shrink: 0;
}

.admin-brand .brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #e7c75c, #b68b19);
  color: white;
  border-radius: 10px;
  font-size: 30px;
  box-shadow: 0 5px 14px rgba(212, 175, 55, 0.25);
  flex-shrink: 0;
}

.admin-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-nav a {
  padding: 9px 16px;
  border-radius: 9px;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
  transition: 0.2s;
  white-space: nowrap;
}

.admin-nav a:hover,
.admin-nav a.active {
  background: #fff8e6;
  color: #a87908;
}

.admin-nav a.admin-link {
  border: 1px solid #d4af37;
  color: #9a7412;
}

.admin-menu-toggle {
  display: none;
  border: 0;
  background: transparent;
  font-size: 25px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  color: #1e293b;
}

/* ============ Main ============ */
.admin-main {
  padding-top: 48px;
  padding-bottom: 70px;
}

.admin-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
  gap: 15px;
  flex-wrap: wrap;
}

.admin-title h1 {
  font-size: 31px;
  line-height: 1.4;
  margin: 3px 0;
  font-weight: 900;
}

.admin-title p,
.table-toolbar p {
  margin: 0;
  color: #94a3b8;
  font-size: 13px;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 4px;
  color: #b28a1e;
  font-weight: 800;
}

/* ============ Stats ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 25px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 17px;
  padding: 22px;
  background: #fff;
  border: 1px solid #edf0f3;
  border-radius: 17px;
  box-shadow: 0 3px 14px rgba(15, 23, 42, 0.03);
}

.stat-icon {
  width: 49px;
  height: 49px;
  display: grid;
  place-items: center;
  background: #fff7df;
  color: #b38b1f;
  border-radius: 13px;
  font-size: 26px;
  flex-shrink: 0;
}

.stat-card p { font-size: 12px; color: #94a3b8; margin: 0; }
.stat-card strong { font-size: 25px; line-height: 1.5; }

/* ============ Table Panel ============ */
.table-panel {
  background: white;
  border: 1px solid #e8ebef;
  border-radius: 19px;
  overflow: hidden;
  box-shadow: 0 5px 20px rgba(15, 23, 42, 0.04);
  margin-bottom: 20px;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 25px;
  border-bottom: 1px solid #edf0f3;
  gap: 12px;
  flex-wrap: wrap;
}

.table-toolbar h2 { font-size: 18px; margin: 0 0 4px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 12px;
  color: #94a3b8;
}

.search-box input {
  font: 13px Vazir;
  border: 0;
  outline: 0;
  width: 180px;
}

.table-scroll { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  white-space: nowrap;
}

thead { background: #f8fafc; color: #64748b; font-size: 12px; }
th { font-weight: 700; padding: 17px 22px; border-bottom: 1px solid #e2e8f0; }
td { padding: 15px 22px; border-bottom: 1px solid #f1f5f9; font-size: 13px; color: #475569; }
tbody tr:hover { background: #fffdf6; }
td strong { display: block; color: #1e293b; font-size: 13px; }
td small { display: block; color: #9ca3af; font-size: 11px; }

.mini-stone {
  display: block;
  width: 53px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  background: #e5e7eb;
}

.status {
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 11px;
  display: inline-block;
}

.active-status { background: #e8f8ef; color: #16834b; }
.hidden-status { background: #f1f5f9; color: #64748b; }

.icon-button {
  border: 1px solid #edf0f3;
  background: white;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  margin-left: 5px;
  cursor: pointer;
  color: #64748b;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.icon-button.edit:hover { color: #2563eb; background: #eff6ff; }
.icon-button.delete:hover { color: #dc2626; background: #fef2f2; }

.table-bottom {
  padding: 15px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #94a3b8;
  font-size: 12px;
  gap: 12px;
  flex-wrap: wrap;
}

.pagination { display: flex; gap: 5px; }

.pagination button {
  border: 1px solid #e2e8f0;
  background: white;
  border-radius: 7px;
  min-width: 31px;
  height: 31px;
  color: #64748b;
  cursor: pointer;
}

.pagination button.selected {
  background: #d4af37;
  border-color: #d4af37;
  color: white;
}

.notice {
  margin-top: 20px;
  color: #94a3b8;
  font-size: 12px;
  text-align: center;
}

/* ============ Form ============ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full { grid-column: 1 / -1; }

.form-group label {
  font-weight: 700;
  font-size: 13px;
  color: #1e293b;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 12px 14px;
  border: 1.5px solid #e2e0dc;
  border-radius: 11px;
  font: inherit;
  font-size: 15px;
  background: #fbfbfa;
  transition: 0.2s;
  min-height: 46px;
  box-sizing: border-box;
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #d4af37;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15);
}

/* ============ Upload Box ============ */
.upload-box {
  border: 2px dashed #e2e0dc;
  border-radius: 14px;
  padding: 22px 18px;
  text-align: center;
  background: #fbfbfa;
  cursor: pointer;
  transition: 0.2s;
  margin-top: 8px;
  display: block;
  position: relative;
}

.upload-box:hover,
.upload-box.dragover {
  border-color: #d4af37;
  background: #fffdf6;
}

.upload-box input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-box .ico { font-size: 32px; margin-bottom: 8px; line-height: 1; }
.upload-box .txt { font-size: 14px; font-weight: 700; color: #1e293b; }
.upload-box .hint { font-size: 12px; color: #94a3b8; margin-top: 4px; line-height: 1.6; }

/* ============ Preview ============ */
.preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.preview-item {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: 10px;
  overflow: hidden;
  background: #f0efed;
  border: 1px solid #e2e0dc;
}

.preview-item img,
.preview-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-item .size-tag {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
}

.preview-item .type-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(212, 175, 55, 0.95);
  color: #fff;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 700;
}

.preview-item .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  z-index: 3;
}

/* ============ Upload Progress ============ */
.upload-progress {
  background: #fff;
  border: 1px solid #edf0f3;
  border-radius: 14px;
  padding: 16px;
  margin-top: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.upload-progress .title {
  font-size: 13px;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.upload-progress .bar-wrap {
  height: 10px;
  background: #f0efed;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}

.upload-progress .bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #c49b2b, #e2c457);
  border-radius: 6px;
  transition: width 0.2s ease;
}

.upload-progress .detail {
  font-size: 12px;
  color: #64748b;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

/* ============ Alerts ============ */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 700;
}

.alert--success { background: #e8f8ef; color: #16834b; border-right: 4px solid #10b981; }
.alert--error { background: #fee; color: #991b1b; border-right: 4px solid #ef4444; }

/* ============ Flags & Country ============ */
.flag-icon {
  display: inline-block;
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  background: #f1f5f9;
}

.country-cell { display: flex; align-items: center; gap: 6px; min-width: 0; }
.country-cell span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.countries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.country-card {
  background: #fff;
  border: 1px solid #edf0f3;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: 0.2s;
}

.country-card:hover {
  border-color: #d4af37;
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.1);
  transform: translateY(-2px);
}

.country-card img {
  width: 38px;
  height: 26px;
  object-fit: cover;
  border-radius: 5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.country-card .info { min-width: 0; flex: 1; }

.country-card .name {
  font-weight: 800;
  font-size: 13px;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.country-card .count {
  color: #b38b1f;
  font-weight: 900;
  font-size: 16px;
  line-height: 1.1;
}

/* ============ Login ============ */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #f5f6f7, #e8eef3);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 20px;
  padding: 36px 28px;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.15);
  border: 1px solid #edf0f3;
}

.login-card h1 {
  font-size: 20px;
  font-weight: 900;
  color: #1e293b;
  margin: 0 0 20px;
  text-align: center;
}

.login-card input {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid #e2e0dc;
  border-radius: 10px;
  font: inherit;
  font-size: 15px;
  background: #fbfbfa;
  margin-bottom: 12px;
  box-sizing: border-box;
  min-height: 46px;
}

.login-card input:focus {
  outline: none;
  border-color: #d4af37;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15);
}

.login-card button {
  width: 100%;
  padding: 13px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(110deg, #c49b2b, #e2c457);
  color: #fff;
  font: 700 15px Vazir;
  cursor: pointer;
  min-height: 48px;
  transition: 0.2s;
}

.login-card button:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.login-error {
  background: #fee;
  color: #991b1b;
  padding: 11px 14px;
  border-radius: 9px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  border-right: 4px solid #ef4444;
}

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; gap: 14px; }
}

@media (max-width: 768px) {
  .container { width: calc(100% - 28px); }

  .admin-header { height: 68px; }
  .admin-nav-wrap { width: calc(100% - 28px); margin: 0 auto; }
  .admin-brand { font-size: 18px; }
  .admin-brand .brand-mark { width: 37px; height: 37px; font-size: 26px; }

  .admin-menu-toggle { display: block; }

  .admin-nav {
    display: none;
    position: absolute;
    top: 67px;
    right: 0;
    left: 0;
    background: white;
    padding: 12px 18px 18px;
    border-bottom: 1px solid #f1e8d2;
    flex-direction: column;
    align-items: stretch;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-radius: 0 0 14px 14px;
  }

  .admin-nav.open { display: flex; }
  .admin-nav a { padding: 10px; text-align: center; }

  .admin-main { padding-top: 30px; }
  .admin-title { flex-direction: column; align-items: stretch; gap: 12px; }
  .admin-title h1 { font-size: 27px; }

  .stats-grid { grid-template-columns: 1fr; gap: 10px; }
  .stat-card { padding: 15px; }

  .table-toolbar { flex-direction: column; align-items: stretch; gap: 15px; }
  .search-box, .search-box input { width: 100%; }

  .table-bottom { flex-direction: column; gap: 12px; align-items: flex-start; }

  .preview-list { grid-template-columns: repeat(2, 1fr); }
  .upload-box { padding: 18px 12px; }
  .upload-box .ico { font-size: 28px; }
  .upload-box .txt { font-size: 13px; }

  .countries-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .country-card { padding: 10px; gap: 8px; }
  .country-card img { width: 30px; height: 22px; }
  .country-card .name { font-size: 11px; }
  .country-card .count { font-size: 14px; }
}

@media (max-width: 480px) {
  .countries-grid { grid-template-columns: 1fr; }
  .country-card { padding: 12px; }
  .country-card img { width: 34px; height: 24px; }
  .country-card .name { font-size: 12px; }
  .country-card .count { font-size: 15px; }
}