@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,700;1,9..144,300&family=DM+Sans:wght@300;400;500;600&display=swap');

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

:root {
  --bg: #f6f5f0;
  --surface: #ffffff;
  --surface2: #f0efe9;
  --border: #e2e0d8;
  --text: #1a1916;
  --text2: #7a7870;
  --accent: #2040e8;
  --accent-light: #e8ebff;
  --red: #d63031;
  --header-bg: #111110;
  --header-text: #f6f5f0;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-hover: 0 8px 32px rgba(0,0,0,0.12);
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
}

html { scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font-body); border: none; outline: none; }
input { font-family: var(--font-body); }

/* ── Header ── */
.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 64px;
}
.site-logo {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--header-text);
  white-space: nowrap;
  letter-spacing: -0.02em;
}
.site-logo span { color: #6b8cff; }

.header-search {
  flex: 1;
  max-width: 520px;
  position: relative;
}
.header-search input {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 9px 16px 9px 40px;
  color: var(--header-text);
  font-size: 14px;
  transition: all 0.2s;
}
.header-search input::placeholder { color: rgba(255,255,255,0.35); }
.header-search input:focus { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.25); outline: none; }
.header-search .search-icon {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%); color: rgba(255,255,255,0.4); pointer-events: none;
}

.header-nav { display: flex; gap: 4px; margin-left: auto; }
.header-nav a {
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  transition: all 0.15s;
}
.header-nav a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.header-nav a.btn-submit {
  background: var(--accent);
  color: #fff;
  padding: 6px 16px;
}
.header-nav a.btn-submit:hover { background: #3350f5; }

/* ── Hero ── */
.hero {
  background: var(--header-bg);
  color: var(--header-text);
  text-align: center;
  padding: 72px 32px 64px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}
.hero h1 em { font-style: italic; color: #6b8cff; }
.hero p { color: rgba(255,255,255,0.55); font-size: 17px; max-width: 480px; margin: 0 auto 36px; }
.hero-stats { display: flex; justify-content: center; gap: 48px; }
.hero-stat strong { display: block; font-size: 28px; font-weight: 700; font-family: var(--font-display); }
.hero-stat span { font-size: 13px; color: rgba(255,255,255,0.4); }

/* ── Category Bar ── */
.category-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 64px;
  z-index: 90;
}
.category-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  height: 52px;
}
.category-inner::-webkit-scrollbar { display: none; }
.cat-btn {
  background: none;
  border: none;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  white-space: nowrap;
  transition: all 0.15s;
}
.cat-btn:hover { color: var(--text); background: var(--surface2); }
.cat-btn.active { background: var(--text); color: var(--bg); }

/* ── Main Layout ── */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 32px;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.result-count { font-size: 13px; color: var(--text2); }

