:root {
  font-family: 'Inter', 'SF Pro Text', 'Segoe UI', sans-serif;
  line-height: 1.5;
  font-weight: 400;
  color-scheme: dark;
  color: #f7f7f4;
  background-color: #0b0b0c;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  --accent: #f0b36c;
  --muted: #a7aab3;
  --surface: #141418;
  --surface-elevated: #1d1e23;
  --border: #2b2d35;
  --text: #f7f7f4;
  --text-muted: #a7aab3;
  --background: #0b0b0c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #0b0b0c;
  color: inherit;
}

body.no-scroll {
  overflow: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--accent);
}

#app {
  min-height: 100vh;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.hero {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.hero-top .language-and-admin {
  flex: 1;
  min-width: 0;
  justify-content: flex-end;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.6rem, 5vw, 4.2rem);
  letter-spacing: -0.02em;
}

.hero-copy {
  margin: 0;
  max-width: 620px;
  color: var(--muted);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 16px 0 0;
}

.hero-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition:
    color 0.2s,
    border-color 0.2s,
    background 0.2s;
}

.hero-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.hero-folder-select {
  min-width: 160px;
  padding: 10px 36px 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%23f0b36c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease,
    background 0.2s ease;
}

.btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.btn.ghost {
  background: transparent;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.stat-value {
  display: block;
  font-size: 1.4rem;
  font-weight: 600;
}

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

.gallery {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.gallery-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.gallery-header h2 {
  margin: 0;
  font-size: 1.9rem;
}

/* Кастомный выпадающий список — триггер как обычный заголовок (без контейнера) */
.gallery-album-dropdown-wrap {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.gallery-links {
  margin: 0;
}

.gallery-album-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}

.gallery-album-trigger {
  margin: 0;
  padding: 0;
  font-size: 1.9rem;
  font-weight: inherit;
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.gallery-album-trigger:hover {
  color: var(--accent);
}

.gallery-album-trigger-text {
  border-bottom: 1px solid transparent;
}

.gallery-album-trigger:hover .gallery-album-trigger-text {
  border-bottom-color: var(--accent);
}

.gallery-album-trigger-icon {
  font-size: 0.75em;
  opacity: 0.7;
}

.gallery-album-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  min-width: 180px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  padding: 6px 0;
  z-index: 10;
}

.gallery-album-option {
  display: block;
  width: 100%;
  padding: 10px 16px;
  font-size: 1rem;
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.gallery-album-option:hover {
  background: var(--surface);
}

.gallery-album-option.is-selected {
  background: var(--surface);
}

.gallery-header p {
  margin: 0;
  color: var(--muted);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.tab {
  border: 1px solid var(--border);
  background: var(--surface);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: inherit;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.tab:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.tab.is-active,
.tab[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--accent);
  color: #131316;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  grid-auto-rows: 8px;
  grid-auto-flow: dense;
  gap: 16px;
}

.gallery-sentinel {
  height: 1px;
  width: 100%;
}

.gallery-card {
  position: relative;
  background: var(--surface);
  border-radius: 18px;
  overflow: hidden;
  min-height: 150px;
  grid-row: span var(--row-span);
  content-visibility: auto;
  contain-intrinsic-size: 220px 180px;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.gallery-card-open {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.gallery-card-open img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  padding: 16px;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 20%,
    rgba(0, 0, 0, 0.7) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-title {
  font-size: 1rem;
  font-weight: 600;
}

.gallery-subtitle {
  font-size: 0.85rem;
  color: #d0d4db;
}

.gallery-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.gallery-card:hover .gallery-card-open img {
  transform: scale(1.04);
}

.gallery-card:hover .gallery-overlay {
  opacity: 1;
}

.lightbox-video {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
}

.lightbox .hidden {
  display: none !important;
}

.gallery-card-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  color: #fff;
  font-size: 1.5rem;
  padding-left: 4px;
  line-height: 1;
}

.gallery-card-download {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  height: 34px;
  min-width: 34px;
  padding: 0 10px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    background 0.18s ease;
}

.gallery-card:hover .gallery-card-download,
.gallery-card:focus-within .gallery-card-download {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.gallery-card-download:hover {
  background: rgba(0, 0, 0, 0.7);
}

.gallery-card-download[data-downloading='true'] {
  cursor: pointer;
  opacity: 0.95;
}

.gallery-card-download-label {
  font-size: 0.8rem;
  line-height: 1;
  white-space: nowrap;
}

@media (pointer: coarse) {
  .gallery-card-download {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
}

.gallery-grid[data-layout='classic'] {
  grid-auto-rows: 180px;
  grid-auto-flow: row;
}

.gallery-grid[data-layout='classic'] .gallery-card {
  grid-row: span 1;
}

.gallery-grid[data-layout='fixed'] {
  grid-auto-rows: auto;
  grid-auto-flow: row;
}

.gallery-grid[data-layout='fixed'] .gallery-card {
  grid-row: span 1;
  aspect-ratio: 4 / 3;
}

.gallery-grid[data-layout='editorial'] {
  grid-auto-rows: 10px;
  grid-auto-flow: dense;
}

.gallery-grid[data-layout='editorial'] .gallery-card {
  grid-row: span 18;
}

.gallery-grid[data-layout='editorial'] .gallery-card:nth-child(6n + 1) {
  grid-column: span 2;
  grid-row: span 28;
}

.gallery-grid[data-layout='editorial'] .gallery-card:nth-child(6n + 4) {
  grid-column: span 2;
  grid-row: span 24;
}

.gallery-grid[data-layout='dense'] {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  grid-auto-rows: 7px;
  gap: 8px;
}

.gallery-grid[data-layout='airy'] {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  grid-auto-rows: 10px;
  gap: 20px;
}

.gallery-grid[data-layout='horizontal'] {
  display: flex;
  overflow-x: auto;
  gap: 16px;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}

.gallery-grid[data-layout='horizontal'] .gallery-card {
  flex: 0 0 clamp(200px, 30vw, 320px);
  grid-row: auto;
  aspect-ratio: 4 / 3;
  scroll-snap-align: start;
}

.gallery-grid[data-layout='cascade'] {
  grid-auto-rows: 10px;
  grid-auto-flow: dense;
}

.gallery-grid[data-layout='cascade'] .gallery-card {
  grid-row: span 16;
}

.gallery-grid[data-layout='cascade'] .gallery-card:nth-child(4n + 1) {
  grid-column: span 2;
  grid-row: span 28;
}

.gallery-grid[data-layout='cascade'] .gallery-card:nth-child(4n + 3) {
  grid-column: span 2;
  grid-row: span 24;
}

.gallery-grid[data-layout='spotlight'] {
  grid-auto-rows: 10px;
  grid-auto-flow: dense;
}

.gallery-grid[data-layout='spotlight'] .gallery-card {
  grid-row: span 16;
}

.gallery-grid[data-layout='spotlight'] .gallery-card:nth-child(7n) {
  grid-column: span 2;
  grid-row: span 26;
}

.gallery-grid[data-layout='zigzag'] {
  grid-auto-rows: 8px;
  grid-auto-flow: dense;
}

.gallery-grid[data-layout='zigzag'] .gallery-card {
  grid-row: span 18;
}

.gallery-grid[data-layout='zigzag'] .gallery-card:nth-child(odd) {
  margin-top: 8px;
}

.gallery-grid[data-layout='zigzag'] .gallery-card:nth-child(3n) {
  grid-row: span 22;
}

.gallery-grid[data-layout='split'] {
  grid-template-columns:
    minmax(180px, 1fr)
    minmax(240px, 1.2fr)
    minmax(240px, 1.2fr);
  grid-auto-rows: 10px;
  grid-auto-flow: dense;
}

.gallery-grid[data-layout='split'] .gallery-card {
  grid-row: span 15;
}

.gallery-grid[data-layout='split'] .gallery-card:nth-child(3n) {
  grid-column: 2 / -1;
  grid-row: span 24;
}

.gallery-grid[data-layout='showcase'] {
  grid-auto-rows: 10px;
  grid-auto-flow: dense;
}

.gallery-grid[data-layout='showcase'] .gallery-card {
  grid-row: span 16;
}

.gallery-grid[data-layout='showcase'] .gallery-card:first-child {
  grid-column: 1 / -1;
  grid-row: span 28;
}

.gallery-grid[data-layout='tiles'] {
  grid-auto-rows: 10px;
  grid-auto-flow: dense;
}

.gallery-grid[data-layout='tiles'] .gallery-card {
  grid-row: span 14;
}

.gallery-grid[data-layout='tiles'] .gallery-card:nth-child(9n + 1),
.gallery-grid[data-layout='tiles'] .gallery-card:nth-child(9n + 6) {
  grid-column: span 2;
  grid-row: span 28;
}

.gallery-grid[data-layout='stacked'] {
  grid-auto-flow: column;
  grid-auto-columns: minmax(190px, 1fr);
  grid-auto-rows: 10px;
  gap: 10px;
}

.gallery-grid[data-layout='stacked'] .gallery-card {
  grid-row: span 16;
}

.gallery-grid[data-layout='panorama'] {
  grid-auto-rows: 8px;
  grid-auto-flow: dense;
}

.gallery-grid[data-layout='panorama'] .gallery-card {
  grid-row: span 16;
}

.gallery-grid[data-layout='panorama'] .gallery-card:nth-child(5n) {
  grid-column: span 2;
  grid-row: span 12;
}

.gallery-grid[data-layout='panorama'] .gallery-card:nth-child(5n) img {
  object-position: center;
}

.footer {
  border-top: 1px solid var(--border);
  padding-top: 28px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
  justify-content: space-between;
}

.footer-inner h2 {
  margin: 0 0 8px;
}

.footer-inner p {
  margin: 0;
  color: var(--muted);
  max-width: 360px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-links a {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.9rem;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease;
}

.footer-links a:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  color: #fff;
}

.lightbox {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 6, 8, 0.78);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 50;
  padding: 24px;
}

.lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
  border: none;
}

.lightbox-content {
  position: relative;
  background: var(--surface-elevated);
  border-radius: 20px;
  padding: 24px;
  max-width: min(900px, 92vw);
  width: 100%;
  touch-action: pan-y;
  border: 1px solid var(--border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lightbox-image {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 18px;
  touch-action: pan-y;
  transition:
    filter 0.2s ease,
    transform 0.2s ease;
}

.lightbox-image.is-preview {
  /* Softer preview blur; do NOT scale (keeps size stable). */
  filter: blur(10px);
  will-change: filter;
}

.lightbox-caption {
  margin: 0;
  color: var(--muted);
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: auto;
}

.lightbox-download {
  position: absolute;
  top: 16px;
  right: 56px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  height: 32px;
  min-width: 32px;
  padding: 0 10px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.18s ease;
}

.lightbox-download-label {
  font-size: 0.8rem;
  line-height: 1;
  white-space: nowrap;
}

.lightbox-download:hover {
  background: rgba(0, 0, 0, 0.75);
}

/* Mobile: maximize visible photo area in lightbox */
@media (max-width: 640px) {
  .lightbox {
    padding: 0;
  }

  .lightbox-content {
    padding: 0;
    border-radius: 0;
    max-width: 100vw;
    width: 100vw;
    border: none;
  }

  .lightbox-image {
    border-radius: 0;
    max-height: 82vh;
  }

  .lightbox-caption {
    padding: 10px 12px 12px;
  }

  .lightbox-close {
    top: 12px;
    right: 12px;
  }

  .lightbox-download {
    top: 12px;
    right: 54px;
  }
}

/* Admin Panel Styles */
.admin-login-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 48px 24px;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 24px;
  padding: 24px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
}

.form-group input[type='email'],
.form-group input[type='password'],
.form-group input[type='text'],
.form-group input[type='number'],
.form-group input[type='file'],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-elevated);
  color: #fff;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.form-group select {
  font-size: 1.1rem;
  padding: 14px 40px 14px 18px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%23f0b36c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-group input[type='file'] {
  padding: 8px;
  cursor: pointer;
}

.links-settings-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.links-settings-add {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.links-settings-add input {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  min-width: 140px;
}

.links-settings-add input:focus {
  outline: none;
  border-color: var(--accent);
}

.links-settings-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.links-settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.links-settings-row .links-settings-title,
.links-settings-row .links-settings-url {
  flex: 1;
  min-width: 120px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
}

.links-settings-row .links-settings-delete {
  flex-shrink: 0;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.admin-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-left: auto;
}

.admin-nav .admin-nav-link {
  margin: 0;
  display: inline-flex;
  align-items: center;
}

.admin-bottom-nav {
  display: none;
}

.admin-bottom-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
  min-width: 0;
}

.admin-bottom-nav-link:hover {
  border-color: var(--accent);
  color: #fff;
}

.admin-bottom-nav-link.active,
.admin-bottom-nav-link[aria-current='page'] {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b0b0c;
}

.admin-nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 4px 8px;
  margin: 0;
  border-radius: 6px;
  transition:
    color 0.2s,
    background 0.2s;
}

.admin-nav-link:hover {
  color: var(--text);
}

.admin-nav-link.active {
  color: var(--accent);
  font-weight: 500;
  pointer-events: none;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

a.admin-nav-link:hover {
  background: var(--surface-elevated);
}

.admin-settings-layout {
  display: flex;
  gap: 32px;
  margin-top: 24px;
}

.admin-settings-sidebar {
  flex-shrink: 0;
  width: 200px;
}

.admin-settings-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-settings-sidebar-link {
  display: block;
  width: 100%;
  padding: 12px 16px;
  text-align: left;
  font-size: 0.95rem;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition:
    color 0.2s,
    background 0.2s;
}

.admin-settings-sidebar-link:hover {
  color: var(--text);
  background: var(--surface-elevated);
}

.admin-settings-sidebar-link.active {
  color: var(--text);
  font-weight: 500;
  background: var(--surface-elevated);
}

.admin-settings-content {
  flex: 1;
  min-width: 0;
}

.admin-settings-section-panel {
  display: block;
}

/* В настройках: заголовок секции, под ним описание */
.admin-settings-section .gallery-header {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 24px;
}

.admin-section-desc {
  margin: 0 0 20px;
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--muted);
  background: var(--surface);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

.btn.secondary {
  background: var(--surface-elevated);
  border-color: var(--border);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b0b0c;
}

.btn-primary:hover {
  background: #f5c07d;
  border-color: #f5c07d;
  color: #0b0b0c;
}

.btn.danger {
  background: #dc3545;
  border-color: #dc3545;
  color: #fff;
}

.btn.danger:hover {
  background: #c82333;
  border-color: #bd2130;
  color: #fff;
}

.btn.btn-small.danger {
  background: #dc3545;
  border-color: #dc3545;
  color: #fff;
}

.btn.btn-small.danger:hover {
  background: #c82333;
  border-color: #bd2130;
  color: #fff;
}

.btn.btn-danger,
.btn.btn-small.btn-danger {
  background: #dc3545;
  border-color: #dc3545;
  color: #fff;
}

.btn.btn-danger:hover,
.btn.btn-small.btn-danger:hover {
  background: #c82333;
  border-color: #bd2130;
  color: #fff;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn:disabled:hover {
  transform: none;
  border-color: var(--border);
}

.error {
  color: #dc3545;
  font-size: 0.9rem;
  padding: 12px;
  border-radius: 8px;
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.3);
}

.success {
  color: #28a745;
  font-size: 0.9rem;
  padding: 12px;
  border-radius: 8px;
  background: rgba(40, 167, 69, 0.1);
  border: 1px solid rgba(40, 167, 69, 0.3);
}

.hidden {
  display: none;
}

.loading {
  text-align: center;
  padding: 48px;
  color: var(--muted);
}

.storage-status-bar {
  margin-top: 12px;
  margin-bottom: 12px;
}

.storage-status-bar .upload-storage-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0;
}

.storage-progress-track {
  height: 10px;
  border-radius: 10px;
  background: var(--border);
  overflow: hidden;
}

.storage-progress-fill {
  height: 100%;
  border-radius: 10px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.storage-status-bar
  .upload-storage-info[data-near-limit]
  .storage-progress-fill {
  background: var(--warning, #f59e0b);
}

.storage-status-bar
  .upload-storage-info[data-over-limit]
  .storage-progress-fill {
  background: var(--error, #ef4444);
}

.storage-progress-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.storage-breakdown-label {
  font-size: 0.82rem;
  color: var(--muted);
}

.upload-storage-info.hidden {
  display: none;
}

.admin-upload-section {
  padding: 24px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.upload-storage-info {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.admin-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.admin-sort-toolbar {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: min(100%, 320px);
}

.admin-sort-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.admin-sort-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-sort-status.error {
  color: #ef4444;
}

.admin-photo-card {
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.admin-photo-card[draggable='true'] {
  cursor: grab;
}

.admin-photo-card[draggable='true']:active {
  cursor: grabbing;
}

.admin-photo-card.is-dragging {
  opacity: 0.55;
  transform: scale(0.98);
}

.admin-photo-card.is-drop-target {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.35);
}

.admin-photo-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.admin-photo-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.admin-photo-card-content {
  padding: 16px;
}

.admin-photo-card-title {
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 1rem;
}

.admin-photo-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.admin-media-kind {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.admin-media-status {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  margin-bottom: 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 3px 8px;
}

.admin-media-status.status-pending {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.45);
}

.admin-media-status.status-processing {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.45);
}

.admin-media-status.status-ready {
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.45);
}

.admin-media-status.status-failed {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.45);
}

.admin-photo-card-folder {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.admin-photo-card-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.admin-photo-card-meta {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 12px;
}

.admin-photo-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-media-placeholder {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.9rem;
  background: linear-gradient(135deg, var(--surface), var(--surface-elevated));
}

.admin-photo-card-edit {
  padding: 16px;
}

.admin-photo-card-edit .admin-form .form-group {
  margin-bottom: 12px;
}

.admin-photo-card-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* Edit Photo Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

.modal-content {
  position: relative;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  max-width: 480px;
  width: 100%;
  box-sizing: border-box;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-content .modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

.modal-close:hover {
  color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.media-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-media-preview-video {
  width: 100%;
  border-radius: 12px;
  background: #000;
  max-height: 70vh;
}

/* Mobile: make modals use more screen width */
@media (max-width: 640px) {
  .modal {
    padding: 12px;
  }

  .modal-content {
    max-width: 100%;
    padding: 16px;
    border-radius: 14px;
    max-height: 92svh;
  }

  .modal-content .modal-header {
    margin-bottom: 12px;
  }

  .modal-actions {
    margin-top: 12px;
  }
}

.inline-create-folder {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inline-create-folder .btn {
  align-self: flex-start;
}

.inline-create-folder-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.inline-create-folder-card .form-group:last-of-type {
  margin-bottom: 0;
}

.form-hint {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Upload Status */
.upload-status {
  margin: 16px 0;
  padding: 16px;
  background: var(--surface-elevated);
  border-radius: 8px;
  border: 1px solid var(--border);
  max-height: 400px;
  overflow-y: auto;
}

.upload-file-item {
  margin-bottom: 12px;
  padding: 12px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.upload-file-item:last-child {
  margin-bottom: 0;
}

.upload-file-name {
  font-weight: 500;
  color: #fff;
  margin-bottom: 4px;
  font-size: 0.9rem;
}

.upload-file-status {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.upload-file-status.status-success {
  color: #28a745;
  font-weight: 500;
}

.upload-file-status.status-error {
  color: #dc3545;
  font-weight: 500;
}

.upload-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #d4a05a);
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

/* Language Switcher + Admin link */
.language-and-admin {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.hero-share-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.hero-folder-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.language-switcher {
  display: none;
  gap: 8px;
}

.lang-btn.admin-link {
  text-decoration: none;
}

.lang-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.lang-btn:hover {
  border-color: var(--accent);
  color: #fff;
}

.lang-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #131316;
}

@media (max-width: 720px) {
  .page {
    /* Extra space for bottom navigation on mobile */
    padding: 36px 18px calc(64px + 76px + env(safe-area-inset-bottom));
  }

  /* Gallery page header: move admin nav to new line */
  .hero-top {
    align-items: flex-start;
  }

  .hero-top .language-and-admin {
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  .hero-top .admin-nav {
    width: 100%;
    margin-left: 0;
  }

  .admin-bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    gap: 10px;
    background: rgba(20, 20, 24, 0.92);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(12px);
  }

  .admin-bottom-nav-link {
    flex: 1;
  }

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

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

  .lightbox-content {
    padding: 16px;
  }

  .admin-photos-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-header {
    flex-direction: column;
  }

  /* Admin Settings: mobile-friendly layout */
  .admin-settings-layout {
    flex-direction: column;
    gap: 16px;
  }

  .admin-settings-sidebar {
    width: 100%;
  }

  .admin-settings-sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .admin-settings-sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .admin-settings-sidebar-link {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 10px 12px;
    border: 1px solid var(--border);
    background: var(--surface);
  }

  .admin-settings-sidebar-link.active {
    border-color: var(--accent);
  }

  .admin-settings-content {
    width: 100%;
  }

  .admin-form {
    padding: 16px;
  }

  .links-settings-add {
    flex-direction: column;
    align-items: stretch;
  }

  .links-settings-add input {
    min-width: 0;
    width: 100%;
  }

  .links-settings-add #linksAddBtn {
    width: 100%;
  }

  .links-settings-row {
    flex-direction: column;
    align-items: stretch;
  }

  .links-settings-row .links-settings-delete {
    width: 100%;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
  }
}

/* Folder styles */
.folders-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

.folder-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  justify-content: stretch;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition:
    border-color 0.2s ease,
    transform 0.2s ease;
  gap: 14px 16px;
  text-align: left;
}

.folder-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.folder-info {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

.folder-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  min-width: 0;
}

.folder-badges {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.folder-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.25;
  min-width: 0;
  word-break: break-word;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.folder-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  line-height: 1;
  opacity: 0.9;
}

.folder-name-text {
  min-width: 0;
  word-break: break-word;
}

.folder-type-icons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.folder-visibility-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}

.folder-visibility-public {
  background: rgba(76, 175, 80, 0.2);
  color: #4caf50;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.folder-visibility-private {
  background: rgba(255, 152, 0, 0.2);
  color: #ff9800;
  border: 1px solid rgba(255, 152, 0, 0.3);
}

.folder-visibility-hidden {
  background: rgba(158, 158, 158, 0.2);
  color: #9e9e9e;
  border: 1px solid rgba(158, 158, 158, 0.3);
}

.folder-password-badge {
  display: inline-block;
  margin-left: 0;
  font-size: 1.2rem;
  vertical-align: middle;
  cursor: help;
}

.folder-type-lock-badge {
  display: inline-block;
  margin-left: 0;
  font-size: 1.2rem;
  vertical-align: middle;
  cursor: help;
}

.folder-link {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  max-width: 560px;
}

.folder-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
}

.folder-link .btn {
  flex: 0 1 auto;
  min-width: 0;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-link-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  font-size: 0.85rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
}

.folder-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: flex-start;
  align-items: stretch;
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.9rem;
}

.edit-folder-form {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 16px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-elevated);
}

.edit-folder-form-content h3 {
  margin: 0 0 20px 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface);
  border-color: var(--accent);
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font-size: 0.9rem;
  margin-top: 4px;
}

.btn-link:hover {
  color: #f0b36c;
}

.btn-link-danger {
  color: #dc3545;
}

.btn-link-danger:hover {
  color: #c82333;
}

@media (max-width: 720px) {
  .folder-item {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .folder-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .folder-actions .btn {
    padding-left: 12px;
    padding-right: 12px;
  }

  .folder-title-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .folder-badges {
    justify-content: flex-start;
  }
}

@media (max-width: 420px) {
  .folder-actions {
    grid-template-columns: 1fr;
  }

  /* Keep input+button in one row without overflow */
  .folder-link {
    gap: 6px;
  }

  .folder-link-input {
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  .folder-link .btn {
    padding: 8px 12px;
    font-size: 0.85rem;
    max-width: 42%;
  }
}

/* Status toast (custom UI вместо alert) */
.status-toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 10000;
  transition: transform 0.3s ease;
  pointer-events: none;
}

.status-toast-container.status-toast-visible {
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.status-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  max-width: min(420px, calc(100vw - 32px));
  min-width: 280px;
}

.status-toast-success {
  background: #1a3320;
  border: 1px solid #2d5a3a;
  color: #a8e6a0;
}

.status-toast-error {
  background: #331a1a;
  border: 1px solid #5a2d2d;
  color: #e6a0a0;
}

.status-toast-message {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.4;
}

.status-toast-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-toast-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}
