/* ===== iamUSD — News / Admin / Education pages =====
   این فایل جدا از style.css اصلیه و چیزی رو توش عوض نمی‌کنه.
   فقط از توکن‌های رنگی/فونت style.css استفاده می‌کنه. */

.news-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 32px;
}
@media (max-width: 760px) {
  .news-grid { grid-template-columns: 1fr; }
}

.news-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.news-card .news-date {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent-2);
}
.news-card h3 { font-size: 1.1rem; }
.news-card .news-excerpt { color: var(--muted); font-size: 0.92rem; line-height: 1.8; }
.news-card .news-body {
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.9;
  display: none;
  border-top: 1px solid var(--glass-border);
  padding-top: 12px;
  margin-top: 4px;
}
.news-card.expanded .news-body { display: block; }
.news-card .news-toggle {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--accent-2);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
}

.news-empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  border: 1px dashed var(--glass-border);
  border-radius: 16px;
  margin-top: 24px;
}

/* ===== Admin gate ===== */
.admin-gate-wrap {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.admin-gate-wrap::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 380px;
  height: 260px;
  background: var(--accent-grad);
  filter: blur(90px);
  opacity: 0.28;
  z-index: 0;
  pointer-events: none;
}
.admin-gate-wrap .glass {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
  animation: gate-in 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes gate-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.admin-gate-wrap h2 {
  font-size: 1.35rem;
  text-align: center;
  margin-bottom: 6px;
}
.admin-gate-wrap > .glass > p {
  text-align: center;
}

.admin-field { margin-bottom: 18px; }
.admin-field label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 7px; }
.admin-field input, .admin-field textarea {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: 11px;
  padding: 12px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.admin-field input:focus, .admin-field textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 3px rgba(34,211,238,0.15);
}
.admin-field textarea { resize: vertical; min-height: 90px; }

.admin-error {
  color: #f87171;
  font-size: 0.85rem;
  margin-top: 4px;
  display: none;
}
.admin-error.show { display: block; animation: shake 0.35s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.admin-gate-wrap .btn {
  width: 100%;
  justify-content: center;
  padding: 13px;
  font-size: 0.98rem;
  border-radius: 12px;
  transition: transform 0.15s, border-color 0.15s;
}
.admin-gate-wrap .btn:hover { transform: translateY(-1px); }
.admin-gate-wrap .btn:active { transform: translateY(0); }

.admin-gate-wrap .form-note {
  text-align: center;
  line-height: 1.9;
}
.admin-gate-wrap .form-note code {
  background: rgba(255,255,255,0.08);
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--accent-2);
}

/* ===== Admin panel ===== */
.admin-panel-wrap {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 28px;
  align-items: start;
  animation: gate-in 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
@media (max-width: 860px) { .admin-panel-wrap { grid-template-columns: 1fr; } }

.admin-form-card, .admin-list-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 18px;
  padding: 26px;
  box-shadow: 0 10px 32px rgba(0,0,0,0.25);
}
.admin-form-card h3, .admin-list-card h3 {
  margin-bottom: 18px;
  font-size: 1.08rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-form-card h3::before { content: "✎"; color: var(--accent-2); }
.admin-list-card h3::before { content: "🗞"; }

.admin-form-card .btn { border-radius: 11px; padding: 11px 20px; transition: transform 0.15s; }
.admin-form-card .btn:hover { transform: translateY(-1px); }

.admin-news-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 4px;
  border-bottom: 1px solid var(--glass-border);
  transition: background 0.15s;
  border-radius: 8px;
}
.admin-news-item:hover { background: rgba(255,255,255,0.02); }
.admin-news-item:last-child { border-bottom: none; }
.admin-news-item .info { flex: 1; }
.admin-news-item .info .t { font-weight: 600; margin-bottom: 4px; }
.admin-news-item .info .d { font-size: 0.78rem; color: var(--muted); font-family: var(--mono); }
.admin-news-item .actions { display: flex; gap: 8px; flex-shrink: 0; }
.admin-news-item .actions button {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: 9px;
  padding: 7px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, transform 0.15s;
}
.admin-news-item .actions button:hover { border-color: var(--accent-2); color: var(--accent-2); transform: translateY(-1px); }
.admin-news-item .actions button.danger:hover { border-color: #f87171; color: #f87171; }

.admin-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; }
.admin-toolbar h3 { margin: 0; }
.admin-toolbar input {
  max-width: 220px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
}
.admin-toolbar input:focus { outline: none; border-color: var(--accent-2); }


/* ===== Education placeholder ===== */
.edu-placeholder {
  text-align: center;
  padding: 80px 20px;
  border: 1px dashed var(--glass-border);
  border-radius: 16px;
  color: var(--muted);
  margin-top: 24px;
}


