/* ========================================================
   Public Templates Page Styling - GST Bangka Belitung
   ======================================================== */

.templates-page {
  padding: 40px 100px;
  min-height: calc(100vh - 200px);
  background: #f8fafc;
}

.templates-header {
  text-align: center;
  margin-bottom: 36px;
}

.templates-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--color-primary, #191970);
  margin-bottom: 10px;
  line-height: 1.3;
}

.templates-subtitle {
  font-size: 15px;
  color: #64748b;
  max-width: 650px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Filter & Search Bar */
.filter-wrap {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 32px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.search-box-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 260px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 16px;
  transition: all 0.2s ease;
}

.search-box-wrap:focus-within {
  border-color: var(--color-primary, #191970);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(25, 25, 112, 0.1);
}

.search-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  width: 100%;
  color: #0f172a;
}

.category-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cat-pill {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: #475569;
  background: #f1f5f9;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.cat-pill:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.cat-pill.active {
  background: var(--color-primary, #191970);
  color: #ffffff;
}

/* Templates Grid */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.tpl-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.tpl-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

.tpl-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.badge-cat {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 6px;
}

.badge-cat-magang {
  background: #e0f2fe;
  color: #0284c7;
}

.badge-cat-1plus4 {
  background: #fef3c7;
  color: #b45309;
}

.badge-cat-umum {
  background: #f1f5f9;
  color: #475569;
}

.badge-type {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
}

.tpl-card-title {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
  line-height: 1.4;
}

.tpl-card-desc {
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
  margin-bottom: 20px;
  flex-grow: 1;
}

.tpl-card-meta {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.tpl-card-actions {
  display: flex;
  gap: 10px;
}

.btn-tpl-download {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  background: var(--color-primary, #191970);
  color: #ffffff;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
}

.btn-tpl-download:hover {
  background: #121258;
  color: #ffffff;
}

.btn-tpl-link {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-tpl-link:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid #e2e8f0;
}

.empty-state i {
  font-size: 48px;
  color: #cbd5e1;
  margin-bottom: 16px;
}

/* ========================================================
   Responsive untuk HP / Layar Kecil (Mobile Optimization)
   ======================================================== */

@media (max-width: 768px) {
  .templates-page {
    padding: 24px 16px 60px;
  }

  .templates-header {
    margin-bottom: 24px;
    text-align: left;
  }

  .templates-title {
    font-size: 24px;
    margin-bottom: 8px;
  }

  .templates-subtitle {
    font-size: 13.5px;
    line-height: 1.55;
    margin: 0;
  }

  .filter-wrap {
    padding: 16px;
    border-radius: 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 24px;
  }

  .search-box-wrap {
    min-width: 100%;
    width: 100%;
    padding: 9px 14px;
  }

  .category-pills {
    width: 100%;
    gap: 6px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .cat-pill {
    white-space: nowrap;
    padding: 7px 14px;
    font-size: 12px;
    flex-shrink: 0;
  }

  .templates-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .tpl-card {
    padding: 18px;
    border-radius: 14px;
  }

  .tpl-card-title {
    font-size: 16px;
  }

  .tpl-card-desc {
    font-size: 12.5px;
    margin-bottom: 16px;
  }

  .tpl-card-actions {
    flex-direction: column;
    gap: 8px;
  }

  .btn-tpl-download,
  .btn-tpl-link {
    width: 100%;
    padding: 10px 14px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .templates-page {
    padding: 18px 12px 50px;
  }

  .templates-title {
    font-size: 21px;
  }

  .templates-subtitle {
    font-size: 13px;
  }

  .filter-wrap {
    padding: 12px;
    gap: 10px;
  }

  .tpl-card {
    padding: 16px;
  }
}
