/* Modern Certificate Showcase Design System */
/* Suleyman Hajizadeh - 2026 Edition */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Menlo, Monaco, Consolas, monospace;

  /* Dark Theme Tokens (Default) */
  --bg-body: #090d16;
  --bg-surface: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.65);
  --bg-card-hover: rgba(30, 41, 59, 0.95);
  --bg-elevated: #1e293b;
  --bg-input: rgba(15, 23, 42, 0.75);
  --border-subtle: rgba(148, 163, 184, 0.12);
  --border-card: rgba(148, 163, 184, 0.18);
  --border-hover: rgba(99, 102, 241, 0.6);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #090d16;

  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --gradient-brand: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
  --gradient-card: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0) 100%);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.25), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 35px -5px rgba(99, 102, 241, 0.25);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 350ms cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-input: #ffffff;
  --border-subtle: rgba(148, 163, 184, 0.25);
  --border-card: rgba(148, 163, 184, 0.3);
  --border-hover: rgba(99, 102, 241, 0.5);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #f8fafc;

  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.1), 0 6px 12px -3px rgba(15, 23, 42, 0.05);
  --shadow-glow: 0 0 30px -5px rgba(99, 102, 241, 0.18);
  --gradient-card: linear-gradient(180deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.4) 100%);
}

/* Base Reset & Core Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark light;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  -webkit-font-smoothing: antialiased;
}

/* Background Ambient Glow */
.bg-ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.bg-ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.15;
  animation: float 20s ease-in-out infinite alternate;
}

.bg-ambient-orb-1 {
  width: 500px;
  height: 500px;
  top: -100px;
  left: 20%;
  background: var(--accent-primary);
}

.bg-ambient-orb-2 {
  width: 450px;
  height: 450px;
  top: 30%;
  right: -50px;
  background: var(--accent-secondary);
  animation-duration: 25s;
}

.bg-ambient-orb-3 {
  width: 400px;
  height: 400px;
  bottom: 10%;
  left: -50px;
  background: var(--accent-cyan);
  animation-duration: 22s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.08); }
  100% { transform: translate(-30px, 50px) scale(0.95); }
}

/* Main Container */
.container {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Navigation Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(9, 13, 22, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

[data-theme="light"] .site-header {
  background: rgba(248, 250, 252, 0.85);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4.25rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-brand);
  color: #ffffff;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* Action Buttons */
.btn-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-icon:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-pill:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

/* Hero Section */
.hero {
  padding: 3.5rem 0 2rem;
  position: relative;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2.5rem;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: var(--accent-primary);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.hero-title .gradient-text {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 680px;
  line-height: 1.65;
  margin-bottom: 1.75rem;
}

.hero-socials {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Stats Ribbon */
.stats-ribbon {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-top: 2.5rem;
  padding: 1.25rem;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-md);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.5rem 0.75rem;
}

.stat-icon-wrap {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-primary);
  flex-shrink: 0;
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Toolbar & Filters Section */
.controls-section {
  position: sticky;
  top: 4.25rem;
  z-index: 40;
  padding: 1rem 0;
  background: rgba(9, 13, 22, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 2rem;
  transition: all var(--transition-fast);
}

[data-theme="light"] .controls-section {
  background: rgba(248, 250, 252, 0.92);
}

.controls-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.controls-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Search Bar */
.search-box {
  position: relative;
  flex: 1;
  min-width: 260px;
  max-width: 460px;
}

.search-input {
  width: 100%;
  height: 2.75rem;
  padding: 0 2.75rem 0 2.6rem;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: all var(--transition-fast);
}

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

.search-icon-left {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-clear-btn {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 50%;
  display: none;
}

.search-clear-btn.visible {
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-shortcut {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  pointer-events: none;
}

/* Select Dropdown & View Mode */
.controls-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.select-wrap {
  position: relative;
}

.select-custom {
  height: 2.75rem;
  padding: 0 2.25rem 0 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all var(--transition-fast);
}

.select-custom:focus {
  border-color: var(--accent-primary);
}

.select-arrow {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-muted);
}

/* View Mode Switcher */
.view-switch {
  display: flex;
  align-items: center;
  padding: 0.2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
}

.view-btn {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.view-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
}

/* Category Filter Pills */
.filter-pills-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scrollbar-width: none;
}

.filter-pills-row::-webkit-scrollbar {
  display: none;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.pill-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.pill-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.35);
}

.pill-count {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  background: rgba(148, 163, 184, 0.15);
  color: inherit;
}

.pill-btn.active .pill-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Results Status Bar */
.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.results-count b {
  color: var(--text-primary);
}

/* Gallery Grid View */
.cert-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.75rem;
  margin-bottom: 4rem;
}

/* Certificate Card */
.cert-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-card);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.cert-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

/* Card Media / Thumbnail */
.cert-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10.5;
  background: #000000;
  overflow: hidden;
  cursor: pointer;
}

