:root {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-sidebar: #131c2e;
  --bg-input: #334155;
  --border-color: #334155;
  --primary: #10b981;
  --primary-hover: #059669;
  --accent: #6366f1;
  --accent-soft: rgba(99, 102, 241, 0.15);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --radius: 12px;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

header {
  background-color: rgba(19, 28, 46, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  height: 65px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.brand-title h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.search-box {
  flex: 1;
  max-width: 500px;
  position: relative;
}

.search-box input {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 99px;
  padding: 0.55rem 1rem 0.55rem 2.5rem;
  color: var(--text-main);
  font-size: 0.88rem;
  outline: none;
  transition: all 0.2s ease;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.9rem;
}

.stats-badge {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.85rem;
  border-radius: 99px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.layout {
  display: flex;
  flex: 1;
  height: calc(100vh - 65px);
  overflow: hidden;
}

aside {
  width: 290px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 1.25rem 1rem;
  position: sticky;
  top: 65px;
  height: calc(100vh - 65px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-scroll-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-right: 0.2rem;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.76rem;
  color: var(--text-dim);
  line-height: 1.4;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 700;
}

.btn-reset {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.78rem;
  cursor: pointer;
  font-weight: 500;
}

.btn-reset:hover { text-decoration: underline; }

.facet-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.facet-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.facet-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.facet-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.76rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.facet-chip:hover {
  border-color: var(--accent);
  color: var(--text-main);
}

.facet-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #a5b4fc;
  font-weight: 600;
}

.facet-count {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  padding: 0.05rem 0.35rem;
  font-size: 0.68rem;
}

main {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}

.active-filter-pill {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: #c7d2fe;
  border-radius: 99px;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.active-filter-pill button {
  background: none;
  border: none;
  color: #c7d2fe;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
  position: relative;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.card-thumb-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 3/2;
  background-color: #0b0f19;
  overflow: hidden;
}

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

.card-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
}

.card-badge.badge-raw { color: #f59e0b; border: 1px solid #f59e0b; }
.card-badge.badge-image { color: #10b981; border: 1px solid #10b981; }
.card-badge.badge-video { color: #6366f1; border: 1px solid #6366f1; }

.card-open-tab-btn {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  text-decoration: none;
  font-size: 0.72rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.card-body {
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-summary {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: auto;
  padding-top: 0.3rem;
}

.tag-pill {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Modal View */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal-overlay.open { display: flex; }

.modal-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 100%;
  max-width: 1200px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.modal-header {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
}

.btn-close:hover { color: #fff; }

.modal-body {
  display: grid;
  grid-template-columns: 2.2fr 1fr;
  overflow: hidden;
  flex: 1;
}

.modal-media {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 1rem;
}

.modal-media img, .modal-media video {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
}

.modal-info {
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-left: 1px solid var(--border-color);
}

.branch-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.branch-name {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
}

.branch-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.btn-action-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}
