/* ─── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #f4f5f7;
  --surface:  #ffffff;
  --nav-bg:   #141420;
  --nav-text: #f0f0f5;
  --primary:  #e94560;
  --primary-h:#c73550;
  --accent:   #4ecdc4;
  --text:     #1a1a2e;
  --muted:    #6b7280;
  --border:   #e0e2e7;
  --success:  #00b894;
  --warning:  #f39c12;
  --danger:   #e74c3c;
  --radius:   10px;
  --shadow:   0 2px 12px rgba(0,0,0,.08);
  --shadow-lg:0 8px 32px rgba(0,0,0,.14);
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ─── Nav ───────────────────────────────────────────────── */
.nav {
  background: var(--nav-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 60px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.nav-brand {
  color: var(--nav-text);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -.5px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.nav-brand:hover { text-decoration: none; opacity: .9; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.nav-links a {
  color: rgba(240,240,245,.8);
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  transition: color .15s;
}
.nav-links a:hover { color: #fff; text-decoration: none; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.2rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, transform .1s, opacity .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary  { background: var(--primary);  color: #fff; }
.btn-primary:hover { background: var(--primary-h); }

.btn-accent   { background: var(--accent); color: #fff; }
.btn-accent:hover { opacity: .88; }

.btn-outline  { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }

.btn-ghost    { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); }

.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .88; }

.btn-sm   { padding: .35rem .8rem; font-size: .82rem; }
.btn-lg   { padding: .75rem 1.75rem; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ─── Main layout ────────────────────────────────────────── */
main { flex: 1; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}
.container-sm {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 1.25rem;
}
.container-md {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.page-header {
  padding: 2rem 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 1.75rem; font-weight: 700; }
.page-header p  { color: var(--muted); margin-top: .25rem; }

/* ─── Flash / Alerts ─────────────────────────────────────── */
.flash {
  padding: .85rem 1.25rem;
  font-weight: 500;
  font-size: .92rem;
  text-align: center;
}
.flash-success { background: #d4edda; color: #155724; }
.flash-error   { background: #f8d7da; color: #721c24; }
.flash-info    { background: #cce5ff; color: #004085; }
.flash-warning { background: #fff3cd; color: #856404; }

.alert {
  padding: .85rem 1.1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  margin-bottom: 1rem;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info    { background: #cce5ff; color: #004085; border: 1px solid #b8daff; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-body  { padding: 1.5rem; }
.card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: .5rem; }
.card-footer {
  padding: .85rem 1.5rem;
  border-top: 1px solid var(--border);
  background: #fafafa;
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ─── Forms ──────────────────────────────────────────────── */
.form-group  { margin-bottom: 1.1rem; }
.form-label  { display: block; font-size: .88rem; font-weight: 600; margin-bottom: .35rem; color: var(--text); }
.form-hint   { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.form-error  { font-size: .82rem; color: var(--danger); margin-top: .3rem; }

input[type=text], input[type=email], input[type=password],
input[type=date], input[type=url], textarea, select {
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: .95rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(233,69,96,.12);
}
textarea { resize: vertical; min-height: 90px; }

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  font-size: .9rem;
}
.checkbox-group input[type=checkbox] {
  width: auto;
  margin-top: .2rem;
  flex-shrink: 0;
}

.radio-group { display: flex; gap: 1rem; flex-wrap: wrap; }
.radio-option {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font-size: .9rem;
}
.radio-option input { width: auto; }

/* ─── Auth pages ─────────────────────────────────────────── */
.auth-wrap {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2.25rem;
}
.auth-logo {
  text-align: center;
  font-size: 2rem;
  margin-bottom: .5rem;
}
.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: .25rem;
}
.auth-card p.sub {
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 1.75rem;
}
.auth-foot {
  text-align: center;
  font-size: .88rem;
  color: var(--muted);
  margin-top: 1.25rem;
}

/* ─── Hero / Landing ─────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #141420 0%, #1e1e3a 60%, #2a1a2e 100%);
  color: #fff;
  padding: 5rem 1.25rem 4rem;
  text-align: center;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1rem;
}
.hero h1 span { color: var(--primary); }
.hero p {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  opacity: .85;
  max-width: 560px;
  margin: 0 auto 2rem;
}
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  padding: 3rem 0;
}
.feature-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.feature-icon { font-size: 2.2rem; margin-bottom: .75rem; }
.feature-card h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.feature-card p  { font-size: .88rem; color: var(--muted); }

/* ─── Dashboard ──────────────────────────────────────────── */
.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding-bottom: 2rem;
}

.portal-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .2s, transform .2s;
}
.portal-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.portal-hero {
  height: 160px;
  background: linear-gradient(135deg, #1a1a2e, #2a1a2e);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.3);
  font-size: 3rem;
  overflow: hidden;
  position: relative;
}
.portal-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portal-body { padding: 1.1rem 1.25rem; flex: 1; }
.portal-title { font-size: 1.05rem; font-weight: 700; margin-bottom: .25rem; }
.portal-meta  { font-size: .82rem; color: var(--muted); display: flex; gap: .75rem; flex-wrap: wrap; }
.portal-meta span { display: flex; align-items: center; gap: .25rem; }

.badge {
  display: inline-block;
  padding: .18rem .55rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.4;
}
.badge-public    { background: #d4edda; color: #155724; }
.badge-protected { background: #fff3cd; color: #856404; }
.badge-held      { background: #fde2e2; color: #8b1a1a; }
.badge-admin     { background: #cce5ff; color: #004085; }

.portal-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

/* ─── Portal view (guest upload) ─────────────────────────── */
.portal-header {
  position: relative;
  background: var(--nav-bg);
  color: #fff;
  min-height: 280px;
  display: flex;
  align-items: flex-end;
}
.portal-header-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: .45;
}
.portal-header-content {
  position: relative;
  z-index: 1;
  padding: 2rem 1.5rem 1.75rem;
  width: 100%;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
}
.portal-header h1 { font-size: clamp(1.4rem, 4vw, 2.25rem); font-weight: 800; }
.portal-header p  { opacity: .85; margin-top: .4rem; font-size: .95rem; max-width: 640px; }
.portal-date      { opacity: .7; font-size: .88rem; margin-top: .3rem; }

.upload-section {
  max-width: 680px;
  margin: 2rem auto;
  padding: 0 1.25rem 3rem;
}
.upload-section h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 1.25rem; }

/* ─── Drop zone ──────────────────────────────────────────── */
.drop-zone {
  border: 2.5px dashed var(--border);
  border-radius: 12px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: #fafafa;
  position: relative;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(233,69,96,.04);
}
.drop-zone input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.drop-zone-icon { font-size: 2.5rem; margin-bottom: .5rem; }
.drop-zone p    { color: var(--muted); font-size: .92rem; }
.drop-zone strong { color: var(--primary); }

.camera-btn {
  display: block;
  margin: 1rem auto 0;
  position: relative;
  z-index: 1;
}

/* ─── Upload queue ───────────────────────────────────────── */
.upload-queue { margin-top: 1.5rem; }
.upload-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .75rem 1rem;
  margin-bottom: .6rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.upload-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .88rem;
}
.upload-item-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70%; }
.upload-item-status { font-size: .78rem; color: var(--muted); }
.upload-item-status.done   { color: var(--success); }
.upload-item-status.error  { color: var(--danger); }

.progress-bar-wrap { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 3px; transition: width .2s; width: 0; }
.progress-bar.done { background: var(--success); }

/* ─── Gallery ────────────────────────────────────────────── */
.gallery-toolbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  position: sticky;
  top: 60px;
  z-index: 50;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}
.gallery-toolbar .sel-count {
  font-size: .88rem;
  color: var(--muted);
  margin-left: auto;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  padding: 1.5rem;
}

@media (max-width: 600px) {
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem; padding: .75rem; }
}

.gallery-item {
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
  aspect-ratio: 1;
  cursor: pointer;
  transition: box-shadow .2s, transform .2s;
}
.gallery-item:hover { box-shadow: var(--shadow-lg); transform: scale(1.02); }
.gallery-item.selected { outline: 3px solid var(--primary); outline-offset: 2px; }

.gallery-item img, .gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-item .video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.3);
  color: #fff;
  font-size: 2.5rem;
  pointer-events: none;
}
.gallery-item .item-select {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  border: 2px solid #ccc;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  transition: background .15s, border-color .15s;
}
.gallery-item.selected .item-select {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.gallery-item .item-menu {
  position: absolute;
  bottom: 6px;
  right: 6px;
  z-index: 2;
  display: none;
}
.gallery-item:hover .item-menu { display: block; }
.item-meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.65));
  color: #fff;
  font-size: .72rem;
  padding: 1.5rem .5rem .4rem;
  pointer-events: none;
}

.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--muted);
}
.empty-state .icon { font-size: 3.5rem; margin-bottom: 1rem; opacity: .4; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: .4rem; color: var(--text); }
.empty-state p { font-size: .9rem; }

/* ─── Lightbox ───────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox-inner {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}
.lightbox-inner img, .lightbox-inner video {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 6px;
  object-fit: contain;
}
.lightbox-close {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(255,255,255,.15);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-info {
  color: rgba(255,255,255,.75);
  font-size: .82rem;
  text-align: center;
  margin-top: .6rem;
}
.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.15);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

/* ─── Admin ──────────────────────────────────────────────── */
.admin-banner {
  background: linear-gradient(90deg, #141420, #2a1a2e);
  color: #fff;
  padding: 1.25rem 1.5rem;
}
.admin-banner h1 { font-size: 1.3rem; font-weight: 700; }
.admin-banner p  { font-size: .85rem; opacity: .7; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  padding: 1.5rem 0 1rem;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-card .num { font-size: 1.75rem; font-weight: 800; color: var(--primary); }
.stat-card .lbl { font-size: .8rem; color: var(--muted); margin-top: .15rem; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
thead { background: var(--nav-bg); color: var(--nav-text); }
th { padding: .75rem 1rem; text-align: left; font-weight: 600; font-size: .83rem; text-transform: uppercase; letter-spacing: .04em; }
td { padding: .7rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

.actions-cell { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ─── Held / blocked portal ──────────────────────────────── */
.portal-held-banner {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  max-width: 520px;
  margin: 3rem auto;
}
.portal-held-banner h2 { color: #856404; margin-bottom: .5rem; }
.portal-held-banner p  { color: #6b5900; font-size: .95rem; }

/* ─── Portal create/edit form ────────────────────────────── */
.portal-form { max-width: 640px; margin: 0 auto; padding-bottom: 3rem; }
.portal-form h2 { margin-bottom: 1.5rem; }

.hero-preview {
  width: 100%;
  height: 180px;
  background: #eee;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: .9rem;
}
.hero-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ─── Footer ─────────────────────────────────────────────── */
footer {
  background: var(--nav-bg);
  color: rgba(255,255,255,.5);
  font-size: .83rem;
  text-align: center;
  padding: 1.25rem;
  margin-top: auto;
}
footer a { color: rgba(255,255,255,.65); }
footer a:hover { color: #fff; }

/* ─── Utility ────────────────────────────────────────────── */
.text-muted  { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }  .mt-2 { margin-top: 1rem; }   .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }
.flex { display: flex; } .flex-wrap { flex-wrap: wrap; } .items-center { align-items: center; }
.justify-between { justify-content: space-between; }

.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .page-header h1 { font-size: 1.35rem; }
  .auth-card { padding: 1.75rem 1.25rem; }
  .nav-links .hide-mobile { display: none; }
  .portal-form { padding: 0 .25rem 2rem; }
  .gallery-toolbar { top: 0; }
  .nav { position: relative; }
}
