/* ==========================================================================
   SHADCN/UI INSPIRED PURE CSS DESIGN SYSTEM (ZERO BUILD / 100% PHP READY)
   Media Digital Publikasi Indonesia — Public, Admin & Mitra Unified UI
   Pairs with Anime.js + Motion Vanilla JS (static/js/ui-motion-kit.js)
   ========================================================================== */

:root {
  --ui-background: #ffffff;
  --ui-foreground: #09090b;
  --ui-card: #ffffff;
  --ui-card-foreground: #09090b;
  --ui-popover: #ffffff;
  --ui-popover-foreground: #09090b;
  --ui-primary: #0f172a;
  --ui-primary-foreground: #f8fafc;
  --ui-secondary: #f1f5f9;
  --ui-secondary-foreground: #0f172a;
  --ui-muted: #f4f4f5;
  --ui-muted-foreground: #64748b;
  --ui-accent: #e0f2fe;
  --ui-accent-foreground: #0369a1;
  --ui-destructive: #dc2626;
  --ui-destructive-foreground: #ffffff;
  --ui-success: #15803d;
  --ui-warning: #b45309;
  --ui-border: #e2e8f0;
  --ui-input: #cbd5e1;
  --ui-ring: #0284c7;
  --ui-radius: 0.625rem;
}

[data-theme="dark"],
body.dark-mode,
html.dark {
  --ui-background: #090d16;
  --ui-foreground: #f8fafc;
  --ui-card: #111827;
  --ui-card-foreground: #f8fafc;
  --ui-popover: #111827;
  --ui-popover-foreground: #f8fafc;
  --ui-primary: #f8fafc;
  --ui-primary-foreground: #0f172a;
  --ui-secondary: #1e293b;
  --ui-secondary-foreground: #f8fafc;
  --ui-muted: #1e293b;
  --ui-muted-foreground: #94a3b8;
  --ui-accent: rgba(56, 189, 248, 0.16);
  --ui-accent-foreground: #38bdf8;
  --ui-border: #1e293b;
  --ui-input: #334155;
  --ui-ring: #38bdf8;
}

/* ==========================================================================
   1. SHADCN/UI COMPONENT REFINEMENTS (BUTTONS, INPUTS, CARDS, DIALOGS, BADGES)
   ========================================================================== */
.btn,
button.btn {
  border-radius: var(--ui-radius);
  font-weight: 600;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.14s ease;
}

.btn:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--ui-background), 0 0 0 4px var(--ui-ring);
}

.btn-outline {
  border: 1px solid var(--ui-border);
  background: var(--ui-card);
  color: var(--ui-foreground);
}

.btn-outline:hover {
  background: var(--ui-secondary);
  border-color: var(--ui-input);
}

/* Contrast-Safe Outline Buttons on Dark Hero Banners (SINTA Badge, Home, etc.) */
.hero-section .btn-outline {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.38) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.hero-section .btn-outline:hover {
  background: rgba(255, 255, 255, 0.22) !important;
  border-color: rgba(255, 255, 255, 0.65) !important;
  color: #ffffff !important;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="search"],
select,
textarea,
.form-control,
.search-input,
.year-select {
  border-radius: var(--ui-radius);
  border-color: var(--ui-input);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus,
.search-input:focus,
.year-select:focus {
  outline: none;
  border-color: var(--ui-ring) !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.16) !important;
}

/* Shadcn-style Dialog / Modal Refinement */
.modal-content {
  border-radius: 16px !important;
  border: 1px solid var(--ui-border) !important;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.28) !important;
}

/* Shadcn-style Alert / Info Banner */
.ui-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: var(--ui-radius);
  border: 1px solid var(--ui-border);
  background: var(--ui-card);
  color: var(--ui-foreground);
  font-size: 0.85rem;
  line-height: 1.5;
}

.ui-alert-info    { border-color: #bae6fd; background: #f0f9ff; color: #0c4a6e; }
.ui-alert-success { border-color: #bbf7d0; background: #f0fdf4; color: #14532d; }
.ui-alert-warning { border-color: #fde68a; background: #fffbeb; color: #78350f; }
.ui-alert-danger  { border-color: #fecaca; background: #fef2f2; color: #7f1d1d; }

/* ==========================================================================
   2. SHADCN/UI COMMAND PALETTE (CTRL+K / CMD+K)
   ========================================================================== */
.ui-cmd-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.36rem 0.65rem;
  border-radius: var(--ui-radius);
  border: 1px solid var(--ui-border);
  background: var(--ui-secondary);
  color: var(--ui-muted-foreground);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.ui-cmd-trigger:hover {
  background: var(--ui-card);
  color: var(--ui-foreground);
  border-color: var(--ui-input);
}

.ui-cmd-kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--ui-card);
  border: 1px solid var(--ui-border);
  color: var(--ui-muted-foreground);
}

#shadcnCommandOverlay {
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: rgba(9, 13, 22, 0.56);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: min(12vh, 96px) 1rem 1.5rem;
}

#shadcnCommandOverlay.open {
  display: flex;
}

.ui-cmd-dialog {
  width: 100%;
  max-width: 560px;
  background: var(--ui-popover);
  color: var(--ui-popover-foreground);
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  box-shadow: 0 24px 60px -12px rgba(9, 13, 22, 0.45);
  overflow: hidden;
}

.ui-cmd-input-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--ui-border);
}

.ui-cmd-input-row svg {
  width: 17px;
  height: 17px;
  color: var(--ui-muted-foreground);
  flex-shrink: 0;
}

