/* ero-media-hub Admin Panel – Mobile-first dark theme */
:root {
  --gold: #c9a84c;
  --gold-dark: #a88a3a;
  --bg: #111;
  --bg2: #1a1a1a;
  --bg3: #222;
  --card: #1e1e1e;
  --border: #333;
  --text: #eee;
  --text2: #aaa;
  --danger: #e74c3c;
  --success: #27ae60;
  --warn: #f39c12;
  --info: #3498db;
  --radius: 10px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%; width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

#app { height: 100%; width: 100%; position: relative; }

/* ── Screens ────────────────────────────────── */
.screen { display: none; height: 100%; width: 100%; }
.screen.active { display: flex; flex-direction: column; }

/* ── Login ──────────────────────────────────── */
#login-screen {
  align-items: center; justify-content: center;
  background: linear-gradient(160deg, #0a0a0a 0%, #1a1a1a 100%);
}
.login-card {
  width: 90%; max-width: 380px;
  padding: 40px 28px;
  text-align: center;
}
.logo-text {
  font-size: 32px; font-weight: 700; letter-spacing: 1px;
  color: var(--text); margin-bottom: 8px;
}
.logo-text span { color: var(--gold); }
.login-subtitle { color: var(--text2); margin-bottom: 28px; font-size: 14px; }
#login-form { display: flex; flex-direction: column; gap: 14px; }
#login-form input {
  padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg3);
  color: var(--text); font-size: 16px; outline: none;
  transition: border-color .2s;
}
#login-form input:focus { border-color: var(--gold); }
.msg { margin-top: 16px; font-size: 13px; color: var(--text2); min-height: 20px; }
.msg.error { color: var(--danger); }
.msg.success { color: var(--success); }

/* ── Buttons ────────────────────────────────── */
.btn-primary {
  padding: 14px 24px; border-radius: var(--radius);
  border: none; background: var(--gold); color: #111;
  font-weight: 600; font-size: 15px; cursor: pointer;
  transition: background .2s;
}
.btn-primary:active { background: var(--gold-dark); }
.btn-primary:disabled { opacity: .5; cursor: default; }

.btn-sm {
  padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--gold); background: transparent;
  color: var(--gold); font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.btn-sm:active { background: rgba(201,168,76,.15); }

.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:active { background: rgba(231,76,60,.15); }

.icon-btn {
  background: none; border: none; color: var(--text2);
  font-size: 20px; cursor: pointer; padding: 6px;
  line-height: 1;
}
.icon-btn:active { color: var(--gold); }

/* ── Top bar ────────────────────────────────── */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  padding-top: max(12px, env(safe-area-inset-top));
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.logo-sm { font-size: 18px; font-weight: 700; }
.logo-sm span { color: var(--gold); }
.user-badge {
  font-size: 12px; color: var(--text2);
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Content ────────────────────────────────── */
#content {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.tab-content { display: none; padding: 16px; min-height: 100%; }
.tab-content.active { display: block; }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-header h2 { font-size: 20px; font-weight: 700; }

/* ── Bottom nav ─────────────────────────────── */
#bottom-nav {
  display: flex; background: var(--bg2);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  padding-bottom: var(--safe-bottom);
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 10px 4px 8px; border: none; background: none;
  color: var(--text2); cursor: pointer; gap: 3px;
  transition: color .2s;
}
.nav-btn.active { color: var(--gold); }
.nav-icon { font-size: 20px; line-height: 1; }
.nav-label { font-size: 10px; font-weight: 600; letter-spacing: .3px; }