/* ===== Homepage news — clean text list (no cards) ===== */
.home-news-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 28px;
  border-top: 1px solid var(--glass-border);
}

.home-news-item {
  padding: 22px 4px 22px 0;
  border-bottom: 1px solid var(--glass-border);
  transition: background 0.15s;
}

.home-news-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.home-news-date {
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent-2);
  margin-bottom: 8px;
}

.home-news-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.12rem;
  line-height: 1.55;
  margin-bottom: 8px;
  color: var(--text);
}

.home-news-excerpt {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.85;
  max-width: 70ch;
}

@media (max-width: 760px) {
  .home-news-item {
    padding: 18px 0;
  }
  .home-news-title {
    font-size: 1.02rem;
  }
  .home-news-excerpt {
    font-size: 0.88rem;
  }
}


/* ===== Mobile polish for admin & news ===== */
@media (max-width: 520px) {
  .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .admin-toolbar input {
    max-width: none;
    width: 100%;
  }
  .admin-news-item {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .admin-news-item .actions {
    justify-content: flex-start;
  }
}


/* ===== Admin shell / gate visibility (critical for login) ===== */
#adminGate[hidden],
#adminShell[hidden] {
  display: none !important;
}
#adminShell:not([hidden]) {
  display: block;
  min-height: 100vh;
}


/* ===== Mobile news typography only ===== */
@media (max-width: 760px) {
  .news-card h3 { font-size: 1rem; }
  .news-card .news-excerpt,
  .news-card .news-body { font-size: 0.86rem; line-height: 1.75; }
  .news-card .news-date { font-size: 0.72rem; }
  .news-card { padding: 16px; }

  .home-news-title { font-size: 0.98rem; line-height: 1.5; }
  .home-news-excerpt { font-size: 0.86rem; line-height: 1.75; }
  .home-news-date { font-size: 0.72rem; }
  .home-news-item { padding: 16px 0; }

  /* Admin panel — compact on mobile */
  .admin-gate-wrap { padding: 16px; min-height: 100vh; }
  .admin-gate-wrap .glass {
    padding: 22px 18px;
    border-radius: 14px;
    max-width: 100%;
  }
  .admin-gate-wrap h2 { font-size: 1.05rem; margin-bottom: 4px; }
  .admin-gate-wrap > .glass > p,
  .admin-gate-wrap .form-note { font-size: 0.75rem !important; line-height: 1.7; }
  .admin-gate-wrap .form-note { margin-top: 12px !important; padding: 10px 12px; }
  .admin-gate-wrap .btn {
    font-size: 0.88rem;
    padding: 11px;
    margin-top: 10px !important;
  }
  .admin-field { margin-bottom: 12px; }
  .admin-field label { font-size: 0.78rem; margin-bottom: 5px; }
  .admin-field input,
  .admin-field textarea {
    font-size: 0.88rem;
    padding: 10px 12px;
    border-radius: 9px;
  }
  .admin-field textarea { min-height: 70px; }
  .admin-error { font-size: 0.78rem; }

  .admin-panel-wrap { gap: 16px; }
  .admin-form-card,
  .admin-list-card {
    padding: 16px 14px;
    border-radius: 12px;
  }
  .admin-form-card h3,
  .admin-list-card h3,
  .admin-toolbar h3 {
    font-size: 0.95rem;
    margin-bottom: 12px;
  }
  .admin-form-card .btn {
    font-size: 0.85rem;
    padding: 9px 14px;
  }
  .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 12px;
  }
  .admin-toolbar input {
    max-width: none;
    width: 100%;
    font-size: 0.85rem;
    padding: 8px 10px;
  }
  .admin-news-item {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 2px;
  }
  .admin-news-item .info .t { font-size: 0.88rem; }
  .admin-news-item .info .d { font-size: 0.72rem; }
  .admin-news-item .actions { gap: 6px; }
  .admin-news-item .actions button {
    font-size: 0.75rem;
    padding: 6px 10px;
  }
}

@media (max-width: 480px) {
  .home-news-title { font-size: 0.92rem; }
  .news-card h3 { font-size: 0.95rem; }

  .admin-gate-wrap .glass { padding: 18px 14px; }
  .admin-gate-wrap h2 { font-size: 0.98rem; }
  .admin-form-card,
  .admin-list-card { padding: 14px 12px; }
  .admin-form-card h3,
  .admin-list-card h3 { font-size: 0.9rem; }
  .admin-field input,
  .admin-field textarea { font-size: 0.85rem; padding: 9px 10px; }
  .admin-news-item .info .t { font-size: 0.84rem; }
  .admin-news-item .actions button { font-size: 0.72rem; padding: 5px 8px; }
}


