:root {
  --bg: #f6f4ef;
  --bg-alt: #fff8ed;
  --ink: #2a2a2a;
  --muted: #6d6a64;
  --accent: #2e7d6f;
  --accent-2: #e6b250;
  --card: #ffffff;
  --line: #e2ddd4;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  direction: rtl;
  font-size: 16px;
}

body {
  margin: 0;
  font-family: "Vazirmatn", "Tahoma", sans-serif;
  background: #f6f4ef;
  background: radial-gradient(1200px 600px at 10% 10%, #fff2d9, transparent 60%),
    radial-gradient(900px 500px at 90% 20%, #e7f5f1, transparent 60%),
    var(--bg);
  color: #2a2a2a;
  color: var(--ink);
}

body.admin {
  background: #f6f4ef;
  background: var(--bg);
}

.container {
  width: min(1200px, 94%);
  margin: 0 auto;
}

.topbar {
  background: #1f4e4a;
  color: #fff;
  padding: 16px 0;
}

.public .topbar {
  background: linear-gradient(120deg, #174a44, #2e7d6f);
  border-bottom: 3px solid #f2d48b;
}

.topbar .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.brand .logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f7d494, #7cc2b6);
  display: grid;
  place-items: center;
  color: #1f4e4a;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.nav-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-actions a {
  background: linear-gradient(135deg, #f2d48b, #e6b250);
  color: #1f4e4a;
  padding: 10px 18px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nav-actions a:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(230, 178, 80, 0.3);
}

.hero {
  padding: 50px 0 30px;
  display: grid;
  gap: 16px;
}

.hero-panel {
  text-align: center;
}

.hero-content {
  max-width: 820px;
  margin: 0 auto;
}

.hero-label {
  display: inline-block;
  background: linear-gradient(120deg, #e6f5f1, #fff2d9);
  color: #1f4e4a;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.hero h1 {
  font-size: 2.2rem;
  margin: 0 0 16px;
  line-height: 1.3;
  color: #1f4e4a;
}

.hero-text {
  color: #6d6a64;
  color: var(--muted);
  line-height: 1.8;
  font-size: 1.05rem;
  margin-bottom: 24px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 32px;
}

.hero-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  padding: 14px 20px;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.hero-stat i {
  font-size: 2rem;
  color: #2e7d6f;
}

.hero-stat strong {
  display: block;
  font-size: 1.5rem;
  color: #1f4e4a;
  line-height: 1;
  margin-bottom: 4px;
}

.hero-stat span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

.info-strip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.info-strip h3 {
  margin: 0 0 6px;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: #1f4e4a;
  font-weight: 600;
}

.quick-links span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eef7f5;
  padding: 6px 10px;
  border-radius: 999px;
}

.section-title {
  text-align: center;
  margin-bottom: 24px;
}

.section-title h2 {
  font-size: 1.8rem;
  color: #1f4e4a;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.section-title p {
  color: var(--muted);
  font-size: 1rem;
  margin: 0;
}

.hero h1 {
  margin: 0;
  font-size: 1.6rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s ease;
}

.card:hover {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1);
}

.card h2 {
  margin: 0 0 16px;
  font-size: 1.2rem;
  color: #1f4e4a;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.badge {
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(120deg, #eef7f5, #f7f2e8);
  color: #1f4e4a;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid #e2ddd4;
}

.event-list {
  display: grid;
  gap: 14px;
  margin-top: 4px;
}

.event {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fefefe;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.event:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
  border-color: #2e7d6f;
}

.thumb {
  width: 70px;
  height: 70px;
  border-radius: 14px;
  background: linear-gradient(135deg, #9bd3c8, #f2d48b);
  display: grid;
  place-items: center;
  color: #1f4e4a;
  font-weight: 700;
  font-size: 1.5rem;
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.event-title {
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 1.05rem;
  color: #1f4e4a;
}

.event-summary {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.event-meta {
  display: flex;
  gap: 14px;
  font-size: 0.85rem;
  color: #2e7d6f;
  margin-top: 8px;
  font-weight: 600;
}

.event-meta i {
  margin-left: 4px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 0.95rem;
}

.table-scroll {
  max-height: 500px;
  overflow-y: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-top: 10px;
}

.table-scroll::-webkit-scrollbar {
  width: 8px;
}

.table-scroll::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.table-scroll::-webkit-scrollbar-thumb {
  background: #2e7d6f;
  border-radius: 10px;
}

.table-scroll::-webkit-scrollbar-thumb:hover {
  background: #1f4e4a;
}

.table th,
.table td {
  text-align: right;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
}

.table th {
  color: #1f4e4a;
  background: linear-gradient(to bottom, #f1f7f6, #f8f6f2);
  font-weight: 700;
  font-size: 0.9rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.table tbody tr {
  transition: background 0.2s ease;
}

.table tbody tr:hover {
  background: #fafaf8;
}

/* Resource List Styles - Minimal & Modern */
.resource-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.resource-item {
  padding: 12px 14px;
  border-radius: 8px;
  background: #fafaf8;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.resource-item:hover {
  border-color: var(--line);
  background: #fff;
}

.resource-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  color: #1f4e4a;
  text-decoration: none;
  transition: color 0.2s ease;
}

.resource-title:hover {
  color: #2e7d6f;
}

.resource-title i {
  font-size: 1rem;
  opacity: 0.6;
}

.resource-desc {
  margin: 6px 0 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
}

/* Tree View Styles - Category Hierarchy */
.tree-view {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.tree-category {
  border-radius: 8px;
  border: 1px solid var(--line);
  overflow: hidden;
}

.tree-category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #fafaf8;
  cursor: pointer;
  transition: background 0.2s ease;
  user-select: none;
}

.tree-category-header:hover {
  background: #f1f1f1;
}

.tree-category-header i {
  font-size: 1.1rem;
  color: #2e7d6f;
  opacity: 0.7;
}

.tree-category-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: #1f4e4a;
  flex: 1;
}

.tree-count {
  font-size: 0.8rem;
  color: var(--muted);
  background: #fff;
  padding: 2px 8px;
  border-radius: 999px;
}

.tree-items {
  padding: 4px;
  background: #fff;
}

.tree-item {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 2px;
  transition: background 0.15s ease;
}

.tree-item:hover {
  background: #f8f8f8;
}

.tree-item-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #1f4e4a;
  text-decoration: none;
  transition: color 0.2s ease;
}

.tree-item-title:hover {
  color: #2e7d6f;
}

.tree-item-title i {
  font-size: 0.95rem;
  opacity: 0.5;
}

.tree-item-desc {
  margin: 4px 0 0 22px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f2d48b, #e6b250);
  color: #1f4e4a;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.download:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(230, 178, 80, 0.3);
}

.search {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.search input {
  flex: 1;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fafaf8;
  font-size: 0.95rem;
  transition: border 0.2s ease, background 0.2s ease;
}

.search input:focus {
  outline: none;
  border-color: #2e7d6f;
  background: #fff;
}

input,
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-family: inherit;
}

.footer {
  margin-top: 60px;
  padding: 40px 0;
  background: #f8f6f2;
  border-top: 2px solid var(--line);
}

.footer-content {
  width: min(1200px, 94%);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.footer-content strong {
  display: block;
  color: #1f4e4a;
  margin-bottom: 8px;
}

.footer-content p {
  color: var(--muted);
  margin: 0;
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links a {
  color: #2e7d6f;
  text-decoration: none;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  background: #fff;
  transition: background 0.2s;
}

.footer-links a:hover {
  background: #eef7f5;
}

.footer-copyright {
  width: min(1200px, 94%);
  margin: 0 auto;
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 20;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #fff;
  width: min(720px, 96%);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-header h3 {
  margin: 0;
  color: #1f4e4a;
  font-size: 1.4rem;
}

.modal-body {
  display: grid;
  gap: 14px;
}

.modal-poster {
  width: 100%;
  max-height: 250px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.modal-poster:hover {
  transform: scale(1.02);
}

.close-btn {
  border: none;
  background: linear-gradient(135deg, #f2d48b, #e6b250);
  color: #1f4e4a;
  padding: 8px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s ease;
}

.close-btn:hover {
  transform: scale(1.05);
}

/* Fullscreen Image Viewer */
.fullscreen-viewer {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.fullscreen-viewer.active {
  display: flex;
}

.fullscreen-viewer img {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.fullscreen-viewer .close-fullscreen {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  padding: 12px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  color: #1f4e4a;
  transition: background 0.2s ease;
  z-index: 10001;
}

.fullscreen-viewer .close-fullscreen:hover {
  background: #fff;
}

.admin-link {
  font-weight: 600;
  color: #1f4e4a;
  text-decoration: none;
}

@media (max-width: 700px) {
  .topbar .row {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero h1 {
    font-size: 1.6rem;
  }

  .hero-stats {
    flex-direction: column;
    align-items: stretch;
  }

  .event {
    grid-template-columns: 1fr;
  }

  .event-meta {
    flex-wrap: wrap;
  }

  .info-strip {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-content {
    flex-direction: column;
  }
}
