/* =========================================
   1. GLOBAL VARIABLES & RESET
   ========================================= */
:root {
  /* --- COLOR PALETTE (Light Theme) --- */
  --primary: #0f172a;
  /* Slate 900 (Headings/Text) */
  --primary-light: #1e293b;
  /* Slate 800 (Hover) */

  --accent: #2563eb;
  /* Blue 600 (Brand Color) */
  --accent-dark: #1d4ed8;
  /* Blue 700 (Button Hover) */
  --accent-soft: #eff6ff;
  /* Blue 50 (Backgrounds) */
  --accent-border: #bfdbfe;
  /* Blue 200 (Active Borders) */

  --bg-body: #f8fafc;
  /* Slate 50 (Page BG) */
  --bg-card: #ffffff;
  /* White (Card BG) */
  --bg-subtle: #f1f5f9;
  /* Slate 100 (Secondary BG) */
  --bg-header: rgba(255, 255, 255, 0.95);

  --border: #e2e8f0;
  /* Slate 200 (Borders) */
  --border-dark: #cbd5e1;
  /* Slate 300 (Darker Borders) */

  --text-main: #0f172a;
  /* Main Text */
  --text-secondary: #64748b;
  /* Muted Text */
  --text-tertiary: #94a3b8;
  /* Placeholder Text */

  /* --- SHADOWS --- */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

  /* --- BADGE COLORS --- */
  --badge-q1-bg: #dcfce7;
  --badge-q1-text: #14532d;
  --badge-q1-border: #bbf7d0;
  --badge-q2-bg: #fef9c3;
  --badge-q2-text: #713f12;
  --badge-q2-border: #fde047;
  --badge-q3-bg: #ffedd5;
  --badge-q3-text: #7c2d12;
  --badge-q3-border: #fed7aa;
  --badge-q4-bg: #f1f5f9;
  --badge-q4-text: #475569;
  --badge-q4-border: #e2e8f0;

  --badge-hybrid-bg: #f3e8ff;
  --badge-hybrid-text: #6b21a8;
  --badge-hybrid-border: #e9d5ff;
  --badge-oa-bg: #eff6ff;
  --badge-oa-text: #1e40af;
  --badge-oa-border: #dbeafe;
  --badge-sci-bg: #ffe4e6;
  --badge-sci-text: #be123c;
  --badge-sci-border: #fecdd3;
  --badge-ann-bg: #dcfce7;
  --badge-ann-text: #15803d;
  --badge-ann-border: #bbf7d0;
  --badge-wos-bg: #e0e7ff;
  --badge-wos-text: #4338ca;
  --badge-wos-border: #c7d2fe;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: var(--bg-body);
  color: var(--text-main);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* =========================================
   2. HEADER & NAVIGATION
   ========================================= */
.app-header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  height: 72px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  flex: 1;
  display: flex;
  justify-content: flex-start;
}

.header-right {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.header-center {
  flex: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.logo-box {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow-md);
}

.header-center h1 {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
  color: var(--primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-align: center;
}

.version-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-dark);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

/* --- Buttons --- */
.icon-btn,
.refresh-btn,
.upload-btn,
.add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 8px;
}

.refresh-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
}

.refresh-btn:hover {
  background: var(--bg-subtle);
  color: var(--primary);
  border-color: var(--border-dark);
}

.add-btn {
  background: var(--primary);
  color: white;
  border: 1px solid var(--primary);
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
}

.add-btn:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.file-upload-wrapper input {
  display: none;
}

/* =========================================
   3. HERO SEARCH SECTION
   ========================================= */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px;
}

.search-section {
  margin-bottom: 40px;
}

.search-panel {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-main {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-subtle);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 4px;
  transition: all 0.2s;
}

.search-main:focus-within {
  border-color: var(--accent);
  background: var(--bg-card);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.search-type-wrapper {
  position: relative;
  width: 200px;
  flex-shrink: 0;
}

.search-select {
  width: 100%;
  appearance: none;
  background: transparent;
  border: none;
  font-size: 14px;
  font-weight: 600;
  padding: 0 16px;
  height: 48px;
  cursor: pointer;
  color: var(--text-main);
  outline: none;
}

.select-arrow {
  position: absolute;
  right: 12px;
  top: 16px;
  width: 16px;
  height: 16px;
  pointer-events: none;
  color: var(--text-secondary);
}

.divider-vertical {
  width: 1px;
  height: 28px;
  background: var(--border-dark);
  margin: 0 8px;
  opacity: 0.5;
}

.input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 10px;
  position: relative;
}

.search-icon {
  width: 20px;
  height: 20px;
  color: var(--text-tertiary);
}

#searchInput {
  border: none;
  background: transparent;
  width: 100%;
  height: 48px;
  font-size: 15px;
  outline: none;
  color: var(--text-main);
  font-weight: 500;
}

#searchInput::placeholder {
  color: var(--text-tertiary);
}