.ui-cmd-input {
  width: 100%;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent;
  color: var(--ui-foreground);
  font-size: 0.94rem !important;
  min-height: 28px !important;
  padding: 0 !important;
}

.ui-cmd-list {
  max-height: 360px;
  overflow-y: auto;
  padding: 0.5rem;
}

.ui-cmd-group-label {
  font-size: 0.69rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ui-muted-foreground);
  padding: 0.4rem 0.65rem 0.25rem;
}

.ui-cmd-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.7rem;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--ui-foreground);
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.ui-cmd-item:hover,
.ui-cmd-item.selected {
  background: var(--ui-accent);
  color: var(--ui-accent-foreground);
}

.ui-cmd-item-left {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.ui-cmd-item-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  background: var(--ui-secondary);
  color: var(--ui-muted-foreground);
  flex-shrink: 0;
}

.ui-cmd-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1rem;
  border-top: 1px solid var(--ui-border);
  background: var(--ui-secondary);
  font-size: 0.72rem;
  color: var(--ui-muted-foreground);
}

/* ==========================================================================
   3. SHADCN / SONNER-STYLE STACKABLE TOAST NOTIFICATIONS
   ========================================================================== */
#shadcnToastViewport {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 9995;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: min(380px, calc(100vw - 2rem));
  pointer-events: none;
}

@media (max-width: 768px) {
  #shadcnToastViewport {
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
  }
}

.ui-toast {
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: var(--ui-card);
  color: var(--ui-card-foreground);
  border: 1px solid var(--ui-border);
  box-shadow: 0 16px 36px -10px rgba(9, 13, 22, 0.24), 0 4px 10px -2px rgba(9, 13, 22, 0.08);
}

.ui-toast-icon {
  width: 22px;
  height: 22px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  font-size: 0.76rem;
  font-weight: 800;
}

.ui-toast-success .ui-toast-icon { background: #dcfce7; color: #15803d; }
.ui-toast-error   .ui-toast-icon { background: #fee2e2; color: #dc2626; }
.ui-toast-warning .ui-toast-icon { background: #fef3c7; color: #b45309; }
.ui-toast-info    .ui-toast-icon { background: #e0f2fe; color: #0284c7; }

.ui-toast-body {
  flex: 1;
  min-width: 0;
}

.ui-toast-title {
  font-size: 0.84rem;
  font-weight: 800;
  margin: 0 0 2px;
  line-height: 1.3;
}

.ui-toast-desc {
  font-size: 0.79rem;
  color: var(--ui-muted-foreground);
  margin: 0;
  line-height: 1.42;
  word-break: break-word;
}

.ui-toast-close {
  border: none;
  background: transparent;
  color: var(--ui-muted-foreground);
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 6px;
  font-size: 1rem;
  line-height: 1;
}

.ui-toast-close:hover {
  background: var(--ui-secondary);
  color: var(--ui-foreground);
}

.ui-toast-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2.5px;
  width: 100%;
  transform-origin: left center;
}

.ui-toast-success .ui-toast-progress { background: #16a34a; }
.ui-toast-error   .ui-toast-progress { background: #dc2626; }
.ui-toast-warning .ui-toast-progress { background: #d97706; }
.ui-toast-info    .ui-toast-progress { background: #0284c7; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   4. SHADCN/UI DETAIL PUBLIKASI (SINTA BADGE OJS + OPENALEX ANALYTICS)
   ========================================================================== */
.oa-shadcn-shell {
  background: var(--ui-card);
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  padding: clamp(1.15rem, 2.5vw, 2rem);
  box-shadow: 0 12px 32px -12px rgba(15, 23, 42, 0.08);
}

.oa-shadcn-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--ui-secondary);
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.oa-shadcn-tab {
  border: none;
  background: transparent;
  color: var(--ui-muted-foreground);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.42rem 0.85rem;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.oa-shadcn-tab:hover {
  color: var(--ui-foreground);
}

.oa-shadcn-tab.active {
  background: var(--ui-card);
  color: var(--ui-foreground);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

.oa-kpi-card {
  background: var(--ui-card);
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  padding: 1rem 1.05rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.oa-kpi-card:hover {
  border-color: rgba(2, 132, 199, 0.4);
  box-shadow: 0 10px 22px -10px rgba(15, 23, 42, 0.12);
  transform: translateY(-2px);
}

.oa-kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.oa-kpi-label {
  font-size: 0.69rem;
  font-weight: 700;
  color: var(--ui-muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.oa-kpi-val {
  font-family: var(--font-serif, 'Newsreader', Georgia, serif);
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 6px;
  line-height: 1.15;
}

.oa-shadcn-card {
  background: var(--ui-card);
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.oa-article-card {
  background: var(--ui-card);
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.oa-article-card:hover {
  border-color: rgba(2, 132, 199, 0.38);
  box-shadow: 0 10px 24px -12px rgba(15, 23, 42, 0.12);
}

.oa-inst-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #0f766e, #16a34a);
}

.oa-topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid var(--ui-border);
  color: #334155;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.76rem;
  font-weight: 600;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.oa-topic-chip:hover {
  border-color: #a78bfa;
  background: #f5f3ff;
  color: #5b21b6;
}

/* shadcn/ui Skeleton Shimmer */
@keyframes uiSkeletonPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.ui-skeleton {
  background: #e2e8f0;
  border-radius: 8px;
  animation: uiSkeletonPulse 1.4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@media (max-width: 1024px) {
  .oa-kpi-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 640px) {
  .oa-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
