/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ---------- CSS Custom Properties (Brand Theming) ---------- */
:root {
  /* Default / iFi audio */
  --brand-primary:     #375173;
  --brand-primary-h:   #2e4463;
  --brand-secondary:   #FAFAFA;
  --brand-dark:        #1A1C1D;
  --brand-accent:      #4A6B8A;
  --brand-muted:       #6b8aaa;
  --brand-sidebar-bg:  #1A1C1D;
  --brand-sidebar-txt: #FAFAFA;
  --brand-hero-from:   #375173;
  --brand-hero-to:     #1A1C1D;
  --brand-card-border: rgba(55,81,115,0.20);
}

[data-brand="ifi-audio"]{
  --brand-primary:     #375173;
  --brand-primary-h:   #2e4463;
  --brand-secondary:   #FAFAFA;
  --brand-dark:        #1A1C1D;
  --brand-accent:      #4A6B8A;
  --brand-muted:       #6b8aaa;
  --brand-sidebar-bg:  #1A1C1D;
  --brand-sidebar-txt: #FAFAFA;
  --brand-hero-from:   #375173;
  --brand-hero-to:     #1A1C1D;
  --brand-card-border: rgba(55,81,115,0.22);
}

[data-brand="ifi-studio"] {
  --brand-primary:     #a1328e;
  --brand-primary-h:   #311a2e;
  --brand-secondary:   #FAFAFA;
  --brand-dark:        #1A1C1D;
  --brand-accent:      #4A6B8A;
  --brand-muted:       #6b8aaa;
  --brand-sidebar-bg:  #1A1C1D;
  --brand-sidebar-txt: #FAFAFA;
  --brand-hero-from:   #3d1f38;
  --brand-hero-to:     #a1328e;
  --brand-card-border: rgba(55,81,115,0.22);
}

[data-brand="silent-power"],
[data-brand="silentpower"] {
  --brand-primary:     #000000;
  --brand-primary-h:   #1a1a1a;
  --brand-secondary:   #ececec;
  --brand-dark:        #0a0908;
  --brand-accent:      #E6E3DB;
  --brand-muted:       #928D84;
  --brand-sidebar-bg:  #0a0908;
  --brand-sidebar-txt: #E6E3DB;
  --brand-hero-from:   #1a1814;
  --brand-hero-to:     #000000;
  --brand-card-border: rgba(146,141,132,0.25);
}

[data-brand="airo"] {
  --brand-primary:     #ED1C24;
  --brand-primary-h:   #c91017;
  --brand-secondary:   #FFFFFF;
  --brand-dark:        #171717;
  --brand-accent:      #FF4248;
  --brand-muted:       #9ca3af;
  --brand-sidebar-bg:  #171717;
  --brand-sidebar-txt: #FFFFFF;
  --brand-hero-from:   #ED1C24;
  --brand-hero-to:     #171717;
  --brand-card-border: rgba(237,28,36,0.20);
}

/* ---------- Brand Utility Classes ---------- */
.brand-bg          { background-color: var(--brand-primary); }
.brand-bg-hover:hover { background-color: var(--brand-primary-h); }
.brand-text        { color: var(--brand-primary); }
.brand-border      { border-color: var(--brand-primary); }
.brand-sidebar     { background-color: var(--brand-sidebar-bg); color: var(--brand-sidebar-txt); }

.brand-hero {
  background: linear-gradient(135deg, var(--brand-hero-from), var(--brand-hero-to));
}

.brand-badge {
  background-color: var(--brand-primary);
  color: var(--brand-secondary);
}

.brand-tab-active {
  border-bottom: 2px solid var(--brand-primary);
  color: var(--brand-primary);
}

