:root {
  --primary:      #6366f1;
  --primary-dark: #4f46e5;
  --danger:       #ef4444;
  --danger-dark:  #dc2626;
  --success-bg:   #dcfce7;
  --success-text: #166534;
  --success-border:#bbf7d0;
  --error-bg:     #fee2e2;
  --error-text:   #991b1b;
  --error-border: #fecaca;
  --bg:           #f1f5f9;
  --card:         #ffffff;
  --text:         #1e293b;
  --muted:        #64748b;
  --border:       #e2e8f0;
  --nav-bg:       #1e293b;
  --nav-height:   60px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Navbar ───────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--nav-bg);
  height: var(--nav-height);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}

.nav-brand {
  color: #fff;
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.nav-user {
  color: #94a3b8;
  font-size: .875rem;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  padding: .5rem 1rem;
  border-radius: 6px;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
  line-height: 1;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline {
  background: transparent;
  color: #e2e8f0;
  border-color: #475569;
}
.btn-outline:hover { background: #334155; }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: .375rem .75rem; font-size: .8125rem; }
.btn-full { width: 100%; padding: .75rem; }

.btn:disabled { opacity: .5; cursor: not-allowed; }

.copy-btn.copied { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Auth pages ───────────────────────────────────────────────────────────── */
.auth-body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-card {
  background: var(--card);
  border-radius: 14px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,.25);
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}
.auth-logo svg {
  width: 48px;
  height: 48px;
  color: var(--primary);
}

.auth-card h1 {
  font-size: 1.75rem;
  font-weight: 800;
  text-align: center;
  color: var(--primary);
  margin-bottom: .25rem;
}

.auth-sub {
  color: var(--muted);
  text-align: center;
  font-size: .875rem;
  margin-bottom: 1.5rem;
}

.auth-form .form-group { margin-bottom: 1rem; }

.auth-form label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: .3rem;
}

.auth-form label small { color: var(--muted); font-weight: 400; }

.auth-form input {
  width: 100%;
  padding: .625rem .875rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.auth-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

.auth-form .btn { margin-top: .5rem; }

.auth-link {
  text-align: center;
  margin-top: 1.25rem;
  font-size: .875rem;
  color: var(--muted);
}
.auth-link a { color: var(--primary); text-decoration: none; font-weight: 500; }
.auth-link a:hover { text-decoration: underline; }

/* ── Flash ────────────────────────────────────────────────────────────────── */
.flash {
  padding: .75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: .875rem;
  font-weight: 500;
}

.flash-success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.flash-error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
}

/* ── Main layout ──────────────────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.card {
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 1.5rem;
}

/* ── Upload section ───────────────────────────────────────────────────────── */
.upload-section { margin-bottom: 2rem; }
.upload-section h2 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 2.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(99,102,241,.04);
}

.drop-zone.has-file {
  border-color: var(--primary);
  border-style: solid;
}

.drop-icon {
  width: 44px;
  height: 44px;
  color: var(--muted);
  margin: 0 auto .75rem;
  display: block;
}

.drop-zone p { color: var(--muted); font-size: .875rem; }
.drop-hint { font-size: .75rem; margin-top: .3rem; }

.upload-link {
  color: var(--primary);
  cursor: pointer;
  font-weight: 500;
  text-decoration: underline;
}

.upload-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: 1rem;
}

.selected-file {
  font-size: .8125rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

/* ── Pictures section ─────────────────────────────────────────────────────── */
.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.badge {
  background: var(--border);
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
  padding: .1rem .5rem;
  border-radius: 99px;
}

.pics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.pic-card {
  background: var(--card);
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow .15s, transform .15s;
}

.pic-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  transform: translateY(-2px);
}

.pic-thumb {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg);
}

.pic-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .25s;
}

.pic-card:hover .pic-thumb img { transform: scale(1.06); }

.pic-info { padding: .875rem; }

.pic-name {
  font-weight: 500;
  font-size: .875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: .25rem;
}

.pic-meta {
  font-size: .75rem;
  color: var(--muted);
  margin-bottom: .75rem;
}

.pic-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
  background: var(--card);
  border-radius: 12px;
  border: 1px dashed var(--border);
}

.empty-state svg {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  display: block;
  opacity: .4;
}

.empty-state p { font-size: .9375rem; }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .375rem;
  margin-top: 2rem;
}

.pagination .btn { min-width: 2.25rem; text-align: center; text-decoration: none; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .container { padding: 1rem; }
  .auth-card { padding: 2rem 1.25rem; }
  .pics-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .upload-actions { flex-direction: column; align-items: flex-start; }
}