.clear-input-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.clear-input-btn:hover {
  background: var(--border);
  color: var(--accent);
}

.clear-input-btn svg {
  width: 18px;
  height: 18px;
}

.btn-search {
  background: var(--accent);
  color: white;
  border: none;
  height: 48px;
  padding: 0 32px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn-search:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

/* --- AUTOCOMPLETE SUGGESTIONS BOX --- */
.suggestions-box {
  position: absolute;
  top: 55px;
  /* right below input */
  left: 0;
  width: 100%;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-hover);
  z-index: 1000;
  max-height: 250px;
  overflow-y: auto;
  display: none;
}

.suggestions-box.active {
  display: block;
}

.suggestion-item {
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-main);
  cursor: pointer;
  border-bottom: 1px solid var(--bg-subtle);
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

/* Highlight Text */
mark {
  background: #fef9c3;
  /* Soft Yellow */
  color: #854d0e;
  font-weight: 700;
  border-radius: 2px;
  padding: 0 1px;
}

.search-options {
  padding: 8px 16px;
  display: flex;
  justify-content: flex-end;
}

.sort-control {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.sort-icon {
  width: 14px;
  height: 14px;
}

.sort-control select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  background: var(--bg-card);
  transition: border-color 0.2s;
}

.sort-control select:hover {
  border-color: var(--text-tertiary);
}

/* =========================================
   4. LAYOUT & SIDEBAR
   ========================================= */
.content-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  align-items: start;
  margin-top: 30px;
}

.sidebar {
  position: sticky;
  top: 100px;
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}

.sidebar-scroll {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.filter-group {
  margin-bottom: 32px;
}

.filter-title {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 800;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-title svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

/* --- SCROLLABLE LIST FOR AREAS --- */
.scrollable-list {
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
  border: 1px solid var(--border);
  padding: 8px;
  border-radius: 8px;
  background: var(--bg-subtle);
  margin-top: 8px;
}

.sidebar-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--bg-subtle);
  color: var(--text-main);
  outline: none;
  margin-bottom: 4px;
}

.sidebar-search-input:focus {
  border-color: var(--accent);
}

.empty-msg {
  font-size: 13px;
  color: var(--text-tertiary);
  text-align: center;
  padding: 10px;
}

.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.custom-checkbox {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-main);
  user-select: none;
  transition: color 0.2s;
}

.custom-checkbox:hover {
  color: var(--accent);
}

.custom-checkbox input {
  display: none;
}

.checkmark {
  width: 18px;
  height: 18px;
  border: 1.5px solid #cbd5e1;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  background: var(--bg-card);
  flex-shrink: 0;
}

.custom-checkbox input:checked+.checkmark {
  background: var(--accent);
  border-color: var(--accent);
}

.checkmark:after {
  content: "";
  display: none;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.custom-checkbox input:checked+.checkmark:after {
  display: block;
}

.btn-reset {
  width: 100%;
  padding: 12px;
  border: 1px dashed var(--border);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
  margin-top: 10px;
}

.btn-reset:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* =========================================
   5. RESULTS & CARDS
   ========================================= */
.results-header {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.results-header h2 {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 500;
  margin: 0;
}

.results-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Card Structure */
.card {
  display: grid;
  grid-template-columns: 120px 1fr;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent-border);
}

.card-cover {
  background: linear-gradient(160deg, #f1f5f9 0%, #e2e8f0 100%);
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.05));
}

.card-body {
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* Card Top */
.card-top {
  padding: 20px 24px;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 16px;
}

.card-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Badge Styles */
.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-q1 {
  background: var(--badge-q1-bg);
  color: var(--badge-q1-text);
  border-color: var(--badge-q1-border);
}

.badge-q2 {
  background: var(--badge-q2-bg);
  color: var(--badge-q2-text);
  border-color: var(--badge-q2-border);
}

.badge-q3 {
  background: var(--badge-q3-bg);
  color: var(--badge-q3-text);
  border-color: var(--badge-q3-border);
}

.badge-q4 {
  background: var(--badge-q4-bg);
  color: var(--badge-q4-text);
  border-color: var(--badge-q4-border);
}

.badge-hybrid {
  background: var(--badge-hybrid-bg);
  color: var(--badge-hybrid-text);
  border-color: var(--badge-hybrid-border);
}

.badge-oa {
  background: var(--badge-oa-bg);
  color: var(--badge-oa-text);
  border-color: var(--badge-oa-border);
}

.badge-sci {
  background: var(--badge-sci-bg);
  color: var(--badge-sci-text);
  border-color: var(--badge-sci-border);
}

.badge-ann {
  background: var(--badge-ann-bg);
  color: var(--badge-ann-text);
  border-color: var(--badge-ann-border);
}

.badge-wos {
  background: var(--badge-wos-bg);
  color: var(--badge-wos-text);
  border-color: var(--badge-wos-border);
}

/* NEW NEAT BADGES (Non-Indexing & Subscription) */
.badge-non {
  background-color: #475569;
  /* Slate 600 */
  color: #f1f5f9;
  /* White-ish text */
  border: 1px solid #334155;
}

.badge-sub {
  background-color: #d97706;
  /* Amber 600 */
  color: white;
  border: 1px solid #b45309;
}

/* ISSN Tag */
.issn-box {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: var(--bg-subtle);
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--primary);
  font-weight: 800;
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* Card Content */
.card-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 8px 0;
  line-height: 1.4;
  text-transform: uppercase;
  word-spacing: 3px;
}

