/* ============================================================
   Shrine — Stylesheet
   Fonts: Cormorant Garamond (display) + DM Mono (body)
   Download WOFF2 files and place in /fonts/:
     - fonts/CormorantGaramond-Regular.woff2
     - fonts/CormorantGaramond-Medium.woff2
     - fonts/DMMono-Regular.woff2
     - fonts/DMMono-Medium.woff2
   ============================================================ */

@font-face {
  font-family: 'Cormorant Garamond';
  src: url('fonts/CormorantGaramond-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Cormorant Garamond';
  src: url('fonts/CormorantGaramond-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DM Mono';
  src: url('fonts/DMMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DM Mono';
  src: url('fonts/DMMono-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}


/* ============================================================
   CSS Variables
   ============================================================ */

:root {
  --bg:          #0a0a0f;
  --surface:     #13131a;
  --surface-2:   #1a1a24;
  --border:      #1e1e2e;
  --text:        #e0e0e8;
  --text-muted:  #6b6b80;
  --accent:      #c9a96e;
  --accent-dim:  #8a7048;
  --danger:      #c96e6e;
  --sidebar-w:   260px;
  --toolbar-h:   56px;
  --radius:      6px;
  --transition:  150ms ease;
  --shimmer-1:   #13131a;
  --shimmer-2:   #1f1f2c;
}


/* ============================================================
   Reset & Base
   ============================================================ */

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
  line-height: 1.2;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
}

input {
  font: inherit;
  color: inherit;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition);
}

input:focus {
  border-color: var(--accent-dim);
}

input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

ul {
  list-style: none;
}

[hidden] {
  display: none !important;
}

/* Focus ring for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--accent-dim);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Text selection */
::selection {
  background: var(--accent-dim);
  color: var(--text);
}

/* Custom scrollbars */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-dim);
}

/* Skeleton shimmer animation */
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* ============================================================
   Views
   ============================================================ */

.view {
  width: 100%;
  min-height: 100vh;
}


/* ============================================================
   Login
   ============================================================ */

#login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(ellipse 60% 40% at 50% 40%, rgba(201,169,110,0.06) 0%, transparent 70%),
    var(--bg);
}

.login-box {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: 0 0 0 1px rgba(201,169,110,0.04), 0 24px 48px rgba(0,0,0,0.5);
}

.login-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.4rem;
  color: var(--accent);
  text-align: center;
  margin-bottom: 32px;
  letter-spacing: 0.12em;
  text-shadow: 0 0 40px rgba(201,169,110,0.3);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field label {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field input {
  padding: 10px 12px;
  width: 100%;
}

.login-error {
  color: var(--danger);
  font-size: 12px;
  margin-bottom: 12px;
}

.lockout-msg {
  color: var(--danger);
  font-size: 12px;
  margin-bottom: 12px;
}

#login-btn {
  width: 100%;
  padding: 11px;
  background: var(--accent);
  color: var(--bg);
  border-radius: var(--radius);
  font-weight: 500;
  letter-spacing: 0.06em;
  transition: opacity var(--transition);
}

#login-btn:hover:not(:disabled) {
  opacity: 0.85;
}

#login-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}


/* ============================================================
   App Shell
   ============================================================ */

#app-view {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}


/* ============================================================
   Sidebar
   ============================================================ */

#sidebar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  overflow-y: auto;
  height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.app-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  color: var(--accent);
  letter-spacing: 0.1em;
}

#sidebar-close {
  display: none; /* shown on mobile only */
  color: var(--text-muted);
}

/* View mode buttons */
.view-modes {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.view-mode-btn {
  flex: 1;
  padding: 6px;
  border-radius: calc(var(--radius) - 2px);
  color: var(--text-muted);
  font-size: 14px;
  transition: background var(--transition), color var(--transition);
}

.view-mode-btn.active {
  background: var(--surface-2);
  color: var(--accent);
}

/* Favorites toggle */
.filter-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  text-align: left;
  font-size: 12px;
}

.filter-toggle:hover,
.filter-toggle[data-active="true"] {
  background: var(--surface-2);
  color: var(--accent);
}

.heart {
  font-size: 14px;
}