/* ── Cards ──────────────────────────────────── */
.card-list { display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--card); border-radius: var(--radius);
  padding: 14px 16px; border: 1px solid var(--border);
  cursor: pointer; transition: border-color .2s;
}
.card:active { border-color: var(--gold); }
.card-row { display: flex; align-items: center; justify-content: space-between; }
.card-title { font-weight: 600; font-size: 15px; }
.card-sub { font-size: 12px; color: var(--text2); margin-top: 4px; }
.card-badge {
  display: inline-block; padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.badge-pending   { background: rgba(243,156,18,.2); color: var(--warn); }
.badge-confirmed { background: rgba(39,174,96,.2);  color: var(--success); }
.badge-declined  { background: rgba(231,76,60,.2);  color: var(--danger); }
.badge-cancelled { background: rgba(170,170,170,.2); color: var(--text2); }

/* ── Album detail ───────────────────────────── */
.detail-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.detail-header h3 { flex: 1; font-size: 18px; }

/* ── Upload ─────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 20px; text-align: center; margin-bottom: 16px;
  transition: border-color .2s;
}
.upload-zone.dragover { border-color: var(--gold); background: rgba(201,168,76,.05); }
.upload-hint { font-size: 12px; color: var(--text2); margin-top: 8px; }

.progress-bar {
  height: 4px; background: var(--bg3); border-radius: 2px;
  overflow: hidden; margin: 8px 0;
}
#progress-fill { height: 100%; background: var(--gold); width: 0; transition: width .3s; }
#progress-text { font-size: 12px; color: var(--text2); }

/* ── Media grid ─────────────────────────────── */
.media-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.media-thumb {
  aspect-ratio: 1; overflow: hidden; border-radius: 6px;
  position: relative; cursor: pointer;
}
.media-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .2s;
}
.media-thumb:active img { transform: scale(1.05); }
.media-thumb .delete-badge {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,.7); color: var(--danger);
  border: none; border-radius: 50%; width: 24px; height: 24px;
  font-size: 14px; cursor: pointer; display: none;
  align-items: center; justify-content: center;
}
.media-grid.edit-mode .delete-badge { display: flex; }

/* ── Storage bar ────────────────────────────── */
.storage-bar {
  margin-top: 20px; padding: 12px 16px;
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); font-size: 12px; color: var(--text2);
}
.storage-meter {
  height: 6px; background: var(--bg3); border-radius: 3px;
  overflow: hidden; margin-top: 8px;
}
.storage-meter-fill { height: 100%; background: var(--gold); border-radius: 3px; }

/* ── Booking filters ────────────────────────── */
#booking-filters {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px;
}
#booking-filters input,
#booking-filters select {
  flex: 1; min-width: 100px;
  padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg3);
  color: var(--text); font-size: 14px;
}

/* ── Modal ──────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  z-index: 1000; display: flex; align-items: flex-end;
  justify-content: center;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg2); border-radius: 16px 16px 0 0;
  width: 100%; max-width: 500px; max-height: 85vh;
  overflow-y: auto; animation: slideUp .25s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg2); z-index: 1;
}
.modal-header h3 { font-size: 16px; }
#modal-body { padding: 20px; }
.modal-footer {
  padding: 12px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* Modal form elements */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 12px; color: var(--text2);
  margin-bottom: 6px; font-weight: 600;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 12px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg3);
  color: var(--text); font-size: 15px; font-family: inherit;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--gold);
}
.form-check {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
}
.form-check input[type="checkbox"] {
  width: 20px; height: 20px; accent-color: var(--gold);
}

/* ── Toast ──────────────────────────────────── */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--bg3); color: var(--text); padding: 12px 20px;
  border-radius: 10px; font-size: 14px; z-index: 2000;
  border: 1px solid var(--border);
  animation: fadeIn .2s ease-out;
  max-width: 90%; text-align: center;
}
.toast.hidden { display: none; }
.toast.error { border-color: var(--danger); }
.toast.success { border-color: var(--success); }
@keyframes fadeIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } }

/* ── Lightbox ───────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.95);
  z-index: 3000; display: flex; align-items: center; justify-content: center;
}
.lightbox.hidden { display: none; }
.lightbox img {
  max-width: 95vw; max-height: 90vh; object-fit: contain;
  border-radius: 4px;
}
.lb-btn {
  position: absolute; background: rgba(0,0,0,.5); border: none;
  color: #fff; font-size: 28px; cursor: pointer; z-index: 1;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.lb-close { top: max(16px, env(safe-area-inset-top)); right: 16px; }
.lb-prev  { left: 10px; top: 50%; transform: translateY(-50%); }
.lb-next  { right: 10px; top: 50%; transform: translateY(-50%); }

/* ── Empty state ──────────────────────────── */
.empty-state {
  text-align: center; padding: 40px 20px; color: var(--text2);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── Loading spinner ─────────────────────── */
.spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid var(--border); border-top-color: var(--gold);
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-center {
  display: flex; justify-content: center; padding: 40px;
}

/* ── Responsive ─────────────────────────────── */
@media (min-width: 600px) {
  .media-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .modal { border-radius: 16px; margin-bottom: 20px; }
}
@media (min-width: 900px) {
  .media-grid { grid-template-columns: repeat(6, 1fr); }
}
