/* ---------- Reset & base ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --border: #e6e6e6;
  --text: #1a1a1a;
  --text-muted: #767676;
  --accent: #1a1a1a;
  --accent-contrast: #ffffff;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  --transition: 0.15s ease;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

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

button, input {
  font-family: inherit;
  font-size: 1rem;
}

/* ---------- Layout ---------- */
.page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Top bar ---------- */
.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

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

.brand {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-actions .user {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ---------- Main content ---------- */
.main {
  flex: 1;
  padding: 40px 0 64px;
}

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.page-header .subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.breadcrumb a:hover {
  color: var(--text);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.btn:hover {
  border-color: #c9c9c9;
  background: #f5f5f5;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}

.btn-primary:hover {
  opacity: 0.88;
  background: var(--accent);
}

.btn-block {
  width: 100%;
}

/* ---------- Forms (login) ---------- */
.auth-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow);
}

.auth-card .brand {
  display: block;
  text-align: center;
  margin-bottom: 8px;
}

.auth-card h1 {
  font-size: 1.15rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 28px;
  color: var(--text-muted);
  font-weight: 400;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--transition);
}

.field input:focus {
  outline: none;
  border-color: #b0b0b0;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  font-size: 0.85rem;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.checkbox input {
  width: auto;
}

.link {
  color: var(--text-muted);
}

.link:hover {
  color: var(--text);
  text-decoration: underline;
}

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

/* ---------- Grid (albums / photos) ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
}

.grid.photos {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

/* ---------- Album card ---------- */
.card {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
  border-color: #d4d4d4;
  box-shadow: var(--shadow);
}

.card-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #ececec;
  overflow: hidden;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  padding: 14px 16px;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---------- Photo tile ---------- */
.photo-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: #ececec;
  border: 1px solid var(--border);
}

.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition);
}

.photo-tile:hover img {
  transform: scale(1.03);
}

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 80px 20px;
  font-size: 0.95rem;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .topbar .container {
    height: 56px;
  }

  .main {
    padding: 28px 0 48px;
  }

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

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