/* =====================================================
   Admin Panel — Margarita Pochebut
   ===================================================== */

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

:root {
  --gold:       #c9a96e;
  --gold-light: #e2c99a;
  --dark:       #0e0e0e;
  --dark-2:     #141414;
  --dark-3:     #1c1c1c;
  --dark-4:     #242424;
  --dark-5:     #2e2e2e;
  --light:      #f0ece7;
  --text:       #c8c1b8;
  --text-muted: #7a746e;
  --danger:     #c0503a;
  --danger-h:   #d96044;
  --success:    #5a9e6f;

  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans:  'Inter', system-ui, sans-serif;
  --radius:     6px;
  --sidebar-w:  240px;
}

html, body { height: 100%; }

body {
  background: var(--dark);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

/* ---- Shared ---- */
a { color: inherit; text-decoration: none; }
label { display: block; font-size: 0.7rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.4rem; }

input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
  width: 100%;
  background: var(--dark-4);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  color: var(--light);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 300;
  outline: none;
  transition: border-color 0.2s;
  resize: vertical;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,169,110,0.1);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
select option { background: var(--dark-4); }

.form-group { margin-bottom: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.4rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}
.btn--primary  { background: var(--gold); color: var(--dark); }
.btn--primary:hover { background: var(--gold-light); }
.btn--primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--ghost    { background: transparent; color: var(--text); border: 1px solid rgba(255,255,255,0.1); }
.btn--ghost:hover { border-color: rgba(255,255,255,0.25); color: var(--light); }
.btn--full     { width: 100%; }
.btn--danger   { background: var(--danger); color: #fff; }
.btn--danger:hover { background: var(--danger-h); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  background: var(--dark-5); border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius); color: var(--text-muted);
  font-size: 0.85rem; cursor: pointer;
  transition: all 0.2s;
}
.icon-btn:hover { border-color: var(--gold); color: var(--gold); }
.icon-btn--danger:hover { border-color: var(--danger); color: var(--danger); }

/* ---- Login ---- */
.login-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: var(--dark);
}
.login-box {
  background: var(--dark-3);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%; max-width: 380px;
  text-align: center;
}
.login-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(201,169,110,0.12); border: 1px solid rgba(201,169,110,0.3);
  font-family: var(--font-serif); font-size: 1.6rem; color: var(--gold);
  margin-bottom: 1.25rem;
}
.login-title { font-family: var(--font-serif); font-size: 1.6rem; font-weight: 300; color: var(--light); margin-bottom: 0.3rem; }
.login-sub   { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 2rem; letter-spacing: 0.05em; }
.login-form  { text-align: left; }
.login-hint  { font-size: 0.72rem; color: var(--text-muted); margin: -0.5rem 0 1rem; }
.login-hint code { background: var(--dark-5); padding: 0.1rem 0.35rem; border-radius: 3px; color: var(--gold); font-size: 0.72rem; }
.login-error { margin-top: 0.75rem; font-size: 0.78rem; color: #e06060; min-height: 1.2em; text-align: center; }

/* ---- App Layout ---- */
.admin-app {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--dark-2);
  border-right: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sidebar__logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; min-width: 36px; border-radius: 50%;
  background: rgba(201,169,110,0.12); border: 1px solid rgba(201,169,110,0.25);
  font-family: var(--font-serif); font-size: 1rem; color: var(--gold);
}
.sidebar__name { font-size: 0.82rem; font-weight: 500; color: var(--light); line-height: 1.2; }
.sidebar__role { font-size: 0.68rem; color: var(--text-muted); margin-top: 0.1rem; }

.sidebar__nav { flex: 1; padding: 1rem 0.75rem; display: flex; flex-direction: column; gap: 0.25rem; }
.sidebar__item {
  display: flex; align-items: center; gap: 0.6rem;
  width: 100%; padding: 0.6rem 0.75rem;
  background: none; border: none;
  border-radius: var(--radius);
  font-family: var(--font-sans); font-size: 0.82rem; font-weight: 400;
  color: var(--text-muted); cursor: pointer;
  transition: all 0.15s; text-align: left;
}
.sidebar__item:hover { background: rgba(255,255,255,0.04); color: var(--light); }
.sidebar__item--active { background: rgba(201,169,110,0.1); color: var(--gold) !important; }
.sidebar__icon { font-size: 0.9rem; }

.sidebar__footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex; flex-direction: column; gap: 0.5rem;
}
.sidebar__view-link { font-size: 0.75rem; color: var(--text-muted); transition: color 0.2s; }
.sidebar__view-link:hover { color: var(--gold); }
.sidebar__logout {
  background: none; border: none; font-family: var(--font-sans); font-size: 0.75rem;
  color: var(--text-muted); cursor: pointer; text-align: left; padding: 0;
  transition: color 0.2s;
}
.sidebar__logout:hover { color: var(--danger); }

