:root {
  color-scheme: dark;
  --bg: #111315;
  --panel: rgba(29, 32, 35, 0.9);
  --panel-strong: #25292d;
  --border: rgba(255, 255, 255, 0.11);
  --text: #f5f1eb;
  --muted: #b8b0a7;
  --accent: #db7b43;
  --accent-dark: #bd5f2d;
  --success: #173c2a;
  --success-text: #9be3b7;
  --error: #49221f;
  --error-text: #ffb4a8;
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.34);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(137, 70, 34, 0.3), transparent 36%),
    radial-gradient(circle at right center, rgba(85, 61, 44, 0.22), transparent 32%),
    linear-gradient(180deg, #151719 0%, #0d0f11 100%);
}

.page-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
}

.nav-link:hover {
  color: var(--text);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.user-chip {
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
}

.hero-card,
.photo-card,
.folder-card,
.empty-state {
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero-card {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1.5rem;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.login-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  max-width: 980px;
  margin: 4rem auto 0;
}

.hero-card.auth-card {
  grid-template-columns: 1fr;
  align-content: start;
  margin-bottom: 0;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

.lede {
  color: var(--muted);
  max-width: 60ch;
}

.auth-form,
.upload-form {
  display: grid;
  gap: 1rem;
}

.upload-destination {
  margin-bottom: 0;
  color: var(--muted);
  word-break: break-word;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.stat-card,
.admin-table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 1rem 1.1rem;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-value {
  display: block;
  margin-top: 0.45rem;
  font-size: 1.6rem;
}

label span {
  display: block;
  margin-bottom: 0.45rem;
  font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="file"] {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-strong);
  color: var(--text);
}

input:focus-visible,
.button:focus-visible,
.brand:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(219, 123, 67, 0.48);
  outline-offset: 3px;
}

input::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #353a3f;
  color: var(--text);
  cursor: pointer;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.8rem 1.2rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.button:hover {
  background: var(--accent-dark);
}

.button-secondary {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  border: 1px solid var(--border);
}

.button-secondary:hover {
  background: rgba(255, 255, 255, 0.13);
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0 0 1rem;
  color: var(--muted);
}

.breadcrumbs a {
  color: var(--accent);
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.photo-card {
  overflow: hidden;
}

.folder-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-height: 92px;
  padding: 1.2rem;
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 700;
}

.folder-card:hover {
  border-color: rgba(219, 123, 67, 0.55);
  transform: translateY(-2px);
}

.folder-icon {
  position: relative;
  width: 42px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 5px;
  background: var(--accent);
}

.folder-icon::before {
  position: absolute;
  top: -7px;
  left: 3px;
  width: 18px;
  height: 9px;
  border-radius: 4px 4px 0 0;
  background: var(--accent);
  content: "";
}

.photo-card img,
.photo-card video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #0a0c0e;
}

.video-preview {
  position: relative;
  display: block;
}

.play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(10, 12, 14, 0.78);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -50%);
}

.play-icon::after {
  position: absolute;
  top: 50%;
  left: 53%;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 17px solid #fff;
  content: "";
  transform: translate(-40%, -50%);
}

.photo-meta {
  display: grid;
  gap: 0.5rem;
  padding: 1rem;
}

.photo-meta h2 {
  font-size: 1rem;
  word-break: break-word;
}

.photo-meta p {
  margin-bottom: 0;
  color: var(--muted);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 2rem;
  text-align: center;
}

.admin-table-wrap {
  overflow: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.session-user {
  display: grid;
  gap: 0.2rem;
}

.session-user span {
  color: var(--muted);
  font-size: 0.92rem;
  word-break: break-word;
}

.session-actions {
  width: 1%;
  white-space: nowrap;
}

.flash-stack {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.flash {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.flash-success {
  background: var(--success);
  color: var(--success-text);
}

.flash-error {
  background: var(--error);
  color: var(--error-text);
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 1rem, 100%);
  }

  .site-header,
  .header-actions,
  .hero-card,
  .login-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .login-grid {
    margin-top: 2rem;
  }

  .top-nav {
    flex-wrap: wrap;
  }

  .header-actions {
    justify-items: start;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}
