/* ============================================================
   Iceland Photo Album — style.css
   Clean & minimal theme
   ============================================================ */

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

:root {
  --bg:          #ffffff;
  --surface:     #f5f5f5;
  --border:      #e8e8e8;
  --text:        #111111;
  --text-2:      #666666;
  --text-3:      #999999;
  --accent:      #2563eb;
  --accent-h:    #1d4ed8;
  --accent-bg:   #eff6ff;
  --success:     #16a34a;
  --success-bg:  #dcfce7;
  --error:       #dc2626;
  --nav-h:       56px;
  --panel-w:     360px;
  --r:           8px;
  --r-lg:        12px;
  --shadow:      0 1px 6px rgba(0,0,0,.08);
  --shadow-lg:   0 4px 24px rgba(0,0,0,.10);
  --transition:  0.2s ease;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

/* ── Navigation ─────────────────────────────────────────── */
#nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  z-index: 900;
}

.nav-logo {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--text);
}

.nav-center {
  display: flex;
  background: var(--surface);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.nav-tab {
  background: none;
  border: none;
  padding: 5px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,.10);
}

.edit-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition);
}
.edit-btn:hover { background: var(--accent-h); }

/* ── Views ──────────────────────────────────────────────── */
.view {
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0; bottom: 0;
  overflow: hidden;
}
.view.hidden { display: none; }
.view.active { display: block; }

/* ── Map ────────────────────────────────────────────────── */
#map { width: 100%; height: 100%; }

/* Custom marker */
.loc-marker {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.loc-marker:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(37,99,235,.15);
}
.loc-marker-count {
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 600;
}

/* ── Photo Panel ────────────────────────────────────────── */
.photo-panel {
  position: absolute;
  top: 0; right: 0;
  width: var(--panel-w);
  height: 100%;
  background: #fff;
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  z-index: 500;
  transform: translateX(0);
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
}
.photo-panel.closed { transform: translateX(100%); }

.panel-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-shrink: 0;
}
.panel-title-row { display: flex; flex-direction: column; gap: 2px; }
.panel-header h2 { font-size: 15px; font-weight: 600; }
#panel-photo-count { font-size: 12px; color: var(--text-3); }

#panel-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-3);
  padding: 2px 4px;
  line-height: 1;
  margin-left: 8px;
}
#panel-close:hover { color: var(--text); }

.panel-photos {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  align-content: start;
}

.panel-photo {
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface);
}
.panel-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s;
}
.panel-photo:hover img { transform: scale(1.06); }

/* ── Gallery ─────────────────────────────────────────────── */
#gallery-view { overflow-y: auto; }

.gallery-toolbar {
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  flex-wrap: wrap;
  gap: 8px;
}

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

.filter-label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.filter-sep { width: 1px; height: 16px; background: var(--border); }

.gallery-filters select,
.gallery-filters input[type="date"] {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
}
.gallery-filters select:focus,
.gallery-filters input[type="date"]:focus { border-color: var(--accent); }

.gallery-count { font-size: 12px; color: var(--text-3); }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  padding: 16px 20px;
}

.gallery-item {
  aspect-ratio: 1;
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: var(--surface);
}
.gallery-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}
.gallery-item:hover img { transform: scale(1.04); }

.gallery-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 28px 10px 10px;
  background: linear-gradient(to top, rgba(0,0,0,.55), transparent);
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s;
}
.gallery-item:hover .gallery-overlay { opacity: 1; }
.gallery-overlay .loc { font-size: 12px; font-weight: 500; }
.gallery-overlay .dt  { font-size: 11px; opacity: .75; margin-top: 2px; }

.gallery-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-2);
}

/* ── Lightbox ────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.93);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox.hidden { display: none; }

.lb-close {
  position: absolute;
  top: 18px; right: 22px;
  background: none;
  border: none;
  color: rgba(255,255,255,.6);
  font-size: 22px;
  cursor: pointer;
  z-index: 1;
  padding: 4px;
  transition: color var(--transition);
}
.lb-close:hover { color: #fff; }

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.08);
  border: none;
  color: rgba(255,255,255,.7);
  font-size: 36px;
  width: 52px;
  height: 72px;
  border-radius: 6px;
  cursor: pointer;
  z-index: 1;
  transition: background var(--transition), color var(--transition);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-nav:hover { background: rgba(255,255,255,.16); color: #fff; }
.lb-prev { left: 14px; }
.lb-next { right: 14px; }

.lb-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 92vw;
}

#lightbox-img {
  max-width: 88vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
  display: block;
}

.lb-meta {
  display: flex;
  gap: 18px;
  color: rgba(255,255,255,.65);
  font-size: 13px;
}
.lb-meta span + span::before {
  content: '·';
  margin-right: 18px;
  opacity: .4;
}

/* ── Modals ──────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.hidden { display: none; }

.modal-box {
  background: #fff;
  border-radius: var(--r-lg);
  padding: 28px;
  width: 400px;
  max-width: 100%;
  box-shadow: var(--shadow-lg);
}

.modal-box h3  { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.modal-box > p { font-size: 13px; color: var(--text-2); margin-bottom: 18px; }

.modal-box input[type="password"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  color: var(--text);
  margin-bottom: 6px;
}
.modal-box input[type="password"]:focus { border-color: var(--accent); }

.field-error {
  font-size: 12px;
  color: var(--error);
  margin-bottom: 10px;
}
.field-error.hidden { display: none; }

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

/* ── Edit Modal ──────────────────────────────────────────── */
.edit-box {
  width: 620px;
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.edit-tabs-wrap {
  display: flex;
  background: var(--surface);
  border-radius: 7px;
  padding: 3px;
  gap: 2px;
}

.edit-tab {
  background: none;
  border: none;
  padding: 5px 18px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}
.edit-tab:hover { color: var(--text); }
.edit-tab.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.10); }

