/* ============================================================
   CIBERIA BRAND HUB — Design System
   ============================================================ */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-base:       #0d0f14;
  --bg-surface:    #141720;
  --bg-sidebar:    #0f1219;
  --bg-elevated:   #1c2030;
  --bg-overlay:    #252a3a;

  /* Accent */
  --accent:        #2563eb;
  --accent-hover:  #3b82f6;
  --accent-muted:  #1e3a5f;
  --accent-glow:   rgba(37, 99, 235, 0.12);

  /* Text */
  --text-primary:   #e8eaf0;
  --text-secondary: #8b909e;
  --text-muted:     #4b5263;

  /* Borders */
  --border-subtle:  rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.10);
  --border-strong:  rgba(255, 255, 255, 0.18);

  /* Sidebar */
  --sidebar-w: 240px;

  /* Spacing */
  --s1: 4px;  --s2: 8px;   --s3: 12px;  --s4: 16px;
  --s5: 20px; --s6: 24px;  --s8: 32px;  --s10: 40px;
  --s12: 48px; --s16: 64px;

  /* Radius */
  --r-sm: 4px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.6);
  --shadow-accent: 0 0 24px var(--accent-glow);

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  /* Transitions */
  --t-fast: 150ms ease;
  --t-normal: 250ms ease;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--text-primary);
  background: var(--bg-base);
  line-height: 1.5;
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { display: block; max-width: 100%; }
button { font-family: var(--font-sans); }
::selection { background: var(--accent); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--bg-overlay); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--accent-muted); }

/* ── Layout Shell ────────────────────────────────────────── */
.app-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.app-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  padding: var(--s8) var(--s8) var(--s16);
}

/* ── Sidebar Components ──────────────────────────────────── */
.sidebar-brand {
  padding: var(--s5) var(--s5);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.sidebar-brand-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
}

.sidebar-nav { flex: 1; padding: var(--s3); }

.sidebar-label {
  padding: var(--s4) var(--s3) var(--s2);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 7px var(--s3);
  border-radius: var(--r-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--t-fast);
  margin-bottom: 1px;
}
.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}
.nav-link.active {
  color: var(--accent-hover);
  background: var(--accent-muted);
}
.nav-link svg {
  width: 15px; height: 15px;
  flex-shrink: 0;
  opacity: 0.65;
}
.nav-link:hover svg, .nav-link.active svg { opacity: 1; }

.sidebar-footer {
  padding: var(--s4) var(--s5);
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
  margin-bottom: var(--s10);
  padding-bottom: var(--s6);
  border-bottom: 1px solid var(--border-subtle);
}
.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 6px;
}
.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ── Sections ────────────────────────────────────────────── */
.section { margin-bottom: var(--s12); }
.section-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--s5);
  display: flex;
  align-items: center;
  gap: var(--s3);
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}
.section-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-overlay);
  border: 1px solid var(--border-subtle);
  padding: 2px 8px;
  border-radius: var(--r-full);
  letter-spacing: 0.05em;
}