/* Sidebar sections */
.sidebar-section {
  margin-top: 12px;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 8px;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Collection list */
#collection-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.collection-item {
  padding: 7px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collection-item:hover,
.collection-item.active {
  background: var(--surface-2);
  color: var(--text);
}

.collection-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.collection-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ⋯ options button on collection items */
.collection-menu-btn {
  opacity: 0;
  font-size: 14px;
  padding: 0 4px;
  line-height: 1;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: opacity var(--transition), color var(--transition);
  letter-spacing: 0.05em;
}

.collection-item:hover .collection-menu-btn,
.collection-menu-btn:focus {
  opacity: 1;
}

.collection-menu-btn:hover {
  color: var(--text);
}

/* Collection context menu dropdown */
#collection-context-menu {
  position: fixed;
  z-index: 250;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  overflow: hidden;
  min-width: 120px;
}

#collection-context-menu:not([hidden]) {
  display: flex !important;
  flex-direction: column;
}

.col-menu-item {
  padding: 9px 14px;
  font-size: 12px;
  text-align: left;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}

.col-menu-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.col-menu-item.danger:hover {
  color: var(--danger);
}

/* Inline rename input */
.collection-rename-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--accent-dim);
  border-radius: calc(var(--radius) - 2px);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  padding: 2px 6px;
  outline: none;
  min-width: 0;
}

/* Sub-collection (child) item */
.collection-child {
  padding-left: 26px;
}

/* Expand/collapse toggle */
.collection-toggle {
  font-size: 10px;
  padding: 0 4px 0 0;
  color: var(--text-muted);
  flex-shrink: 0;
  line-height: 1;
  width: 16px;
}

/* Sign out */
.signout-btn {
  margin-top: auto;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color var(--transition);
  text-align: left;
}

.signout-btn:hover {
  color: var(--danger);
}


/* ============================================================
   Main Area
   ============================================================ */

#main-area {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-y: auto;
}

/* Toolbar */
#toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--toolbar-h);
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

#sidebar-open {
  display: none; /* shown on mobile only */
  color: var(--text-muted);
}

.breadcrumb {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  color: var(--text-muted);
  flex: 1;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Filter bar — below toolbar, above image grid */
#filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

#search-input {
  flex: 1;
  padding: 7px 12px;
  font-size: 12px;
  transition: border-color var(--transition);
}

#search-input:not(:placeholder-shown) {
  border-color: var(--accent-dim);
}

#sort-select {
  padding: 7px 10px;
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
}

#sort-select:focus,
#sort-select:hover {
  border-color: var(--accent-dim);
  color: var(--text);
}

/* Upload progress */
#upload-progress:not([hidden]) {
  display: flex !important; /* override [hidden] only when not hidden */
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

#upload-progress-bar {
  flex: 1;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  overflow: hidden;
  position: relative;
}

#upload-progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms ease;
}


/* ============================================================
   Image Grid
   ============================================================ */

#image-grid {
  padding: 20px;
  flex: 1;
}

/* Gallery mode */
#image-grid[data-view="gallery"] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  align-content: start;
}

/* List mode */
#image-grid[data-view="list"] {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Masonry mode */
#image-grid[data-view="masonry"] {
  columns: 4;
  column-gap: 12px;
}

/* Image card — Gallery & Masonry */
.image-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.image-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-dim);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* Skeleton shimmer while image loads */
.image-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    var(--shimmer-1) 25%,
    var(--shimmer-2) 50%,
    var(--shimmer-1) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  z-index: 0;
  transition: opacity 300ms ease;
}

.image-card.img-loaded::before {
  opacity: 0;
  pointer-events: none;
}

/* Card image — fade in when loaded */
.card-img {
  opacity: 0;
  transition: opacity 300ms ease;
  position: relative;
  z-index: 1;
}

.card-img.loaded {
  opacity: 1;
}

/* Gallery card: fixed square */
#image-grid[data-view="gallery"] .image-card {
  aspect-ratio: 1;
}

#image-grid[data-view="gallery"] .card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Masonry card: natural height */
#image-grid[data-view="masonry"] .image-card {
  break-inside: avoid;
  margin-bottom: 12px;
}

