/* ============================================
   APPS PAGE — page-specific styles
   Mengikuti gaya jurnal.css supaya konsisten
   ============================================ */

.apps-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-12) var(--space-8);
}

/* ============================================
   FILTER BAR
   ============================================ */
.filter-section {
  background: white;
  padding: var(--space-8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  margin-bottom: var(--space-8);
}

.search-box {
  position: relative;
  margin-bottom: var(--space-6);
}

.search-box::before {
  content: "🔍";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  z-index: 1;
}

.search-box input {
  width: 100%;
  padding: 0.85rem 6rem 0.85rem 3rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background: white;
  transition: var(--transition);
  outline: none;
}

.search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.5rem 1.1rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  z-index: 2;
}

.search-btn:hover {
  background: var(--color-primary-dark);
  box-shadow: 0 2px 8px rgba(88,101,200,0.3);
}

.search-box input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(88,101,200,0.1);
}

.search-box input::placeholder { color: #aaa; }

.filters-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.filter-group label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.filter-dropdown {
  width: 100%;
  padding: 0.7rem var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text);
  background: white;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}

.filter-dropdown:hover,
.filter-dropdown:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(88,101,200,0.08);
}

/* ============================================
   STATS BAR + AKSI (view toggle, analisis, ekspor)
   ============================================ */
.stats-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-6);
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
  gap: var(--space-4);
}

.stats-info {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.stats-info strong {
  color: var(--color-primary);
  font-weight: 700;
}

.stats-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* ----- View toggle (1/2/3 kolom) ----- */
.view-toggle {
  display: inline-flex;
  background: white;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.view-btn {
  padding: 0.5rem 0.7rem;
  background: white;
  border: none;
  border-right: 1px solid var(--color-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.view-btn:last-child { border-right: none; }
.view-btn:hover { background: var(--color-bg-alt); }
.view-btn.active { background: var(--color-primary); }
.view-btn.active .view-icon,
.view-btn.active .view-icon::before,
.view-btn.active .view-icon::after { background: white; }

.view-icon {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 12px;
  background: var(--color-text);
  transition: var(--transition);
}

.view-icon-2 { width: 6px; margin-right: 8px; }
.view-icon-2::after {
  content: "";
  position: absolute;
  left: 8px; top: 0;
  width: 6px; height: 12px;
  background: var(--color-text);
}

.view-icon-3 { width: 3px; margin-right: 14px; }
.view-icon-3::before {
  content: "";
  position: absolute;
  left: 5px; top: 0;
  width: 3px; height: 12px;
  background: var(--color-text);
}
.view-icon-3::after {
  content: "";
  position: absolute;
  left: 10px; top: 0;
  width: 3px; height: 12px;
  background: var(--color-text);
}

/* ----- Tombol aksi ----- */
.action-btn {
  padding: 0.55rem 1rem;
  background: white;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.action-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.action-btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.action-btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: white;
  box-shadow: 0 4px 14px rgba(88,101,200,0.3);
}

/* ============================================
   GRID HASIL — 1/2/3 KOLOM
   ============================================ */
.apps-grid {
  display: grid;
  gap: var(--space-4);
  margin-bottom: var(--space-12);
}

.apps-grid.cols-1 { grid-template-columns: 1fr; }
.apps-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.apps-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

/* ============================================
   CARD ARTIKEL
   ============================================ */
.article-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--color-border);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

.article-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-3);
  line-height: 1.35;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.article-meta .badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-year     { background: #e8f5e9; color: #2e7d32; }
.badge-journal  { background: #ede8fb; color: #3d4aad; }
.badge-volume   { background: #e3f2fd; color: #1565c0; }
.badge-keyword  { background: #fff4e0; color: #b56a00; }

.article-authors {
  font-size: var(--text-sm);
  color: var(--color-text);
  margin-bottom: var(--space-2);
  line-height: 1.5;
}

.article-affiliation {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  font-style: italic;
}

.article-abstract {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: var(--space-3);
  flex-grow: 1;
}

.article-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}

.article-footer {
  display: flex;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
  margin-top: auto;
  flex-wrap: wrap;
}

.article-btn {
  flex: 1;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
  border: 1.5px solid var(--color-border);
  background: white;
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  text-decoration: none;
  white-space: nowrap;
}

.article-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-1px);
}

.article-btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.article-btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: white;
}

.article-btn-garuda {
  background: #fff;
  border-color: #00796b;
  color: #00796b;
}
.article-btn-garuda:hover {
  background: #00796b;
  border-color: #00796b;
  color: white;
}

.article-btn-scholar {
  background: #fff;
  border-color: #4285F4;
  color: #1a73e8;
}
.article-btn-scholar:hover {
  background: #4285F4;
  border-color: #4285F4;
  color: white;
}

/* ============================================
   SEARCH COLUMN PICKER  (dropdown + chips)
   ============================================ */
.search-col-picker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg-alt);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  min-height: 40px;
}