.edit-tab-content { padding: 18px 22px 22px; overflow-y: auto; flex: 1; }
.edit-tab-content.hidden { display: none; }

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 17px;
  color: var(--text-3);
  padding: 2px 4px;
}
.icon-btn:hover { color: var(--text); }

/* Step indicator */
.step-indicator {
  display: flex;
  align-items: center;
  padding: 14px 22px 0;
  gap: 0;
}
.step-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  transition: background var(--transition);
}
.step-dot.active { background: var(--accent); }
.step-dot.done   { background: var(--accent); opacity: .4; }
.step-line { flex: 1; height: 1px; background: var(--border); }

/* Upload Steps */
.upload-step { padding: 18px 22px 22px; }
.upload-step.hidden { display: none; }

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  padding: 44px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  outline: none;
}
.drop-zone:hover,
.drop-zone:focus,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.drop-icon { font-size: 36px; margin-bottom: 10px; }
.drop-title { font-size: 14px; color: var(--text); margin-bottom: 4px; font-weight: 500; }
.drop-sub   { font-size: 13px; color: var(--text-2); }
.file-link  { color: var(--accent); cursor: pointer; text-decoration: underline; }

/* File preview thumbnails */
.file-preview {
  margin-top: 12px;
}
.file-preview.hidden { display: none; }
.preview-header { font-size: 12px; color: var(--text-2); margin-bottom: 8px; font-weight: 500; }
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 5px;
  max-height: 140px;
  overflow-y: auto;
}
.preview-thumb {
  aspect-ratio: 1;
  border-radius: 5px;
  overflow: hidden;
  background: var(--surface);
}
.preview-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-more {
  aspect-ratio: 1;
  border-radius: 5px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-2);
}

/* Step footer */
.step-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}
.step-count { font-size: 12px; color: var(--text-2); }

/* Step 2 – location picker */
.step-hint { font-size: 13px; color: var(--text-2); margin-bottom: 10px; }

.full-select, .full-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  margin-bottom: 8px;
}
.full-select:focus, .full-input:focus { border-color: var(--accent); }

.name-row.hidden { display: none; }

.upload-map {
  height: 280px;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--border);
}

/* Step 3 – progress */
.progress-wrap { text-align: center; padding: 20px 0; }
.progress-title  { font-size: 15px; font-weight: 500; margin-bottom: 14px; }
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}
#progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s;
}
.progress-detail { font-size: 12px; color: var(--text-3); }

/* Step 4 – done */
.done-wrap { text-align: center; padding: 12px 0; }
.done-check {
  width: 52px; height: 52px;
  background: var(--success-bg);
  color: var(--success);
  border-radius: 50%;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.done-wrap h4  { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.done-wrap p   { font-size: 13px; color: var(--text-2); margin-bottom: 20px; }

/* ── Shared Buttons ──────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition);
}
.btn-primary:hover  { background: var(--accent-h); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-2);
  transition: border-color var(--transition), color var(--transition);
}
.btn-ghost:hover { border-color: var(--text-2); color: var(--text); }
.btn-ghost:disabled { opacity: .4; cursor: not-allowed; }

.btn-danger {
  background: none;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  color: var(--error);
  transition: all var(--transition);
}
.btn-danger:hover { background: #fef2f2; border-color: var(--error); }
.btn-danger:disabled { opacity: .4; cursor: not-allowed; }

/* ── Manage Tab ──────────────────────────────────────────── */
.manage-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.manage-filter-select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  flex: 1;
  min-width: 140px;
}
.manage-filter-select:focus { border-color: var(--accent); }

.manage-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.manage-count {
  font-size: 12px;
  color: var(--text-2);
  min-width: 60px;
}

.manage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
}

.manage-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface);
  border: 2px solid transparent;
  transition: border-color var(--transition);
}
.manage-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.manage-item.selected { border-color: var(--accent); }

.manage-check-overlay {
  position: absolute;
  inset: 0;
  background: rgba(37,99,235,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
}
.manage-item.selected .manage-check-overlay { opacity: 1; }
.check-icon {
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
}

.manage-item-meta {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 18px 6px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
  color: #fff;
  font-size: 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  opacity: 0;
  transition: opacity var(--transition);
}
.manage-item:hover .manage-item-meta { opacity: 1; }

.manage-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-2);
  font-size: 13px;
}

/* ── Loading Overlay ─────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-2);
  font-size: 13px;
}
.loading-overlay.hidden { display: none; }

.spinner {
  width: 30px; height: 30px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Scrollbar (subtle) ──────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #ccc; }