#image-grid[data-view="masonry"] .card-img {
  width: 100%;
  display: block;
}

/* List card */
#image-grid[data-view="list"] .image-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  aspect-ratio: unset;
}

/* No shimmer for list cards — layout doesn't reserve space */
#image-grid[data-view="list"] .image-card::before {
  display: none;
}

#image-grid[data-view="list"] .card-img {
  opacity: 1; /* always visible in list mode */
}

#image-grid[data-view="list"] .card-img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
  flex-shrink: 0;
}

.card-meta {
  display: none;
  flex: 1;
  min-width: 0;
}

#image-grid[data-view="list"] .card-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-name {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-date {
  font-size: 11px;
  color: var(--text-muted);
}

/* Card overlay (hover) — gallery & masonry */
.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 55%);
  opacity: 0;
  transition: opacity var(--transition);
  display: flex;
  align-items: flex-end;
  padding: 10px;
  gap: 6px;
  z-index: 2;
}

#image-grid[data-view="list"] .card-overlay {
  display: none;
}

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

/* Heart button on card */
.card-favorite-btn {
  font-size: 16px;
  color: rgba(255,255,255,0.7);
  line-height: 1;
  padding: 6px;
  border-radius: var(--radius);
  transition: color var(--transition), transform var(--transition), background var(--transition);
}

.card-favorite-btn:hover {
  background: rgba(255,255,255,0.12);
}

.card-favorite-btn:hover,
.card-favorite-btn[data-active="true"] {
  color: var(--danger);
  transform: scale(1.15);
}

/* List actions row (always visible, right-aligned) */
.list-actions {
  display: none;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

#image-grid[data-view="list"] .list-actions {
  display: flex;
}

/* Hide overlay-only elements in list mode */
#image-grid[data-view="list"] .card-overlay {
  display: none;
}

/* Hide list-only elements in gallery/masonry */
#image-grid[data-view="gallery"] .list-actions,
#image-grid[data-view="masonry"] .list-actions {
  display: none;
}

.list-fav-btn {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1;
  transition: color var(--transition), transform var(--transition);
}

.list-fav-btn:hover,
.list-fav-btn[data-active="true"] {
  color: var(--danger);
  transform: scale(1.15);
}

.card-action-btn {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  transition: color var(--transition);
}

.card-action-btn:hover {
  color: #fff;
}

.list-action-btn {
  color: var(--text-muted);
}

.list-action-btn:hover {
  color: var(--text);
}

/* Load more */
#load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 24px 20px;
}

#load-more-btn {
  min-width: 140px;
}

/* Empty state */
#empty-state {
  padding: 80px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#empty-state::before {
  content: '◻';
  font-size: 40px;
  opacity: 0.15;
  display: block;
  line-height: 1;
}

#empty-state p {
  max-width: 240px;
  line-height: 1.8;
}


/* ============================================================
   Tag Pills
   ============================================================ */

.tag-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-pill {
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.tag-pill:hover,
.tag-pill.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--text);
}

/* Tag remove button inside assigned pill */
.tag-remove-btn {
  margin-left: 5px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1;
  vertical-align: middle;
  transition: color var(--transition);
}

.tag-remove-btn:hover {
  color: var(--danger);
}

/* Tag input widget (used in lightbox) */
.tag-widget {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tag-input-wrap {
  position: relative;
}

.tag-input {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
}

.tag-input:focus {
  border-color: var(--accent-dim);
}

/* Autocomplete dropdown */
.tag-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 50;
  max-height: 180px;
  overflow-y: auto;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.tag-dropdown-item {
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}

.tag-dropdown-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.tag-create {
  color: var(--accent);
  font-style: italic;
}

.tag-create:hover {
  background: var(--surface-2);
  color: var(--accent);
}


/* ============================================================
   Lightbox
   ============================================================ */

#lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lightbox-in 180ms ease;
}

@keyframes lightbox-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
}

#lightbox-content {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 24px;
  max-width: 90vw;
  max-height: 90vh;
  align-items: flex-start;
  animation: lightbox-content-in 220ms ease;
}