.search-col-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.col-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  flex: 1;
  min-height: 28px;
}

.col-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem 0.22rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  background: #e53e3e;
  color: white;
  border: none;
  user-select: none;
  white-space: nowrap;
}

.col-chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 0.9em;
  line-height: 1;
  cursor: pointer;
  background: rgba(255,255,255,0.25);
  border: none;
  color: white;
  padding: 0;
  transition: background 0.15s;
  flex-shrink: 0;
}
.col-chip-x:hover { background: rgba(255,255,255,0.5); }

.col-dropdown-wrap {
  position: relative;
  flex-shrink: 0;
}

.col-dropdown {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  background: white;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.col-dropdown:hover,
.col-dropdown.open {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.col-dropdown-arrow { font-size: 0.7em; }

.col-option-list {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  background: white;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2) 0;
  z-index: 500;
  list-style: none;
  margin: 0;
  max-height: 260px;
  overflow-y: auto;
}
.col-option-list.open { display: block; }

.col-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.45rem var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.12s;
  user-select: none;
}
.col-option:hover { background: var(--color-bg-alt); }
.col-option.selected { font-weight: 600; color: var(--color-primary); }

.col-option-check {
  width: 14px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-primary);
  flex-shrink: 0;
}

.col-clear-all {
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  border: 1.5px dashed var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.col-clear-all:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Hint boolean */
.search-bool-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
  padding: 0 0.25rem;
}
.search-bool-hint code {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  padding: 0.05rem 0.3rem;
  font-size: 0.9em;
  color: var(--color-primary);
}

/* action-btn-scholar untuk modal detail */
.action-btn-scholar {
  border-color: #4285F4;
  color: #1a73e8;
}
.action-btn-scholar:hover {
  background: #4285F4;
  border-color: #4285F4;
  color: white;
  box-shadow: 0 4px 14px rgba(66,133,244,0.3);
}

@media (max-width: 768px) {
  .search-col-picker { gap: var(--space-2); }
  .search-col-label  { width: 100%; }
  .col-option-list   { min-width: 160px; }
}



/* ============================================
   PAGINATION
   ============================================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-12) 0;
  flex-wrap: wrap;
}

.pagination-btn {
  padding: 0.6rem 1rem;
  border: 1.5px solid var(--color-border);
  background: white;
  color: var(--color-text);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  min-width: 42px;
  text-align: center;
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: white;
}

.pagination-btn.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.pagination-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.pagination-info {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  padding: 0 var(--space-2);
}

/* ============================================
   STATES (loading / error / empty)
   ============================================ */
.loading-state,
.error-state,
.no-results {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--color-text-muted);
}

.loading-state h3,
.error-state h3,
.no-results h3 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  margin: 0 auto var(--space-6);
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
}

/* ============================================
   MODAL (analisis & detail artikel)
   ============================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 900px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.25s ease;
}

.modal-content-wide { max-width: 1100px; }

@keyframes modal-in {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-6) var(--space-8);
  border-bottom: 1px solid var(--color-border);
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--color-text);
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.5rem;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--color-bg-alt);
  color: var(--color-text);
}

.modal-body {
  padding: var(--space-6) var(--space-8);
  overflow-y: auto;
}

/* ----- Statistik di modal ----- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.stat-card {
  background: var(--color-bg-alt);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  text-align: center;
  border: 1px solid var(--color-border);
}

.stat-value {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.analysis-section {
  margin-bottom: var(--space-8);
}

.analysis-section h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  margin-bottom: var(--space-4);
  color: var(--color-text);
}

/* ----- Bar chart sederhana ----- */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 50px;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
}

.bar-label {
  color: var(--color-text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  height: 18px;
  background: var(--color-bg-alt);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-sm);
  transition: width 0.6s ease;
}

.bar-fill.bar-secondary { background: var(--color-primary-light); }

.bar-value {
  text-align: right;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 600;
}

/* ============================================
   DETAIL ARTIKEL (modal)
   ============================================ */
.detail-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: var(--space-3);
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.detail-authors {
  font-size: var(--text-base);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.detail-affiliation {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-style: italic;
  margin-bottom: var(--space-4);
}

.detail-actions {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.detail-section {
  margin-bottom: var(--space-8);
}

.detail-section h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-primary);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--color-primary-light);
}

.detail-section-body {
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--color-text);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.detail-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 992px) {
  .filters-row { grid-template-columns: 1fr; }
  .apps-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .apps-wrapper { padding: var(--space-8) var(--space-4); }
  .stats-bar { flex-direction: column; align-items: stretch; }
  .stats-actions { justify-content: space-between; }
  .apps-grid.cols-2,
  .apps-grid.cols-3 { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 90px 1fr 40px; }
  .modal-content { max-height: 92vh; }
  .modal-header,
  .modal-body { padding-left: var(--space-4); padding-right: var(--space-4); }
  .detail-title { font-size: var(--text-xl); }
  .search-col-picker { gap: var(--space-2); }
  .search-col-label { width: 100%; }
}