.cert-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: transform var(--transition-smooth), opacity var(--transition-fast);
  display: block;
}

.cert-card:hover .cert-thumb {
  transform: scale(1.05);
}

.cert-overlay-hover {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.cert-card:hover .cert-overlay-hover {
  opacity: 1;
}

.cert-quick-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-full);
  background: #ffffff;
  color: #0f172a;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transform: translateY(8px);
  transition: transform var(--transition-fast);
}

.cert-card:hover .cert-quick-view-btn {
  transform: translateY(0);
}

/* Category & Issuer Chips on Thumbnail */
.thumb-chips {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 2;
}

.chip-issuer {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  letter-spacing: 0.02em;
}

.chip-category {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.chip-cat-ai { background: rgba(99, 102, 241, 0.85); color: #ffffff; }
.chip-cat-bio { background: rgba(16, 185, 129, 0.85); color: #ffffff; }
.chip-cat-cs { background: rgba(14, 165, 233, 0.85); color: #ffffff; }
.chip-cat-data { background: rgba(245, 158, 11, 0.85); color: #ffffff; }
.chip-cat-business { background: rgba(168, 85, 247, 0.85); color: #ffffff; }
.chip-cat-other { background: rgba(244, 63, 94, 0.85); color: #ffffff; }

/* Card Content */
.cert-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.cert-meta-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.cert-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.cert-id-tag {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.cert-title {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.015em;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.cert-title:hover {
  color: var(--accent-primary);
}

.cert-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Tag Pills */
.cert-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: auto;
  margin-bottom: 1.15rem;
}

.tag-badge {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

/* Card Actions */
.cert-footer-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
}

.btn-card-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  border: 1px solid transparent;
}

.btn-card-primary {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  border-color: rgba(99, 102, 241, 0.25);
}

.btn-card-primary:hover {
  background: var(--accent-primary);
  color: #ffffff;
}

.btn-card-pdf {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.btn-card-pdf:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.btn-card-icon {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-card-icon:hover {
  color: var(--accent-primary);
  border-color: var(--border-hover);
}

/* List View Mode */
.cert-gallery-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 4rem;
}

.cert-gallery-list .cert-card {
  flex-direction: row;
  align-items: center;
  padding: 0.75rem 1rem;
}

.cert-gallery-list .cert-thumb-wrap {
  width: 140px;
  height: 90px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  aspect-ratio: auto;
}

.cert-gallery-list .thumb-chips {
  display: none;
}

.cert-gallery-list .cert-body {
  padding: 0 1.25rem;
  flex: 1;
}

.cert-gallery-list .cert-title {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.cert-gallery-list .cert-desc {
  display: none;
}

.cert-gallery-list .cert-footer-actions {
  border-top: none;
  padding-top: 0;
  margin-left: auto;
  flex-shrink: 0;
  width: auto;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px dashed var(--border-card);
  margin-bottom: 4rem;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.empty-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto 1.5rem;
}

/* Native Dialog Lightbox Modal (Modern Web Guidance Compliance) */
dialog#certModal {
  position: fixed;
  inset: 0;
  width: min(94vw, 1200px);
  max-height: 90vh;
  margin: auto;
  padding: 0;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  outline: none;
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}

/* Backdrop */
dialog#certModal::backdrop {
  background-color: rgba(5, 8, 16, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Modal Content Layout */
.modal-layout {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  height: 90vh;
  max-height: 90vh;
}

/* Left: Image Viewer with Zoom Controls */
.modal-viewer-side {
  position: relative;
  background: #050810;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-right: 1px solid var(--border-subtle);
  user-select: none;
}

.modal-img-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 1.5rem;
  cursor: grab;
}

.modal-img-container:active {
  cursor: grabbing;
}

.modal-cert-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transition: transform 150ms ease-out;
  transform-origin: center center;
}

/* Viewer Controls Overlay */
.viewer-controls {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  z-index: 5;
}

.viewer-btn {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.viewer-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Lightbox Navigation Chevrons */
.modal-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  z-index: 6;
}

.modal-nav-arrow:hover {
  background: var(--accent-primary);
  transform: translateY(-50%) scale(1.1);
}

.modal-nav-prev { left: 1rem; }
.modal-nav-next { right: 1rem; }

/* Right: Metadata Panel */
.modal-info-side {
  display: flex;
  flex-direction: column;
  padding: 2rem;
  overflow-y: auto;
  background: var(--bg-surface);
}

.modal-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.modal-close-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.modal-close-btn:hover {
  background: var(--accent-rose);
  color: #ffffff;
  border-color: var(--accent-rose);
}

.modal-badges-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.modal-issuer {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* Detail Table */
.modal-details-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem 1rem;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
}

.detail-label {
  color: var(--text-muted);
  font-weight: 600;
}

.detail-val {
  color: var(--text-primary);
  font-weight: 500;
}

.detail-val-mono {
  font-family: var(--font-mono);
  color: var(--accent-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Modal Actions */
.modal-actions-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: auto;
}

.btn-modal-action {
  width: 100%;
  height: 3rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.btn-modal-primary {
  background: var(--gradient-brand);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.btn-modal-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.btn-modal-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-modal-secondary:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-hover);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  transform: translateY(20px);
  opacity: 0;
  animation: toastIn 250ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastIn {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.toast.toast-out {
  animation: toastOut 200ms ease-in forwards;
}

@keyframes toastOut {
  to {
    transform: translateY(15px);
    opacity: 0;
  }
}

/* Back to Top Floating Button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(15px);
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-md);
  z-index: 30;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

/* Footer */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 3rem 0;
}

.footer-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer-author {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.footer-note {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Responsive Breakpoints */
@media (max-width: 960px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .modal-layout {
    grid-template-columns: 1fr;
    height: auto;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal-viewer-side {
    height: 350px;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .cert-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 1rem;
  }

  .controls-top-row {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: 100%;
  }

  .controls-actions {
    justify-content: space-between;
  }

  .cert-gallery-list .cert-card {
    flex-direction: column;
    align-items: stretch;
  }

  .cert-gallery-list .cert-thumb-wrap {
    width: 100%;
    height: 180px;
  }

  .cert-gallery-list .cert-body {
    padding: 1rem 0;
  }

  .cert-gallery-list .cert-footer-actions {
    margin-left: 0;
    width: 100%;
  }

  .modal-viewer-side {
    height: 260px;
  }

  .modal-info-side {
    padding: 1.25rem;
  }
}

/* Print Optimization */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .site-header,
  .controls-section,
  .site-footer,
  .btn-icon,
  .back-to-top,
  .bg-ambient {
    display: none !important;
  }

  .cert-gallery-grid {
    display: block;
  }

  .cert-card {
    page-break-inside: avoid;
    break-inside: avoid;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    margin-bottom: 2rem;
  }
}