/* ── Asset Grid ──────────────────────────────────────────── */
.asset-grid {
  display: grid;
  gap: var(--s4);
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}
.asset-grid--wide {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.asset-grid--flags {
  display: grid;
  gap: var(--s3);
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
}

/* ── Asset Card ──────────────────────────────────────────── */
.asset-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: all var(--t-fast);
}
.asset-card:hover {
  border-color: var(--border-default);
  background: var(--bg-elevated);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-preview {
  width: 100%;
  padding: var(--s6);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 110px;
  background: var(--bg-base);
  transition: background var(--t-normal);
}
.card-preview img {
  max-height: 72px;
  max-width: 100%;
  object-fit: contain;
}
.card-preview--large img {
  max-height: 120px;
}

/* Background toggle states */
.card-preview--dark      { background: #0d0f14; }
.card-preview--light     { background: #f0f2f5; }
.card-preview--checkered {
  background-color: #b0b0b0;
  background-image:
    linear-gradient(45deg, #888 25%, transparent 25%),
    linear-gradient(-45deg, #888 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #888 75%),
    linear-gradient(-45deg, transparent 75%, #888 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
}

.card-meta {
  padding: var(--s2) var(--s3) var(--s2) var(--s4);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  min-height: 38px;
}
.card-name {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--t-fast);
  flex-shrink: 0;
  text-decoration: none;
}
.icon-btn:hover {
  background: var(--bg-overlay);
  color: var(--text-primary);
}
.icon-btn svg { width: 13px; height: 13px; }

/* ── Color Swatches ──────────────────────────────────────── */
.color-grid {
  display: grid;
  gap: var(--s3);
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}
.color-swatch {
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.color-swatch:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.swatch-chip { height: 64px; width: 100%; }
.swatch-info {
  padding: var(--s3) var(--s3);
  background: var(--bg-surface);
}
.swatch-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.swatch-hex {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

/* ── Background Toggle ───────────────────────────────────── */
.bg-toggle-bar {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s6);
  padding: var(--s2) var(--s2);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  width: fit-content;
}
.bg-toggle-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0 var(--s2);
}
.bg-toggle-btn {
  padding: 5px var(--s3);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
  letter-spacing: 0.03em;
}
.bg-toggle-btn:hover:not(.active) { color: var(--text-primary); border-color: var(--border-default); }
.bg-toggle-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Search Bar ──────────────────────────────────────────── */
.search-bar {
  position: relative;
  margin-bottom: var(--s6);
  max-width: 400px;
}
.search-bar svg {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--t-fast);
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

/* ── Videos ──────────────────────────────────────────────── */
.video-grid {
  display: grid;
  gap: var(--s6);
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
.video-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl);
  overflow: hidden;
  transition: all var(--t-fast);
}
.video-card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.video-card video {
  width: 100%;
  display: block;
  background: #000;
  max-height: 220px;
  object-fit: cover;
}
.video-meta {
  padding: var(--s4) var(--s5);
}
.video-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.video-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: var(--s3);
}
.video-badges { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.video-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.badge-es  { background: var(--accent-muted); color: var(--accent-hover); }
.badge-en  { background: rgba(34,197,94,0.15); color: #4ade80; }
.badge-landscape { background: rgba(168,85,247,0.15); color: #c084fc; }
.badge-vertical  { background: rgba(245,158,11,0.15); color: #fbbf24; }

.video-actions { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--border-subtle); }
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: 6px var(--s3);
  border-radius: var(--r-md);
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--t-fast);
}
.btn-download:hover { color: var(--text-primary); border-color: var(--border-strong); background: var(--bg-elevated); }
.btn-download svg { width: 12px; height: 12px; }

/* ── Favicon / Icon Cards ────────────────────────────────── */
.fav-grid {
  display: grid;
  gap: var(--s4);
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}
.fav-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s4) var(--s3) var(--s3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
  transition: all var(--t-fast);
  cursor: default;
}
.fav-card:hover {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.fav-card img { width: 40px; height: 40px; object-fit: contain; }
.fav-card-name {
  font-size: 10px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.3;
  font-weight: 500;
  min-height: 2.6em;
}
.fav-card-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  margin-top: auto;
  padding-top: var(--s2);
  border-top: 1px solid var(--border-subtle);
  width: 100%;
}
.fav-card-actions .icon-btn { text-decoration: none; }

/* ── Flag Cards ──────────────────────────────────────────── */
.flag-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: default;
  transition: all var(--t-fast);
  display: flex;
  flex-direction: column;
}
.flag-card:hover {
  border-color: var(--border-default);
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
  z-index: 1;
  position: relative;
}
.flag-card img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
}
.flag-code {
  padding: 3px 4px;
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface);
  text-align: center;
  border-top: 1px solid var(--border-subtle);
  letter-spacing: 0.05em;
}

/* ── Dashboard Components ────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--s4);
  margin-bottom: var(--s10);
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s5) var(--s5);
}
.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.quicknav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--s5);
}
.quicknav-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl);
  padding: var(--s6);
  text-decoration: none;
  transition: all var(--t-normal);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  color: inherit;
}
.quicknav-card:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
  box-shadow: var(--shadow-accent);
  transform: translateY(-3px);
}
.quicknav-icon {
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  background: var(--accent-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-hover);
}
.quicknav-icon svg { width: 18px; height: 18px; }
.quicknav-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.quicknav-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.quicknav-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: var(--s3);
  border-top: 1px solid var(--border-subtle);
  font-weight: 500;
}

/* Gradient preview cards */
.gradient-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s5);
}
.gradient-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl);
  overflow: hidden;
  transition: all var(--t-fast);
}
.gradient-card:hover { border-color: var(--border-default); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.gradient-card img { width: 100%; height: 160px; object-fit: cover; display: block; }
.gradient-meta {
  padding: var(--s3) var(--s5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
}
.gradient-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

/* Logo strip (horizontal scroll) */
.logo-strip {
  display: flex;
  gap: var(--s3);
  overflow-x: auto;
  padding-bottom: var(--s3);
  scrollbar-width: thin;
}
.logo-strip-item {
  flex-shrink: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s5) var(--s6);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
  transition: all var(--t-fast);
}
.logo-strip-item:hover { border-color: var(--border-default); background: var(--bg-elevated); }
.logo-strip-item img { max-height: 48px; max-width: 140px; object-fit: contain; }

/* ── Utilities ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--s16) var(--s8);
  color: var(--text-muted);
  display: none;
}
.empty-state svg { width: 36px; height: 36px; margin: 0 auto var(--s4); opacity: 0.25; }
.empty-state p { font-size: 14px; }

.results-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: var(--s4);
}

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--s6);
  right: var(--s6);
  background: var(--bg-overlay);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 10px var(--s5);
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transform: translateY(8px);
  transition: all var(--t-normal);
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-sidebar {
    position: relative;
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .sidebar-brand { flex: 1; border-bottom: none; }
  .sidebar-nav { width: 100%; display: flex; flex-wrap: wrap; padding: var(--s2); }
  .sidebar-label { display: none; }
  .nav-link { font-size: 11px; padding: 5px var(--s2); }
  .sidebar-footer { display: none; }
  .app-main { margin-left: 0; padding: var(--s4); }
  body { flex-direction: column; }
}
