@import url('https://fonts.googleapis.com/css2?family=David+Libre:wght@400;500;700&family=Assistant:wght@300;400;500;600;700&display=swap');

:root {
  --stone: #eae3d2;
  --stone-deep: #dccfab;
  --ink: #262220;
  --ink-soft: #6b6355;
  --teal: #1f5c52;
  --teal-dark: #163f38;
  --copper: #b5651d;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; direction: rtl; }

body {
  background: var(--stone);
  background-image:
    radial-gradient(circle at 10% 0%, rgba(31,92,82,0.08), transparent 45%),
    radial-gradient(circle at 90% 100%, rgba(181,101,29,0.07), transparent 45%);
  color: var(--ink);
  font-family: 'Assistant', sans-serif;
  min-height: 100vh;
}

h1, .display { font-family: 'David Libre', serif; color: var(--ink); margin: 0; }
a { color: inherit; text-decoration: none; }

/* ---------- top bar ---------- */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 32px;
  border-bottom: 1px solid var(--stone-deep);
}
.brand { display: flex; align-items: center; }
.brand-logo { height: 46px; width: auto; display: block; }
.top-left { display: flex; align-items: center; gap: 16px; }
.partner-logo { height: 32px; width: auto; display: block; opacity: 0.92; }
.role-badge {
  font-size: 0.76rem;
  color: var(--ink-soft);
  background: rgba(107,99,85,0.1);
  border-radius: 999px;
  padding: 5px 12px;
}
.role-badge--admin { color: var(--copper); background: rgba(181,101,29,0.12); }
.logout-btn {
  background: none;
  border: 1px solid var(--stone-deep);
  color: var(--ink-soft);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-family: 'Assistant', sans-serif;
  font-size: 0.82rem;
}
.logout-btn:hover { border-color: var(--teal); color: var(--teal); }

/* ---------- layout ---------- */
main { max-width: 880px; margin: 0 auto; padding: 40px 24px 80px; }

.eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--copper);
  text-transform: uppercase;
  margin: 0 0 6px;
}

.hero { text-align: center; margin-bottom: 48px; }
.hero h1 { font-size: 3rem; font-weight: 700; }
.hero-sub { color: var(--ink-soft); margin-top: 10px; font-size: 1.02rem; }

/* ---------- gate (login screen) ---------- */
.gate {
  min-height: calc(100vh - 140px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 36px;
}
.gate-photos {
  display: flex;
  flex-direction: column;
  gap: 34px;
  width: 150px;
  flex-shrink: 0;
}
.gate-photo {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 12px;
  border: 5px solid #fffdf7;
  box-shadow: 0 8px 20px rgba(38,34,32,0.16);
  background: #fffdf7;
}
.gate-photos--right .gate-photo--a { transform: rotate(-3deg); align-self: flex-end; }
.gate-photos--right .gate-photo--b { transform: rotate(2.5deg); align-self: flex-start; margin-right: 10px; }
.gate-photos--left .gate-photo--a { transform: rotate(3deg); align-self: flex-start; }
.gate-photos--left .gate-photo--b { transform: rotate(-2.5deg); align-self: flex-end; margin-left: 10px; }
@media (max-width: 900px) {
  .gate-photos { display: none; }
}
.gate-arch {
  width: 100%;
  max-width: 380px;
  text-align: center;
  background: #fffdf7;
  border: 1px solid var(--stone-deep);
  border-radius: 140px 140px 16px 16px;
  padding: 42px 34px 40px;
  box-shadow: 0 14px 40px rgba(38,34,32,0.1);
  position: relative;
}
.gate-logo {
  display: block;
  margin: 0 auto 18px;
  max-width: 220px;
  width: 70%;
  height: auto;
}
.gate-arch h1 { font-size: 2.2rem; margin-top: 6px; }
.gate-sub { color: var(--ink-soft); font-size: 0.9rem; margin: 12px 0 26px; }
.gate-form { display: flex; flex-direction: column; gap: 12px; }
.gate-form input {
  font-family: 'Assistant', sans-serif;
  border: 1px solid var(--stone-deep);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
  font-size: 1rem;
  text-align: center;
}
.password-field { position: relative; }
.password-field input {
  width: 100%;
  padding-left: 44px;
  text-align: right;
}
.password-toggle {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 6px;
}
.password-toggle:hover { color: var(--teal); background: rgba(31,92,82,0.08); }
.password-toggle svg { display: block; }
.gate-form button {
  background: var(--teal);
  color: var(--stone);
  border: none;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  font-family: 'Assistant', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  transition: background 0.15s ease;
}
.gate-form button:hover { background: var(--teal-dark); }
.gate-form button:disabled { opacity: 0.6; cursor: default; }
.gate-error { color: var(--copper); font-size: 0.85rem; margin-top: 14px; }

/* ---------- category gates (home) ---------- */
.gates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 22px;
}
.gate-card {
  position: relative;
  background: #fffdf7;
  border: 1px solid var(--stone-deep);
  border-radius: 90px 90px 10px 10px;
  padding: 54px 20px 26px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.gate-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(38,34,32,0.1);
  border-color: var(--teal);
}
.gate-keystone {
  position: absolute;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--teal);
  color: var(--stone);
  font-family: 'David Libre', serif;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
}
.gate-card-name {
  font-family: 'David Libre', serif;
  font-size: 1.2rem;
  line-height: 1.35;
}
.gate-card-cta { color: var(--copper); font-size: 0.82rem; }