/* ---- Main ---- */
.admin-main { flex: 1; overflow-y: auto; padding: 2.5rem; background: var(--dark); }

.tab-panel { max-width: 860px; }

.panel-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap;
}
.panel-title { font-family: var(--font-serif); font-size: 1.6rem; font-weight: 300; color: var(--light); }
.panel-sub   { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ---- Events Editor ---- */
.events-editor { display: flex; flex-direction: column; gap: 0; margin-bottom: 1.5rem; }

.event-row {
  display: flex; align-items: center; gap: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--dark-3);
  border: 1px solid rgba(255,255,255,0.05);
  border-bottom: none;
  transition: background 0.15s;
}
.event-row:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.event-row:last-child  { border-bottom: 1px solid rgba(255,255,255,0.05); border-radius: 0 0 var(--radius) var(--radius); }
.event-row:only-child  { border-radius: var(--radius); border-bottom: 1px solid rgba(255,255,255,0.05); }
.event-row:hover { background: var(--dark-4); }

.event-row__date {
  font-family: var(--font-serif); font-size: 0.85rem; color: var(--gold);
  min-width: 80px; white-space: nowrap;
}
.event-row__body { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }
.event-row__tag  { font-size: 0.65rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
.event-row__title { font-size: 0.88rem; color: var(--light); font-weight: 400; }
.event-row__venue { font-size: 0.75rem; color: var(--text-muted); }
.event-row__actions { display: flex; gap: 0.4rem; flex-shrink: 0; }

.panel-actions { display: flex; gap: 0.75rem; margin-top: 0.5rem; flex-wrap: wrap; }

.empty-state {
  padding: 3rem; text-align: center;
  background: var(--dark-3); border: 1px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius); color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---- Photo Editor ---- */
.photo-editor { display: flex; gap: 3rem; align-items: flex-start; flex-wrap: wrap; }

.photo-preview-wrap { flex-shrink: 0; }
.photo-preview {
  width: 240px; aspect-ratio: 3/4;
  background: var(--dark-3); border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview__placeholder {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; color: var(--text-muted); font-size: 0.8rem;
}
.photo-hint { margin-top: 0.5rem; font-size: 0.7rem; color: var(--text-muted); max-width: 240px; line-height: 1.5; }

.photo-controls { display: flex; flex-direction: column; gap: 0.75rem; padding-top: 0.25rem; }

.upload-label {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.65rem 1.4rem;
  background: var(--dark-4); border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  font-size: 0.78rem; font-weight: 500; letter-spacing: 0.08em;
  color: var(--light); cursor: pointer; transition: all 0.2s;
}
.upload-label:hover { border-color: var(--gold); color: var(--gold); }
.upload-label input { display: none; }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 1rem;
}
.modal {
  background: var(--dark-3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.modal-title { font-family: var(--font-serif); font-size: 1.2rem; font-weight: 300; color: var(--light); }
.modal-close {
  background: none; border: none; font-size: 1.3rem; color: var(--text-muted);
  cursor: pointer; line-height: 1; padding: 0.2rem;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--light); }
.modal-body   { padding: 1.5rem; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* ---- Toast ---- */
.toast {
  display: inline-flex; align-items: center;
  padding: 0.5rem 1rem;
  background: var(--success); color: #fff;
  border-radius: var(--radius);
  font-size: 0.78rem; font-weight: 500;
  opacity: 0; transform: translateY(4px);
  transition: all 0.25s;
  pointer-events: none;
}
.toast--visible { opacity: 1; transform: none; }

/* ---- Gallery Admin Grid ---- */
.gallery-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  min-height: 80px;
}

.gallery-admin-item {
  position: relative;
  aspect-ratio: 4/5;
  background: var(--dark-4);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.07);
}
.gallery-admin-item img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.gallery-admin-item__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s;
}
.gallery-admin-item:hover .gallery-admin-item__overlay { opacity: 1; }
.gallery-admin-item__caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 0.4rem 0.5rem;
  background: rgba(0,0,0,0.65);
  font-size: 0.65rem;
  color: var(--light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Video preview (landscape ratio) */
.video-preview { aspect-ratio: 16/9 !important; width: 280px !important; }

.upload-size-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: -0.25rem;
  min-height: 1em;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  :root { --sidebar-w: 200px; }
  .admin-main { padding: 1.5rem; }
  .form-row { grid-template-columns: 1fr 1fr; }
  .photo-editor { flex-direction: column; }
}
@media (max-width: 480px) {
  .admin-app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; }
  .sidebar__nav { flex-direction: row; padding: 0.5rem; }
  .sidebar__footer { flex-direction: row; padding: 0.75rem 1rem; }
}
