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

:root {
  --bg:           #0d0b07;
  --surface:      #181510;
  --surface-2:    #201d12;
  --border:       #2c2718;
  --border-gold:  #5a4c1a;
  --text:         #f0e8d0;
  --muted:        #7a7050;
  --accent:       #c8920c;
  --accent-light: #f0b820;
  --accent-glow:  rgba(200, 146, 12, 0.18);
  --danger:       #c04848;
  --radius:       10px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Inter', system-ui, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
}

.hidden { display: none !important; }

.error {
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.info {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

/* ── Login ──────────────────────────────────────────────────── */

#login-screen {
  align-items: center;
  background:
    radial-gradient(ellipse at 50% 60%, rgba(200, 146, 12, 0.08) 0%, transparent 65%),
    var(--bg);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(200, 146, 12, 0.06),
    0 8px 40px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(200, 146, 12, 0.05);
  padding: 2.5rem 2.25rem 2rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

/* CSS rose icon on login */
.rose-mark {
  margin: 0 auto 1.25rem;
  width: 72px;
  height: 72px;
  filter: drop-shadow(0 0 12px rgba(240, 184, 32, 0.4));
}

.rose-mark svg { width: 100%; height: 100%; }

.login-card h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 0.5rem;
}

/* Decorative rule below heading */
.login-card h1::after {
  content: '';
  display: block;
  height: 2px;
  width: 48px;
  margin: 0.5rem auto 1.5rem;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border-radius: 1px;
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  text-align: left;
}

label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

input[type="email"],
input[type="password"] {
  background: var(--bg);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.65rem 0.85rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}

button[type="submit"] {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border: none;
  border-radius: var(--radius);
  color: #0d0b07;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-top: 0.5rem;
  padding: 0.75rem;
  transition: opacity 0.15s, box-shadow 0.15s;
}

button[type="submit"]:hover {
  box-shadow: 0 4px 20px rgba(200, 146, 12, 0.45);
  opacity: 0.92;
}

button[type="submit"]:active { opacity: 0.8; }

/* ── Header ─────────────────────────────────────────────────── */

header {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border-gold);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.4);
  display: flex;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* ── Breadcrumb ─────────────────────────────────────────────── */

.breadcrumb {
  align-items: center;
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 0.25rem;
  min-width: 0;
}

.crumb-item {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.875rem;
  padding: 0.1rem 0.2rem;
  transition: color 0.15s;
  white-space: nowrap;
}

.crumb-item:hover { color: var(--accent-light); }

.crumb-current {
  color: var(--text);
  cursor: default;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

.crumb-current:hover { color: var(--text); }

.crumb-sep {
  color: var(--border-gold);
  font-size: 0.8rem;
  user-select: none;
}

/* ── Filter buttons ─────────────────────────────────────────── */

.filters { display: flex; gap: 0.5rem; }

.filter-btn {
  background: transparent;
  border: 1px solid var(--border-gold);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.875rem;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.filter-btn.active,
.filter-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent-light);
}

#sign-out-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  font-family: var(--font-body);
  font-size: 0.78rem;
  padding: 0.3rem 0.875rem;
  transition: border-color 0.15s, color 0.15s;
}

#sign-out-btn:hover { border-color: var(--danger); color: var(--danger); }

/* ── Rose banner (root folder view only) ────────────────────── */

#folder-banner {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  overflow: hidden;
  width: 100%;
}

#folder-banner svg {
  display: block;
  filter: drop-shadow(0 0 18px rgba(200, 146, 12, 0.2));
  height: auto;
  max-height: 230px;
  width: 100%;
}

/* ── Folder grid ────────────────────────────────────────────── */

#folder-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  padding: 1.5rem;
}

.folder-card {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  padding: 1.75rem 1rem 1.375rem;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  user-select: none;
}

.folder-card:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  box-shadow: 0 4px 20px var(--accent-glow), 0 0 0 1px var(--accent-glow);
}

/* CSS folder icon */
.folder-icon {
  background: linear-gradient(150deg, var(--accent-light), var(--accent));
  border-radius: 0 8px 8px 8px;
  box-shadow: 0 2px 10px rgba(200, 146, 12, 0.35);
  height: 44px;
  position: relative;
  width: 56px;
}

