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

:root {
  --c0: #F0FAF8;
  --c1: #D4EDE8;
  --c2: #A8D5CA;
  --c3: #61BAA7;
  --c4: #4A9589;
  --c5: #357A6B;
  --c6: #1E4D44;
  --text:      #1A3530;
  --text-mid:  #3D6B62;
  --text-soft: #7AABA2;
  --white:     #fff;
  --r-xl: 22px;
  --r-lg: 16px;
  --r-md: 11px;
  --r-sm:  7px;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--c0);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════════════ */
header {
  flex-shrink: 0;
  height: 62px;
  background: var(--white);
  border-bottom: 1.5px solid var(--c1);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 0.9rem;
}

.hdr-logo { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }

.hdr-sep { width: 1.5px; height: 22px; background: var(--c1); margin: 0 0.2rem; }
.hdr-label { font-size: 0.78rem; color: var(--text-soft); font-weight: 500; }

/* ═══════════════════════════════════════════════════════
   APP LAYOUT
═══════════════════════════════════════════════════════ */
.app {
  flex: 1;
  overflow: hidden;
  display: flex;
  padding: 1.5rem;
  gap: 1.4rem;
}

/* ═══════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════ */
aside {
  width: 252px;
  flex-shrink: 0;
  background: var(--white);
  border-radius: var(--r-xl);
  overflow-y: auto;
  padding: 1.25rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

aside::-webkit-scrollbar { width: 4px; }
aside::-webkit-scrollbar-thumb { background: var(--c1); border-radius: 100px; }

.sidebar-label {
  font-size: 0.63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-soft);
  padding: 0 0.7rem;
  margin-bottom: 0.55rem;
}

.cat-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.7rem;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--r-md);
  width: 100%;
  text-align: left;
  font-size: 0.845rem;
  font-weight: 500;
  color: var(--text-mid);
  transition: background .15s, color .15s;
  line-height: 1.2;
}
.cat-btn:hover { background: var(--c0); color: var(--text); }
.cat-btn.open  { background: var(--c0); color: var(--c4); font-weight: 600; }

.cat-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  background: var(--c0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--c4);
  transition: background .15s;
}
.cat-btn.open .cat-icon { background: var(--c1); }

.cat-chevron { margin-left: auto; flex-shrink: 0; color: var(--text-soft); transition: transform .22s ease; }
.cat-btn.open .cat-chevron { transform: rotate(180deg); }

.cat-items { overflow: hidden; max-height: 0; transition: max-height .25s ease; }
.cat-items.open { max-height: 500px; }

.cat-item {
  display: block;
  width: 100%;
  padding: 0.42rem 0.75rem 0.42rem 2.7rem;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--r-sm);
  text-align: left;
  font-size: 0.8rem;
  color: var(--text-soft);
  font-weight: 500;
  transition: background .12s, color .12s;
}
.cat-item:hover  { background: var(--c0); color: var(--text-mid); }
.cat-item.active { background: var(--c3); color: var(--white); font-weight: 600; }

.nav-divider { height: 1.5px; background: var(--c1); margin: 0.55rem 0.7rem; border-radius: 100px; }

/* ═══════════════════════════════════════════════════════
   MAIN — shared across pages
═══════════════════════════════════════════════════════ */
main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-header { flex-shrink: 0; margin-bottom: 1.25rem; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.74rem;
  color: var(--text-soft);
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}

.title-row { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.15rem; }

.back-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c1);
  border: none;
  cursor: pointer;
  color: var(--c5);
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
  text-decoration: none;
}
.back-btn:hover { background: var(--c2); }

.page-title    { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.03em; color: var(--text); }
.page-subtitle { font-size: 0.8rem; color: var(--text-soft); }

/* ═══════════════════════════════════════════════════════
   TILE VIEW  (index.html only)
═══════════════════════════════════════════════════════ */
#tile-view  { flex: 1; overflow: hidden; display: flex; }
#logo-view  { flex: 1; display: none; flex-direction: column; overflow: hidden; }

.tile-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(208px, 1fr));
  gap: 1.2rem;
  align-content: start;
  padding-bottom: 1.5rem;
}
.tile-grid::-webkit-scrollbar { width: 5px; }
.tile-grid::-webkit-scrollbar-thumb { background: var(--c2); border-radius: 100px; }

/* Tile card */
.tile {
  border-radius: var(--r-xl);
  aspect-ratio: 4/3;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform .2s ease;
}
.tile:hover { transform: translateY(-4px); }

