/* ============================================================
   ФОТОАРХИВ — Cinematic Dark Aesthetic
   Fonts: Cormorant Garamond (display) + Syne (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=Syne:wght@400;500;600;700&display=swap');

/* ── Переменные ────────────────────────────────────────────── */
:root {
  --bg:           #0c0b09;
  --bg2:          #131210;
  --surface:      rgba(255,255,255,0.035);
  --surface-hover:rgba(255,255,255,0.065);
  --glass:        rgba(20,18,14,0.75);
  --gold:         #c9a84c;
  --gold-light:   #e8c97a;
  --gold-dim:     rgba(201,168,76,0.15);
  --text:         #f0ebe3;
  --text-dim:     #8a8070;
  --text-muted:   #4a453d;
  --border:       rgba(255,255,255,0.07);
  --border-gold:  rgba(201,168,76,0.3);
  --red:          #e05c5c;
  --green:        #5cae8a;
  --radius-sm:    10px;
  --radius:       18px;
  --radius-lg:    28px;
  --ease:         cubic-bezier(0.23,1,0.32,1);
  --ease-spring:  cubic-bezier(0.34,1.56,0.64,1);
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

html { scroll-behavior:smooth; }

body {
  font-family: 'Syne', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Зернистость плёнки — атмосферный оверлей */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.025;
  pointer-events: none;
  z-index: 9999;
}

/* Фоновый градиент */
body::after {
  content: '';
  position: fixed;
  top: -30%;
  left: -20%;
  width: 70vw;
  height: 70vw;
  background: radial-gradient(ellipse, rgba(201,168,76,0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px;
  position: relative;
  z-index: 1;
}

/* ── Header ────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  background: var(--glass);
  animation: slideDown 0.6s var(--ease) both;
}

@keyframes slideDown {
  from { transform:translateY(-100%); opacity:0; }
  to   { transform:translateY(0);     opacity:1; }
}

.header__container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.header__logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 600;
  font-style: italic;
  letter-spacing: 0.02em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.header__logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-style: normal;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.header__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header__username {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Кнопки ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 100px;
  font-family: 'Syne', sans-serif;
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.25s var(--ease);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  transition: opacity 0.2s;
}

.btn:hover::before { opacity: 0.05; }
.btn:active { transform: scale(0.97); }

.btn--primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: #0c0b09;
  font-weight: 700;
  box-shadow: 0 4px 24px rgba(201,168,76,0.25);
}

.btn--primary:hover {
  box-shadow: 0 6px 32px rgba(201,168,76,0.4);
  transform: translateY(-1px);
}

.btn--ghost {
  background: var(--surface);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  color: var(--text);
  border-color: rgba(255,255,255,0.15);
}

.btn--admin {
  background: var(--gold-dim);
  color: var(--gold);
  border: 1px solid var(--border-gold);
}

.btn--admin:hover {
  background: rgba(201,168,76,0.22);
}

/* ── Main ───────────────────────────────────────────────────── */
.main {
  flex: 1;
  padding: 48px 0 80px;
  position: relative;
  z-index: 1;
}

/* ── Секция загрузки ───────────────────────────────────────── */
.upload-section {
  animation: fadeUp 0.7s 0.1s var(--ease) both;
  margin-bottom: 56px;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 20px;
}

.section-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 300;
  font-style: italic;
  color: var(--text);
  letter-spacing: -0.01em;
}

.section-count {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Upload area */
.upload-area {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 52px 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.35s var(--ease);
  background: var(--surface);
  position: relative;
  overflow: hidden;
}

.upload-area::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, transparent 40%, var(--gold-dim) 100%);
  opacity: 0;
  transition: opacity 0.4s;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--border-gold);
  background: rgba(201,168,76,0.04);
}

.upload-area:hover::before,
.upload-area.drag-over::before { opacity: 1; }

/* Анимированная иконка загрузки */
.upload-icon-wrap {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--gold-dim);
  border: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.35s var(--ease-spring);
}

.upload-area:hover .upload-icon-wrap,
.upload-area.drag-over .upload-icon-wrap {
  transform: scale(1.1) translateY(-4px);
  background: rgba(201,168,76,0.2);
  box-shadow: 0 12px 40px rgba(201,168,76,0.2);
}