@keyframes lightbox-content-in {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

#lightbox-img {
  max-width: 70vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: var(--radius);
  display: block;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

#lightbox-meta {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
  background: rgba(19,19,26,0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.meta-row {
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-all;
}

.lightbox-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

#lightbox-favorite {
  font-size: 18px;
  transition: color var(--transition), transform var(--transition);
}

#lightbox-favorite:hover,
#lightbox-favorite[data-active="true"] {
  color: var(--danger);
  transform: scale(1.15);
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  font-size: 20px;
  color: rgba(255,255,255,0.5);
  transition: color var(--transition);
  background: rgba(0,0,0,0.4);
  border-radius: var(--radius);
  padding: 8px;
}

.lightbox-close:hover {
  color: var(--text);
  background: rgba(0,0,0,0.6);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  font-size: 40px;
  color: rgba(255,255,255,0.25);
  padding: 16px 20px;
  transition: color var(--transition), background var(--transition);
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius);
}

.lightbox-nav:hover {
  color: rgba(255,255,255,0.9);
  background: rgba(0,0,0,0.5);
}

#lightbox-prev { left: 8px; }
#lightbox-next { right: 8px; }


/* ============================================================
   Buttons
   ============================================================ */

.primary-btn {
  padding: 8px 16px;
  background: var(--accent);
  color: var(--bg);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  transition: opacity var(--transition);
}

.primary-btn:hover {
  opacity: 0.85;
}

.secondary-btn {
  padding: 8px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius);
  font-size: 12px;
  transition: border-color var(--transition), color var(--transition);
}

.secondary-btn:hover {
  border-color: var(--accent-dim);
  color: var(--text);
}

.danger-btn {
  padding: 8px 16px;
  background: var(--danger);
  color: #fff;
  border-radius: var(--radius);
  font-size: 12px;
  transition: opacity var(--transition);
}

.danger-btn:hover {
  opacity: 0.85;
}

.icon-btn {
  padding: 6px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 14px;
  transition: color var(--transition), background var(--transition);
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.icon-btn.danger:hover {
  color: var(--danger);
}


/* ============================================================
   Modals
   ============================================================ */

#modal,
#collection-modal,
#upload-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  padding: 24px;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-box h2 {
  font-size: 1.2rem;
}

.modal-box input,
.modal-box select {
  padding: 9px 12px;
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

.modal-box select:focus {
  border-color: var(--accent-dim);
  outline: none;
}

/* Upload modal */
.upload-modal-box {
  max-width: 520px;
}

#upload-file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
}

.upload-file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.upload-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
  flex-shrink: 0;
}

.upload-file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upload-file-name {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-collection-select {
  font-size: 12px;
  padding: 5px 8px !important;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}


/* ============================================================
   Privacy Screen
   ============================================================ */

#privacy-screen {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  cursor: pointer;
  animation: privacy-fade-in 600ms ease;
}

@keyframes privacy-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#privacy-screen:not([hidden]) {
  display: flex !important;
}

.privacy-clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#privacy-time {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(4rem, 15vw, 9rem);
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
}

#privacy-date {
  font-family: 'DM Mono', monospace;
  font-size: clamp(0.85rem, 2.5vw, 1.1rem);
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.privacy-brand {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  color: var(--accent-dim);
  letter-spacing: 0.2em;
}

.privacy-hint {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.5;
  letter-spacing: 0.06em;
  position: absolute;
  bottom: 32px;
}


/* ============================================================
   Toasts
   ============================================================ */

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 200ms ease, transform 200ms ease;
  max-width: 320px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  border-color: var(--danger);
  color: var(--danger);
}


/* ============================================================
   Responsive — Mobile
   ============================================================ */

@media (max-width: 680px) {
  #app-view {
    grid-template-columns: 1fr;
  }

  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 200ms ease;
    width: var(--sidebar-w);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #sidebar-close {
    display: block;
  }

  #sidebar-open {
    display: block;
  }

  #image-grid[data-view="masonry"] {
    columns: 2;
  }

  #lightbox-content {
    flex-direction: column;
    max-width: 95vw;
  }

  #lightbox-img {
    max-width: 95vw;
    max-height: 60vh;
  }

  #lightbox-meta {
    width: 100%;
  }

}