.folder-icon::before {
  background: linear-gradient(150deg, var(--accent-light), var(--accent));
  border-radius: 5px 5px 0 0;
  content: "";
  height: 9px;
  left: 0;
  position: absolute;
  top: -9px;
  width: 46%;
}

.folder-name {
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

/* ── Section label (between subfolders and files) ───────────── */

.section-label {
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  padding: 0.75rem 1.25rem 0.25rem;
  text-transform: uppercase;
}

/* ── Loading / empty states ─────────────────────────────────── */

#loading-msg {
  color: var(--muted);
  padding: 4rem;
  text-align: center;
}

#gallery-error { padding: 2rem; text-align: center; }

.empty-msg {
  color: var(--muted);
  grid-column: 1 / -1;
  padding: 4rem;
  text-align: center;
}

/* ── Media grid ─────────────────────────────────────────────── */

#media-grid {
  background: var(--border);
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.media-card {
  aspect-ratio: 4 / 3;
  background: var(--surface);
  cursor: pointer;
  overflow: hidden;
  position: relative;
}

.media-card img,
.media-card video {
  display: block;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  width: 100%;
}

.media-card:hover img,
.media-card:hover video { transform: scale(1.05); }

.video-badge {
  align-items: center;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 50%;
  color: #fff;
  display: flex;
  font-size: 1.5rem;
  height: 3rem;
  justify-content: center;
  left: 50%;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 3rem;
}

.card-footer {
  align-items: flex-end;
  background: linear-gradient(transparent, rgba(13, 11, 7, 0.92));
  bottom: 0;
  display: flex;
  justify-content: space-between;
  left: 0;
  opacity: 0;
  padding: 2rem 0.75rem 0.75rem;
  position: absolute;
  right: 0;
  transition: opacity 0.2s;
}

.media-card:hover .card-footer { opacity: 1; }

.card-name {
  font-size: 0.75rem;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-download {
  background: rgba(200, 146, 12, 0.25);
  border-radius: 4px;
  color: var(--accent-light);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
}

.card-download:hover { background: rgba(200, 146, 12, 0.45); }

/* ── Modal ──────────────────────────────────────────────────── */

#modal {
  align-items: center;
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 1.5rem;
  position: fixed;
  z-index: 100;
}

#modal-backdrop {
  background: rgba(7, 6, 3, 0.94);
  inset: 0;
  position: absolute;
}

#modal-content {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 90vh;
  max-width: min(92vw, 1280px);
  position: relative;
}

#modal-img {
  border-radius: var(--radius);
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.7);
  max-height: 80vh;
  max-width: 100%;
  object-fit: contain;
}

#modal-video {
  border-radius: var(--radius);
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.7);
  max-height: 80vh;
  max-width: 100%;
  width: min(92vw, 960px);
}

#modal-close {
  background: rgba(200, 146, 12, 0.15);
  border: 1px solid var(--border-gold);
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  height: 2rem;
  line-height: 1;
  position: absolute;
  right: 0;
  top: -2.75rem;
  transition: background 0.15s;
  width: 2rem;
}

#modal-close:hover { background: rgba(200, 146, 12, 0.35); }

#modal-prev,
#modal-next {
  align-items: center;
  background: rgba(13, 11, 7, 0.6);
  border: 1px solid var(--border-gold);
  border-radius: 50%;
  color: var(--accent-light);
  cursor: pointer;
  display: flex;
  font-size: 2.25rem;
  height: 3rem;
  justify-content: center;
  line-height: 1;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  width: 3rem;
  z-index: 101;
}

#modal-prev { left: 1rem; }
#modal-next { right: 1rem; }

#modal-prev:hover,
#modal-next:hover {
  background: rgba(200, 146, 12, 0.25);
  border-color: var(--accent);
}

#modal-prev:disabled,
#modal-next:disabled { cursor: default; opacity: 0.15; }

.download-pill {
  background: rgba(200, 146, 12, 0.18);
  border: 1px solid var(--border-gold);
  border-radius: 999px;
  color: var(--accent-light);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1.5rem;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.download-pill:hover {
  background: rgba(200, 146, 12, 0.32);
  border-color: var(--accent);
}