.upload-icon {
  font-size: 1.6rem;
  transition: transform 0.35s var(--ease-spring);
}

.upload-area:hover .upload-icon { transform: translateY(-3px); }

.upload-text {
  font-size: 0.95rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.upload-text strong {
  color: var(--gold);
  font-weight: 600;
}

.upload-hint {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* Прогресс */
.upload-progress {
  margin-top: 28px;
  text-align: left;
}

.progress-track {
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: 2px;
  transition: width 0.3s var(--ease);
  position: relative;
}

/* Shimmer на прогресс-баре */
.progress-fill::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 60px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  from { transform: translateX(-60px); }
  to   { transform: translateX(60px); }
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* Статусы */
.status-message {
  margin-top: 16px;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  display: none;
  animation: fadeUp 0.3s var(--ease);
}

.status-message.visible { display: flex; align-items: center; gap: 10px; }

.status-message.success {
  background: rgba(92,174,138,0.1);
  border: 1px solid rgba(92,174,138,0.25);
  color: var(--green);
}

.status-message.error {
  background: rgba(224,92,92,0.1);
  border: 1px solid rgba(224,92,92,0.25);
  color: var(--red);
}

/* ── Галерея ─────────────────────────────────────────────────── */
.gallery-section {
  animation: fadeUp 0.7s 0.25s var(--ease) both;
}

/* Masonry-inspired grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

/* Карточка */
.image-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  aspect-ratio: 1 / 1;
  transition: all 0.4s var(--ease);
  animation: cardIn 0.5s var(--ease) both;
}

@keyframes cardIn {
  from { opacity:0; transform:scale(0.92) translateY(16px); }
  to   { opacity:1; transform:scale(1)    translateY(0); }
}

/* Stagger для карточек */
.image-card:nth-child(1)  { animation-delay: 0.05s; }
.image-card:nth-child(2)  { animation-delay: 0.10s; }
.image-card:nth-child(3)  { animation-delay: 0.15s; }
.image-card:nth-child(4)  { animation-delay: 0.20s; }
.image-card:nth-child(5)  { animation-delay: 0.25s; }
.image-card:nth-child(6)  { animation-delay: 0.30s; }
.image-card:nth-child(n+7){ animation-delay: 0.35s; }

.image-card:hover {
  transform: translateY(-6px) scale(1.01);
  border-color: var(--border-gold);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px var(--border-gold);
}

.image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease), filter 0.4s;
  display: block;
}

.image-card:hover img {
  transform: scale(1.06);
  filter: brightness(0.75);
}

/* Оверлей карточки */
.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 40%,
    rgba(12,11,9,0.5) 70%,
    rgba(12,11,9,0.9) 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}

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

.card-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translateY(8px);
  transition: transform 0.35s var(--ease);
}

.card-date {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 2px;
  transform: translateY(8px);
  transition: transform 0.35s 0.04s var(--ease);
}

.image-card:hover .card-name,
.image-card:hover .card-date { transform: translateY(0); }

/* Кнопка удаления */
.card-delete {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(12,11,9,0.7);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  opacity: 0;
  transform: scale(0.8) rotate(-15deg);
  transition: all 0.3s var(--ease-spring);
  z-index: 10;
}