/* ── Logo Grid ── */
.logo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.logo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}
.logo-card:hover {
  border-color: rgba(32,64,232,0.3);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.logo-card:hover .card-actions { opacity: 1; }

.card-preview {
  background: #fff;
  padding: 32px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.card-preview img {
  max-width: 120px;
  max-height: 72px;
  object-fit: contain;
  transition: transform 0.2s;
}
.logo-card:hover .card-preview img { transform: scale(1.05); }

/* Placeholder when no image */
.card-preview .logo-placeholder {
  width: 80px; height: 80px;
  border-radius: 16px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text2);
}

.card-actions {
  position: absolute;
  top: 8px; right: 8px;
  display: flex; gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}
.card-action-btn {
  width: 32px; height: 32px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  transition: background 0.15s;
}
.card-action-btn:hover { background: var(--accent); }

.card-info {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-cat {
  font-size: 11px;
  color: var(--text2);
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── No Results ── */
.no-results {
  text-align: center;
  padding: 80px 32px;
  color: var(--text2);
}
.no-results h3 { font-family: var(--font-display); font-size: 24px; margin-bottom: 8px; color: var(--text); }
.no-results p { font-size: 15px; }

/* ── Logo Detail Page ── */
.detail-wrapper {
  max-width: 1000px;
  margin: 48px auto;
  padding: 0 32px;
}
.detail-breadcrumb { font-size: 13px; color: var(--text2); margin-bottom: 32px; }
.detail-breadcrumb a:hover { color: var(--accent); }
.detail-breadcrumb span { color: var(--text2); }

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.detail-preview {
  background: #fff;
  padding: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border);
  min-height: 360px;
}
.detail-preview img { max-width: 200px; max-height: 180px; object-fit: contain; }
.detail-preview .logo-placeholder-lg {
  width: 140px; height: 140px;
  border-radius: 24px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 700;
  color: var(--text2);
}

.detail-info { padding: 48px; }
.detail-category {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.detail-name {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  line-height: 1.1;
}
.detail-desc { color: var(--text2); font-size: 15px; line-height: 1.7; margin-bottom: 32px; }

.detail-meta { display: flex; gap: 24px; margin-bottom: 32px; padding: 20px; background: var(--surface2); border-radius: 10px; }
.meta-item strong { display: block; font-size: 20px; font-weight: 700; font-family: var(--font-display); }
.meta-item span { font-size: 12px; color: var(--text2); }

.download-section h3 { font-size: 13px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 12px; }
.download-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-download {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s;
}
.btn-download-primary { background: var(--accent); color: #fff; }
.btn-download-primary:hover { background: #3350f5; box-shadow: 0 4px 16px rgba(32,64,232,0.35); }
.btn-download-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-download-secondary:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

.detail-tags { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag-pill {
  background: var(--surface2);
  color: var(--text2);
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* ── Related Logos ── */
.related-section { margin-top: 64px; }
.related-section h2 { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 24px; }

/* ── Admin Page ── */
.admin-wrapper { max-width: 900px; margin: 48px auto; padding: 0 32px; }
.admin-header { margin-bottom: 40px; }
.admin-header h1 { font-family: var(--font-display); font-size: 36px; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 6px; }
.admin-header p { color: var(--text2); }

.admin-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; margin-bottom: 24px; }
.admin-card h2 { font-family: var(--font-display); font-size: 22px; font-weight: 700; margin-bottom: 24px; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.06em; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  transition: all 0.15s;
  font-family: var(--font-body);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--accent); background: var(--accent-light);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group textarea { resize: vertical; min-height: 80px; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  padding: 11px 28px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s;
}
.btn-primary:hover { background: #3350f5; }
.btn-danger {
  background: #fff0f0;
  color: var(--red);
  border: 1px solid #ffcccc;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  transition: all 0.15s;
}
.btn-danger:hover { background: var(--red); color: #fff; }

.upload-area {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface2);
}
.upload-area:hover, .upload-area.drag-over { border-color: var(--accent); background: var(--accent-light); }
.upload-area p { color: var(--text2); font-size: 14px; margin-top: 8px; }
.upload-area strong { color: var(--accent); }

/* Logo management table */
.logo-table { width: 100%; border-collapse: collapse; }
.logo-table th { text-align: left; padding: 10px 12px; font-size: 11px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 2px solid var(--border); }
.logo-table td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.logo-table tr:last-child td { border-bottom: none; }
.logo-table tr:hover td { background: var(--surface2); }
.logo-thumb { width: 40px; height: 32px; object-fit: contain; }

/* Alert messages */
.alert { padding: 12px 18px; border-radius: 8px; font-size: 14px; margin-bottom: 20px; }
.alert-success { background: #e6f7f0; color: #1a7a4a; border: 1px solid #b3e6cd; }
.alert-error { background: #fff0f0; color: #c0392b; border: 1px solid #f5b5b5; }

/* ── Footer ── */
.site-footer {
  background: var(--header-bg);
  color: rgba(255,255,255,0.45);
  padding: 48px 32px;
  margin-top: 80px;
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-logo { font-family: var(--font-display); font-size: 18px; color: rgba(255,255,255,0.7); }
.footer-logo span { color: #6b8cff; }
.footer-links { display: flex; gap: 24px; font-size: 13px; }
.footer-links a:hover { color: rgba(255,255,255,0.8); }
.footer-copy { font-size: 13px; width: 100%; text-align: center; padding-top: 24px; border-top: 1px solid rgba(255,255,255,0.06); margin-top: 24px; }

/* ── Pagination ── */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 48px; }
.page-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: 14px; font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  transition: all 0.15s;
}
.page-btn:hover, .page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn.ellipsis { border: none; background: none; cursor: default; }

/* ── Search Results Banner ── */
.search-banner {
  background: var(--accent-light);
  border: 1px solid rgba(32,64,232,0.2);
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.search-banner button { background: none; color: var(--accent); font-size: 13px; font-weight: 600; }
.search-banner button:hover { text-decoration: underline; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .detail-card { grid-template-columns: 1fr; }
  .detail-preview { border-right: none; border-bottom: 1px solid var(--border); min-height: 240px; padding: 40px; }
  .detail-info { padding: 32px; }
  .detail-name { font-size: 32px; }
}
@media (max-width: 640px) {
  .header-inner { padding: 0 16px; gap: 12px; }
  .header-nav { display: none; }
  .main-content { padding: 24px 16px; }
  .logo-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .hero { padding: 48px 20px 40px; }
  .hero-stats { gap: 28px; }
  .form-row { grid-template-columns: 1fr; }
  .detail-wrapper { padding: 0 16px; margin: 24px auto; }
}

/* ── Loading spinner ── */
.spinner { display: flex; justify-content: center; padding: 60px; }
.spinner::after {
  content: '';
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast notifications ── */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--text);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 999;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(.34,1.56,.64,1);
}
.toast.show { transform: translateY(0); opacity: 1; }