.card-publisher {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

/* Metrics Grid */
.metrics-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.stat-box {
  padding: 12px 16px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-box:last-child {
  border-right: none;
}

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 4px;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Meta Data */
.meta-info {
  padding: 16px 24px;
  background: var(--bg-card);
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meta-item svg {
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
}

.meta-item strong {
  color: var(--primary);
  font-weight: 600;
}

/* Available In Section */
.available-section {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.available-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.available-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.avail-tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.avail-icon {
  color: #16a34a;
  width: 14px;
  height: 14px;
}

/* Details Accordion */
details {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

summary {
  padding: 14px 24px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  transition: background 0.2s;
}

summary:hover {
  background: var(--bg-subtle);
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "View Aim & Guidelines";
}

details[open] summary::after {
  content: "Hide Details";
}

.details-inner {
  padding: 0 24px 24px 24px;
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.7;
}

.details-inner h4 {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 800;
  margin: 16px 0 8px 0;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

.details-inner p {
  margin: 0;
}

/* =========================================
   6. MODAL STYLES (ADD JOURNAL)
   ========================================= */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: white;
  width: 650px;
  border-radius: 16px;
  box-shadow: var(--shadow-hover);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  /* Prevents modal from being too tall */
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-subtle);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--primary);
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  /* Allows scrolling inside modal */
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.full-width {
  grid-column: span 2;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-main);
  outline: none;
  font-family: inherit;
  transition: border 0.2s;
}

.form-group input:focus,
.form-textarea:focus {
  border-color: var(--accent);
}

.form-textarea {
  resize: vertical;
}

.form-checks {
  display: flex;
  gap: 20px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.modal-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  background: var(--bg-subtle);
}

.btn-save {
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 28px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}

.btn-save:hover {
  background: var(--accent-dark);
}

/* =========================================
   7. MOBILE RESPONSIVE
   ========================================= */
.mobile-controls {
  display: none;
  margin-bottom: 20px;
}

.btn-mobile-filter {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: 12px;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.close-btn-mobile {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 95;
  backdrop-filter: blur(2px);
}

.sidebar-backdrop.open {
  display: block;
}

@media (max-width: 900px) {
  .app-container {
    padding: 16px;
  }

  .content-layout {
    grid-template-columns: 1fr;
  }

  /* Header Mobile */
  .header-inner {
    justify-content: center;
    position: relative;
  }

  .header-left {
    position: absolute;
    left: 16px;
  }

  .header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .header-center h1 {
    font-size: 16px;
  }

  .version-badge {
    font-size: 9px;
    padding: 1px 6px;
  }

  .header-right {
    position: absolute;
    right: 16px;
  }

  /* Hide text, show only icon on mobile for buttons */
  .refresh-btn span,
  .add-btn span {
    display: none;
  }

  .refresh-btn,
  .add-btn {
    padding: 8px;
    width: 36px;
    height: 36px;
  }

  /* Sidebar */
  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100vh;
    z-index: 150;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    border-radius: 0;
    border: none;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .close-btn-mobile {
    display: block;
  }

  .mobile-controls {
    display: block;
  }

  /* Search Bar Stack */
  .search-main {
    flex-direction: column;
  }

  .search-type-wrapper {
    width: 100%;
    border-bottom: 1px solid var(--border);
  }

  .btn-search {
    width: 100%;
    margin-top: 8px;
  }

  .divider-vertical {
    display: none;
  }

  /* Cards Stack */
  .card {
    grid-template-columns: 1fr;
  }

  .card-cover {
    height: 8px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .metrics-strip {
    grid-template-columns: 1fr 1fr;
  }

  .stat-box:nth-child(2) {
    border-right: none;
  }

  .stat-box {
    border-bottom: 1px solid var(--border);
  }

  .stat-box:nth-last-child(-n+2) {
    border-bottom: none;
  }

  .meta-info {
    gap: 16px;
  }

  /* Modal Mobile */
  .modal-box {
    width: 95%;
    max-height: 85vh;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .full-width {
    grid-column: span 1;
  }

  .full-width {
    grid-column: span 1;
  }

  /* Mobile Perfecting - Suggestions Box */
  .suggestions-box {
    width: 100%;
    left: 0;
    border-radius: 0 0 12px 12px;
  }
}