.brand-sidebar-link-active {
  background-color: var(--brand-primary);
  color: var(--brand-secondary);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  background-color: #f1f5f9;
  color: #0f172a;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Custom Shadows ---------- */
.shadow-soft  { box-shadow: 0 4px 16px rgba(15,23,42,0.07); }
.shadow-card  { box-shadow: 0 8px 24px rgba(15,23,42,0.10); }
.shadow-modal { box-shadow: 0 24px 60px rgba(15,23,42,0.22); }
.shadow-brand { box-shadow: 0 8px 24px rgba(55,81,115,0.20); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: #f1f5f9; }
::-webkit-scrollbar-thumb  { background: #cbd5e1; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---------- Layout ---------- */
.portal-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.portal-layout-nosidebar {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.portal-footer {
  width: 100%;
}

@media (min-width: 1024px) {
  .portal-footer.portal-footer--with-sidebar {
    margin-left: 280px;
    width: calc(100% - 280px);
  }
}

.portal-footer.portal-footer--no-sidebar .footer-shell {
  max-width: 80rem;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 1023px) {
  .portal-layout {
    grid-template-columns: 1fr;
  }
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  background-color: var(--brand-sidebar-bg);
  color: var(--brand-sidebar-txt);
}

@media (max-width: 1023px) {
  .sidebar {
    position: fixed;
    top: 0; left: -100%;
    height: 100vh;
    width: 280px;
    z-index: 50;
    transition: left 0.3s ease;
  }
  .sidebar.sidebar--open { left: 0; }
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
  cursor: pointer;
  color: var(--brand-sidebar-txt);
  opacity: 0.75;
  text-decoration: none;
}
.sidebar-link:hover { background: rgba(255,255,255,0.08); opacity: 1; }
.sidebar-link.active { background: var(--brand-primary); color: var(--brand-secondary); opacity: 1; }
[data-brand="silent-power"] .sidebar-link.active,
[data-brand="silentpower"] .sidebar-link.active {
  background: var(--brand-primary-h);
}

.sidebar-section-title {
  padding: 6px 14px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.45;
}

/* ---------- Card Base ---------- */
.portal-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.portal-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(15,23,42,0.12);
}

/* ---------- Brand Card (homepage) ---------- */
.brand-card {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 28px;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s ease;
}
.brand-card:hover { transform: translateY(-6px); box-shadow: 0 20px 48px rgba(15,23,42,0.18); }
.brand-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(255,255,255,0.1), transparent 60%);
  pointer-events: none;
}

.brand-card--ifi-audio    { background: linear-gradient(140deg, #375173 0%, #1A1C1D 100%); color: #fff; }
.brand-card--ifi-studio   { background: linear-gradient(140deg, #a1328e 0%, #3d1f38 100%); color: #fff; }
.brand-card--silentpower { background: linear-gradient(140deg, #0a0908 0%, #2a2520 100%); color: #E6E3DB; }
.brand-card--airo         { background: linear-gradient(140deg, #ffffff 0%, #fff0f0 100%); color: #171717; border: 1px solid #fecdd3; }

/* ---------- Product Card ---------- */
.product-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.product-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15,23,42,0.10); }

.product-card--list {
  flex-direction: row;
  align-items: center;
  padding: 14px 18px;
  border-radius: 12px;
  gap: 16px;
}

/* ---------- Asset / File Card ---------- */
.asset-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.asset-card:hover { background: #f1f5f9; border-color: #cbd5e1; }

.asset-card--restricted { background: #fff5f5; border-color: #fecdd3; }

@media (max-width: 640px) {
  #assetTabPanels .grid {
    grid-template-columns: minmax(0, 360px);
    justify-content: center;
  }

  #assetTabPanels .asset-card {
    width: 100%;
    margin: 0;
  }
}

/* ---------- File Type Badge ---------- */
.file-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.file-badge--pdf  { background: #fee2e2; color: #dc2626; }
.file-badge--png  { background: #dbeafe; color: #2563eb; }
.file-badge--jpg  { background: #dcfce7; color: #16a34a; }
.file-badge--zip  { background: #fef9c3; color: #ca8a04; }
.file-badge--mp4  { background: #ede9fe; color: #7c3aed; }
.file-badge--ai   { background: #ffedd5; color: #ea580c; }
.file-badge--psd  { background: #dbeafe; color: #1d4ed8; }

/* ---------- Restricted / Locked Badge ---------- */
.restricted-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecdd3;
}
.restricted-card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(3px);
  border-radius: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
}

/* ---------- Tabs ---------- */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e2e8f0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  flex-shrink: 0;
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  white-space: nowrap;
}
.tab-btn:hover   { color: #0f172a; }
.tab-btn.active  { color: var(--brand-primary); border-bottom-color: var(--brand-primary); font-weight: 600; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Filter Chips ---------- */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.filter-chip:hover  { border-color: var(--brand-primary); color: var(--brand-primary); }
.filter-chip.active { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  border: none;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary  { background: var(--brand-primary); color: var(--brand-secondary); }
.btn-primary:hover { background: var(--brand-primary-h); }
.btn-secondary { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.btn-secondary:hover { background: #f9fafb; }
.btn-ghost    { background: transparent; color: #374151; }
.btn-ghost:hover { background: #f1f5f9; }
.btn-sm { padding: 6px 12px; font-size: 0.8125rem; border-radius: 8px; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* ---------- Search Input ---------- */
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-input-wrap:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(55,81,115,0.10);
}
.search-input-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: 0.875rem;
  color: #0f172a;
  outline: none;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: #64748b;
}
.breadcrumb a { color: #64748b; text-decoration: none; }
.breadcrumb a:hover { color: var(--brand-primary); text-decoration: underline; }
.breadcrumb .sep { color: #cbd5e1; }
.breadcrumb .current { color: #0f172a; font-weight: 500; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-x: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal-box {
  background: #fff;
  border-radius: 20px;
  max-width: min(580px, calc(100vw - 40px));
  width: 100%;
  max-height: 90vh;
  overflow-x: hidden;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(15,23,42,0.22);
  transform: scale(0.96) translateY(10px);
  transition: transform 0.25s ease;
}
.modal-backdrop.open .modal-box { transform: scale(1) translateY(0); }

@media (max-width: 640px) {
  .modal-backdrop {
    padding: 10px;
  }

  .modal-box {
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    border-radius: 14px;
  }
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: rgba(15,23,42,0.94);
  color: #f8fafc;
  padding: 14px 16px;
  border-radius: 16px;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.45;
  box-shadow: 0 18px 45px rgba(15,23,42,0.28);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(14px);
  pointer-events: all;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transform: translateY(10px) scale(0.98);
  opacity: 0;
  animation: toastIn 0.3s ease forwards;
  min-width: 300px;
  max-width: 380px;
}
.toast svg { margin-top: 1px; }
.toast.toast--success {
  background: linear-gradient(135deg, rgba(22,101,52,0.96), rgba(21,128,61,0.92));
  border-color: rgba(187,247,208,0.18);
}
.toast.toast--error {
  background: linear-gradient(135deg, rgba(127,29,29,0.97), rgba(153,27,27,0.93));
  border-color: rgba(254,202,202,0.14);
}
@keyframes toastIn {
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ---------- Skeleton Loading ---------- */
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Placeholder image treatment ---------- */
.img-placeholder {
  background: linear-gradient(135deg, #e2e8f0 0%, #f1f5f9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* ---------- Collection Card ---------- */
.collection-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.collection-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--brand-primary);
  transform: scaleX(0);
  transition: transform 0.2s ease;
  transform-origin: left;
}
.collection-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15,23,42,0.10); }
.collection-card:hover::before { transform: scaleX(1); }

/* ---------- Pagination ---------- */
.page-btn {
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  background: #fff;
  color: #374151;
  transition: all 0.15s ease;
}
.page-btn:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.page-btn.active { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }

/* ---------- Stat Box ---------- */
.stat-box {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px 22px;
}

/* ---------- Access Denied ---------- */
.lock-icon-wrap {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: #fef2f2;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

/* ---------- Utilities ---------- */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Sidebar overlay on mobile ---------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 49;
}
.sidebar-overlay.visible { display: block; }

/* ---------- Header ---------- */
.portal-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 64px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}

/* ---------- View toggle active ---------- */
.view-toggle-btn { padding: 7px 10px; border-radius: 8px; cursor: pointer; border: none; background: transparent; color: #64748b; }
.view-toggle-btn:hover { background: #f1f5f9; color: #0f172a; }
.view-toggle-btn.active { background: var(--brand-primary); color: #fff; }