.image-card:hover .card-delete {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.card-delete:hover {
  background: var(--red);
  border-color: transparent;
  color: white;
  transform: scale(1.1) rotate(0deg) !important;
}

/* Mobile: всегда видна кнопка удаления */
@media (hover: none) {
  .card-overlay { opacity: 1; }
  .card-delete  { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* ── Пустое состояние ──────────────────────────────────────── */
.empty-state {
  display: none;
  text-align: center;
  padding: 80px 24px;
  animation: fadeUp 0.5s var(--ease);
}

.empty-state__icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--gold-dim);
  border: 1px solid var(--border-gold);
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.empty-state__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  font-weight: 300;
  font-style: italic;
  margin-bottom: 8px;
}

.empty-state__sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

/* ── Модальное окно ────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,0);
  pointer-events: none;
  transition: background 0.4s var(--ease);
}

.modal.open {
  background: rgba(0,0,0,0.92);
  pointer-events: all;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.modal__img-wrap {
  position: relative;
  max-width: min(90vw, 1200px);
  max-height: 90vh;
  opacity: 0;
  transform: scale(0.88);
  transition: all 0.45s var(--ease-spring);
}

.modal.open .modal__img-wrap {
  opacity: 1;
  transform: scale(1);
}

.modal__img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius);
  display: block;
  box-shadow: 0 40px 120px rgba(0,0,0,0.8);
}

.modal__close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.25s var(--ease-spring);
}

.modal__close:hover {
  color: var(--text);
  border-color: var(--border-gold);
  transform: scale(1.1) rotate(90deg);
}

/* ── Анимации ──────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity:0; transform:translateY(24px); }
  to   { opacity:1; transform:translateY(0);    }
}

/* Скелетон-лоадер для карточек */
.card-skeleton {
  border-radius: var(--radius);
  aspect-ratio: 1/1;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s infinite;
}

@keyframes skeleton {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ── Auth страницы ─────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

/* Декоративные круги на auth-странице */
.auth-page::before,
.auth-page::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
}

.auth-page::before {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(201,168,76,0.06) 0%, transparent 70%);
  top: -200px;
  right: -200px;
}

.auth-page::after {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(201,168,76,0.04) 0%, transparent 70%);
  bottom: -100px;
  left: -100px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(20,18,14,0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  animation: authIn 0.7s var(--ease-spring) both;
  position: relative;
  z-index: 1;
}

@keyframes authIn {
  from { opacity:0; transform:translateY(32px) scale(0.96); }
  to   { opacity:1; transform:translateY(0)    scale(1);    }
}

.auth-logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201,168,76,0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(201,168,76,0); }
}

.auth-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 36px;
  text-transform: uppercase;
}

/* Поля формы */
.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.field input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-family: 'Syne', sans-serif;
  font-size: 0.92rem;
  color: var(--text);
  outline: none;
  transition: all 0.25s var(--ease);
}

.field input::placeholder { color: var(--text-muted); }

.field input:focus {
  border-color: var(--border-gold);
  background: rgba(201,168,76,0.04);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.08);
}

.field-hint {
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

/* Кнопка сабмита */
.btn-submit {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  color: #0c0b09;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Syne', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.3s var(--ease);
  box-shadow: 0 4px 24px rgba(201,168,76,0.2);
}

.btn-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(201,168,76,0.35);
}

.btn-submit:active:not(:disabled) { transform: scale(0.98); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* Сообщения на auth */
.auth-error {
  background: rgba(224,92,92,0.08);
  border: 1px solid rgba(224,92,92,0.2);
  color: #e07070;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  margin-bottom: 20px;
  animation: fadeUp 0.3s var(--ease);
}

.auth-success {
  background: rgba(92,174,138,0.08);
  border: 1px solid rgba(92,174,138,0.2);
  color: var(--green);
  padding: 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 20px;
  animation: fadeUp 0.3s var(--ease);
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}
.auth-footer a:hover { color: var(--gold-light); }

/* reCAPTCHA тёмная */
.recaptcha-wrap {
  margin: 20px 0;
  display: flex;
  justify-content: center;
  filter: invert(0.9) hue-rotate(180deg);
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Адаптив ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .container { padding: 0 16px; }

  .header__container { height: 56px; }
  .header__logo      { font-size: 1.25rem; }
  .header__username  { display: none; }

  .main { padding: 32px 0 60px; }

  .section-title { font-size: 1.6rem; }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }

  .upload-area { padding: 36px 20px; }
  .upload-icon-wrap { width: 56px; height: 56px; }

  .auth-card { padding: 32px 24px; }
  .auth-logo { font-size: 1.6rem; }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .card-delete  { opacity: 1; transform: scale(1); }
  .card-overlay { opacity: 1; }
  .card-name    { transform: none; }
  .card-date    { transform: none; }
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Выделение ─────────────────────────────────────────────── */
::selection { background: var(--gold-dim); color: var(--gold-light); }