/* ---------- crumbs / page head ---------- */
.crumbs { font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 22px; display: flex; gap: 8px; }
.crumbs a:hover { color: var(--teal); }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 2.1rem; font-weight: 700; }

/* ---------- uploader ---------- */
.uploader {
  border: 1.5px dashed var(--teal);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
  background: rgba(31,92,82,0.05);
}
.uploader-label { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.uploader-label input[type="file"] {
  position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden;
}
.uploader-btn {
  background: var(--teal);
  color: var(--stone);
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
}
#upload-count { color: var(--ink-soft); font-size: 0.88rem; }

/* ---------- file list ---------- */
.files { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fffdf7;
  border: 1px solid var(--stone-deep);
  border-radius: 10px;
  padding: 12px 16px;
}
.file-link { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.file-link:hover .file-name { color: var(--teal); }
.file-icon {
  font-family: 'Assistant', sans-serif;
  font-weight: 700;
  font-size: 0.68rem;
  background: var(--teal);
  color: var(--stone);
  border-radius: 5px;
  padding: 3px 6px;
  letter-spacing: 0.03em;
}
.file-name { font-size: 0.98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--ink-soft); font-size: 0.78rem; white-space: nowrap; }
.file-delete {
  background: none;
  border: 1px solid var(--stone-deep);
  color: var(--ink-soft);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  margin-right: 12px;
}
.file-delete:hover { border-color: var(--copper); color: var(--copper); }

.files-loading, .files-empty {
  list-style: none;
  color: var(--ink-soft);
  padding: 24px 4px;
  text-align: center;
  border: 1px dashed var(--stone-deep);
  border-radius: 10px;
}

/* ---------- videos ---------- */
.section-title {
  font-family: 'David Libre', serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 40px 0 16px;
}
.video-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  border: 1.5px dashed var(--teal);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 22px;
  background: rgba(31,92,82,0.05);
  position: relative;
}
.video-form input {
  font-family: 'Assistant', sans-serif;
  border: 1px solid var(--stone-deep);
  border-radius: 8px;
  padding: 9px 12px;
  background: #fff;
  font-size: 0.92rem;
  flex: 1;
  min-width: 180px;
}
.video-form button {
  border: none;
  cursor: pointer;
  font-family: 'Assistant', sans-serif;
}
.video-form-error {
  color: var(--copper);
  font-size: 0.82rem;
  width: 100%;
}
.sheet-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  border: 1.5px dashed var(--teal);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 22px;
  background: rgba(31,92,82,0.05);
}
.sheet-form input {
  font-family: 'Assistant', sans-serif;
  border: 1px solid var(--stone-deep);
  border-radius: 8px;
  padding: 9px 12px;
  background: #fff;
  font-size: 0.92rem;
  flex: 1;
  min-width: 180px;
}
.sheet-form button { border: none; cursor: pointer; font-family: 'Assistant', sans-serif; }
.sheet-form-error { color: var(--copper); font-size: 0.82rem; width: 100%; }
.file-icon--sheet { background: #0f9d58; }
.file-icon--doc { background: #2b579a; }

.videos { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.video-card {
  background: #fffdf7;
  border: 1px solid var(--stone-deep);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.video-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  padding: 0;
  cursor: pointer;
  background: var(--ink);
}
.video-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.6rem;
  background: rgba(38,34,32,0.28);
  transition: background 0.15s ease;
}
.video-thumb:hover .video-play { background: rgba(38,34,32,0.45); }
.video-embed { position: relative; width: 100%; aspect-ratio: 16 / 9; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }
.video-info { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.video-title { font-weight: 600; font-size: 0.95rem; }
.video-external { color: var(--teal); font-size: 0.8rem; }
.video-external:hover { text-decoration: underline; }
.video-delete { align-self: flex-start; margin: 0 14px 12px; }

.not-found { text-align: center; padding: 80px 0; }

footer { text-align: center; color: var(--ink-soft); font-size: 0.78rem; padding: 20px; }

/* ---------- responsive ---------- */
@media (max-width: 560px) {
  .hero h1 { font-size: 2.1rem; }
  .gate-arch { border-radius: 90px 90px 16px 16px; padding: 50px 22px 30px; }
  .uploader { flex-direction: column; align-items: flex-start; gap: 10px; }
  .top-bar { padding: 12px 16px; }
  .brand-logo { height: 34px; }
  .partner-logo { height: 22px; }
  .top-left { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .gate-card, .gate-form button { transition: none; }
}

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