/* ===== Admin theme toggle + light mode (admin page only) ===== */
.admin-theme-toggle {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 300;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.admin-theme-toggle:hover {
  transform: scale(1.06);
  border-color: var(--accent-2);
}
.admin-theme-toggle .theme-icon { font-size: 1.15rem; line-height: 1; }
.admin-theme-toggle .theme-icon-sun { display: none; }
html.admin-light .admin-theme-toggle .theme-icon-moon { display: none; }
html.admin-light .admin-theme-toggle .theme-icon-sun { display: inline; }

.admin-page .admin-gate-sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 22px;
}
.admin-page .admin-gate-note {
  margin-top: 18px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ---- Light theme: clean white panel, site accents kept ---- */
html.admin-light body.admin-page {
  background: #f4f6fb;
  color: #1a1f2e;
}
html.admin-light body.admin-page::before,
html.admin-light body.admin-page::after {
  opacity: 0.12;
}

html.admin-light .admin-page .nav {
  background: rgba(255, 255, 255, 0.92);
  border-bottom-color: #e2e6ef;
}
html.admin-light .admin-page .brand,
html.admin-light .admin-page .nav-links a {
  color: #5a6478;
}
html.admin-light .admin-page .nav-links a:hover,
html.admin-light .admin-page .nav-links a:focus-visible {
  color: #1a1f2e;
  background: #eef1f7;
}
html.admin-light .admin-page .nav-links a.active {
  color: #fff;
  background: linear-gradient(135deg, #8B5CF6, #22D3EE);
}

html.admin-light .admin-page .section-head h2,
html.admin-light .admin-page .admin-form-card h3,
html.admin-light .admin-page .admin-list-card h3,
html.admin-light .admin-page .admin-toolbar h3 {
  color: #1a1f2e;
}
html.admin-light .admin-page .section-head p,
html.admin-light .admin-page .eyebrow {
  color: #6b7385;
}
html.admin-light .admin-page .eyebrow {
  color: #7c3aed;
}

html.admin-light .admin-gate-wrap .glass,
html.admin-light .admin-form-card,
html.admin-light .admin-list-card {
  background: #ffffff;
  border-color: #e2e6ef;
  box-shadow: 0 10px 36px rgba(26, 31, 46, 0.08);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

html.admin-light .admin-gate-wrap::before {
  opacity: 0.18;
}

html.admin-light .admin-field label {
  color: #6b7385;
}
html.admin-light .admin-field input,
html.admin-light .admin-field textarea,
html.admin-light .admin-toolbar input {
  background: #f7f8fc;
  border-color: #dce1ec;
  color: #1a1f2e;
}
html.admin-light .admin-field input:focus,
html.admin-light .admin-field textarea:focus,
html.admin-light .admin-toolbar input:focus {
  border-color: #22D3EE;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
}

html.admin-light .admin-page .btn-gold,
html.admin-light .admin-page .btn-ghost {
  background: #f7f8fc;
  border-color: #dce1ec;
  color: #1a1f2e;
}
html.admin-light .admin-page .btn-gold:hover,
html.admin-light .admin-page .btn-ghost:hover {
  border-color: #22D3EE;
  color: #0891b2;
  background: rgba(34, 211, 238, 0.08);
}

html.admin-light .admin-news-item {
  border-bottom-color: #e8ecf4;
}
html.admin-light .admin-news-item:hover {
  background: #f7f8fc;
}
html.admin-light .admin-news-item .info .t {
  color: #1a1f2e;
}
html.admin-light .admin-news-item .info .d {
  color: #8b94a7;
}
html.admin-light .admin-news-item .actions button {
  background: #f7f8fc;
  border-color: #dce1ec;
  color: #1a1f2e;
}
html.admin-light .admin-news-item .actions button:hover {
  border-color: #22D3EE;
  color: #0891b2;
}
html.admin-light .admin-news-item .actions button.danger:hover {
  border-color: #f87171;
  color: #dc2626;
}

html.admin-light .news-empty {
  color: #6b7385;
  border-color: #dce1ec;
  background: #fafbfe;
}

html.admin-light .form-note {
  background: #f7f8fc;
  border-color: #e2e6ef;
  color: #6b7385;
}
html.admin-light .form-note code {
  background: #eef1f7;
  color: #0891b2;
}

html.admin-light .admin-theme-toggle {
  background: #ffffff;
  border-color: #e2e6ef;
  color: #1a1f2e;
  box-shadow: 0 6px 20px rgba(26, 31, 46, 0.1);
}

html.admin-light .admin-page .skip-link { color: #1a1f2e; }

@media (max-width: 760px) {
  .admin-theme-toggle {
    top: 12px;
    left: 12px;
    width: 40px;
    height: 40px;
  }
}