.tile-bg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.tile-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile-pattern {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.tile-gradient {
  position: absolute; bottom: 0; left: 0; right: 0; height: 58%;
  background: linear-gradient(to top, rgba(18,50,44,.82) 0%, rgba(18,50,44,0) 100%);
  pointer-events: none;
}
.tile-info { position: absolute; bottom: 0; left: 0; right: 0; padding: 1rem 1.05rem; }
.tile-name { color: var(--white); font-size: .9rem; font-weight: 700; letter-spacing: -.015em; line-height: 1.25; }
.tile-meta { font-size: .7rem; color: rgba(255,255,255,.62); margin-top: 3px; }

/* Welcome state */
.welcome {
  grid-column: 1/-1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4.5rem 2rem;
  gap: 1rem;
}
.welcome-icon {
  width: 76px; height: 76px;
  background: var(--c1); border-radius: var(--r-xl);
  display: flex; align-items: center; justify-content: center;
}
.welcome h2 { font-size: 1.1rem; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.welcome p  { font-size: .83rem; color: var(--text-soft); max-width: 280px; line-height: 1.6; }

/* ═══════════════════════════════════════════════════════
   GALLERY  (gallery.html — .gallery-content wraps bar + grid)
═══════════════════════════════════════════════════════ */
.gallery-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.gallery-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.72rem 1.1rem;
  background: var(--white);
  border-radius: var(--r-xl);
  margin-bottom: 1.2rem;
}

.check-all-label {
  display: flex; align-items: center; gap: 0.45rem;
  font-size: .82rem; font-weight: 500; color: var(--text-mid);
  cursor: pointer; user-select: none; white-space: nowrap;
}
.check-all-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--c3); cursor: pointer; }

.bar-sep { width: 1.5px; height: 18px; background: var(--c1); flex-shrink: 0; }
.sel-count { flex: 1; font-size: .78rem; color: var(--text-soft); }

.btn-bar {
  padding: .42rem 1.1rem;
  border-radius: 100px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  white-space: nowrap;
  transition: opacity .15s, background .15s;
}
.btn-dl-sel { background: var(--c3); color: var(--white); }
.btn-dl-sel:disabled { opacity: .3; cursor: default; }
.btn-dl-all { background: var(--c0); color: var(--c4); }
.btn-dl-all:hover { background: var(--c1); }

/* File grid */
.file-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  align-content: start;
  padding-bottom: 1.5rem;
}
.file-grid::-webkit-scrollbar { width: 5px; }
.file-grid::-webkit-scrollbar-thumb { background: var(--c2); border-radius: 100px; }

/* File card */
.file-card {
  border-radius: var(--r-lg);
  background: var(--white);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: transform .15s;
  user-select: none;
}
.file-card:hover { transform: translateY(-2px); }
.file-card.selected { outline: 2.5px solid var(--c3); }

.file-sel-tint {
  position: absolute; inset: 0;
  background: rgba(97,186,167,.13);
  border-radius: var(--r-lg);
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.file-card.selected .file-sel-tint { opacity: 1; }

.file-thumb {
  aspect-ratio: 1;
  background: var(--c0);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-type-icon { color: var(--text-soft); }

.file-chk {
  position: absolute; top: .45rem; left: .45rem; z-index: 2;
  opacity: 0; transition: opacity .12s;
}
.file-card:hover .file-chk,
.file-card.selected .file-chk { opacity: 1; }
.file-chk input { width: 17px; height: 17px; accent-color: var(--c3); cursor: pointer; }

.file-info { padding: .5rem .6rem .55rem; }
.file-name {
  font-size: .72rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block; margin-bottom: 3px;
}
.file-meta-row { display: flex; align-items: center; justify-content: space-between; }
.file-size { font-size: .65rem; color: var(--text-soft); }

.file-dl-btn {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--c0); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--c4); text-decoration: none; transition: background .12s;
}
.file-dl-btn:hover { background: var(--c1); }

/* Empty/loading states */
.gallery-msg {
  grid-column: 1/-1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 4rem 2rem; gap: .75rem; text-align: center;
}
.gallery-msg svg { color: var(--text-soft); opacity: .35; }
.gallery-msg p { font-size: .88rem; color: var(--text-soft); font-weight: 500; }

/* ═══════════════════════════════════════════════════════
   LOGO COLOR CHOOSER  (index.html #logo-view)
═══════════════════════════════════════════════════════ */
.logo-color-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1.2rem;
  align-content: start;
  padding-bottom: 1.5rem;
}
.logo-color-grid::-webkit-scrollbar { width: 5px; }
.logo-color-grid::-webkit-scrollbar-thumb { background: var(--c2); border-radius: 100px; }

.logo-color-card {
  border-radius: var(--r-xl);
  background: var(--white);
  overflow: hidden;
}

.logo-color-preview {
  aspect-ratio: 3/2;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.75rem;
}
.logo-preview-ph {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  opacity: 0.35;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  pointer-events: none;
}
.logo-preview-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 1.75rem;
}

.logo-color-info { padding: 0.8rem 0.95rem 0.95rem; }
.logo-color-name { font-size: 0.88rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.logo-color-hex  { font-size: 0.68rem; color: var(--text-soft); font-family: monospace; margin-bottom: 0.65rem; letter-spacing: 0.02em; }

.logo-fmts { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.logo-fmt-btn {
  padding: 0.28rem 0.65rem;
  border-radius: 100px;
  background: var(--c0);
  color: var(--c4);
  font-size: 0.7rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: background .12s;
}
.logo-fmt-btn:hover { background: var(--c1); }

.logo-preparing {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: .75rem; text-align: center; padding: 4rem 2rem;
}
.logo-preparing svg { color: var(--text-soft); opacity: .35; }
.logo-preparing p { font-size: .88rem; color: var(--text-soft); font-weight: 500; }

/* Brandbook download row — sits beside the tile in the grid */
.brandbook-dl-row {
  display: flex;
  align-items: flex-end;
  padding-bottom: 1rem;
}

/* ═══════════════════════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.anim { animation: fadeUp .18s ease; }
