/* =========================================================
   Hapn – admin styles (loaded after style.css)
   ========================================================= */

.admin-body { background: var(--paper); min-height: 100vh; }

/* Header */
.admin-header { background: var(--ink); color: #fff; }
.admin-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
.admin-header .brand { color: #fff; }
.admin-tag { background: var(--sun); color: var(--ink); font-size: .75rem; font-weight: 800; padding: .1rem .55rem; border-radius: 999px; }
.admin-actions { display: flex; align-items: center; gap: .5rem; }
.admin-email { display: none; color: #c9cee6; font-size: .9rem; max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 768px) { .admin-email { display: inline; margin-right: .5rem; } }

.admin-main { padding-top: 1.75rem; padding-bottom: 3rem; }
.admin-main.narrow { max-width: 820px; }
.page-title-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-title-row h1 { margin: 0; font-size: clamp(1.6rem, 5vw, 2.1rem); }

/* Gate (permission check / access denied) */
.gate { max-width: 30rem; margin: 3rem auto; padding: 0 1rem; text-align: center; color: var(--muted); }
.gate .card { text-align: left; color: var(--ink); }
.gate-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow-sm); padding: 1.25rem; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.login-card { width: 100%; max-width: 26rem; padding: 1.75rem 1.5rem; }
.login-card .brand { margin-bottom: 1.25rem; }
.login-card h1 { font-size: 1.6rem; }
.login-card .back { display: block; text-align: center; margin-top: 1.25rem; font-size: .95rem; }

/* Forms */
.field { display: grid; gap: .35rem; margin-bottom: 1rem; }
.field label, .field .label { font-weight: 700; font-size: .95rem; }
.field .req { color: var(--red); }
.field input[type="text"], .field input[type="email"], .field input[type="password"], .field input[type="url"],
.field input[type="date"], .field input[type="time"], .field select, .field textarea {
  width: 100%; padding: .75rem .9rem; border: 1.5px solid var(--line); border-radius: var(--radius-ctl);
  font: inherit; background: #fff; color: var(--ink);
}
.field input[type="file"] { font: inherit; padding: .5rem; border: 1.5px dashed var(--line); border-radius: var(--radius-ctl); background: #fff; width: 100%; }
.field textarea { resize: vertical; min-height: 5rem; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-soft); }
.hint { color: var(--muted); font-size: .88rem; }
.form-grid { display: grid; gap: 0 1rem; }
@media (min-width: 720px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .full { grid-column: 1 / -1; }
}
.check { display: flex; align-items: center; gap: .6rem; font-weight: 600; margin-bottom: 1.25rem; }
.check input { width: 1.15rem; height: 1.15rem; accent-color: var(--blue); }
.form-actions { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; padding-top: .5rem; }
.poster-preview { width: 100%; max-width: 20rem; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: var(--blue-soft); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-bottom: 1.75rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1rem; box-shadow: var(--shadow-sm); }
.stat-number { display: block; font-size: clamp(1.6rem, 6vw, 2.4rem); font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.stat-label { display: block; color: var(--muted); font-size: .88rem; margin-top: .35rem; }
.stat-upcoming .stat-number { color: var(--green); }

/* Events table (turns into stacked cards on phones) */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow-sm); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .88rem; color: var(--muted); font-weight: 700; padding: .8rem 1rem; background: #fafbff; border-bottom: 1px solid var(--line); }
.table td { padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.thumb { width: 84px; height: 52px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--blue-soft); }
.event-name { font-weight: 700; display: block; }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.status { display: inline-block; font-size: .82rem; font-weight: 700; padding: .15rem .65rem; border-radius: 999px; }
.status-upcoming { background: var(--green-soft); color: var(--green); }
.status-past { background: #eceef6; color: var(--muted); }
.status-draft { background: var(--amber-soft); color: #6b4e00; }
.table-empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }

@media (max-width: 759px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
  .table tr:last-child { border-bottom: 0; }
  .table td { border: 0; padding: .3rem 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: .85rem; font-weight: 600; flex: 0 0 5rem; }
  .table td[data-label="Poster"] img { width: 100%; height: auto; aspect-ratio: 16 / 10; }
  .table td[data-label="Poster"]::before { display: none; }
  .table td[data-label="Actions"] { padding-top: .6rem; }
  .table td[data-label="Actions"]::before { display: none; }
  .table td[data-label="Actions"] .row-actions { width: 100%; }
  .table td[data-label="Actions"] .btn { flex: 1; }
}

/* Delete dialog */
.dialog { border: 0; border-radius: var(--radius-card); padding: 1.5rem; width: min(92vw, 26rem); box-shadow: 0 30px 60px -20px rgba(17, 25, 54, .5); color: var(--ink); }
.dialog::backdrop { background: rgba(17, 25, 54, .55); }
.dialog h2 { font-size: 1.3rem; }
.dialog-event { background: var(--paper); border-radius: 10px; padding: .6rem .8rem; font-weight: 700; word-break: break-word; }
.dialog-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.25rem; }

@keyframes dialogIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.dialog[open] { animation: dialogIn .2s cubic-bezier(.2,.7,.3,1) both; }
.dialog[open]::backdrop { animation: fadeIn .2s ease both; }

.stat { transition: transform .15s ease, box-shadow .15s ease; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-number { transition: color .2s ease; }

.table tr { animation: rowIn .35s ease both; }
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.row-actions .btn { transition: transform .15s ease, background-color .15s ease, border-color .15s ease; }
.row-actions .btn:active { transform: scale(.96); }
