:root {
  --page-card: #ffffff;
  --page-card-border: #e5e7eb;
  --page-text: #161616;
  --page-muted: #6b7280;
  --page-accent: #337ab7;
}

@keyframes slideUp {
  from {
    max-height: 0;
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    max-height: 500px;
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    max-height: 500px;
    opacity: 1;
    transform: translateY(0);
  }
  to {
    max-height: 0;
    opacity: 0;
    transform: translateY(20px);
  }
}

.page-shell {
  color: var(--page-text);
  padding: 28px 16px 64px;
}

.page-hero {
  position: relative;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: url('/frontend/assets/image/pic_2.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  margin: 0 auto 26px;
  width: 90%;
  border-radius: 18px;
}

.page-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(169deg, rgb(4 5 22 / 46%) 0%, rgb(4 5 22 / 63%) 100%);
  z-index: 1;
  border-radius: 18px;
}

.page-hero__inner {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 2;
  text-align: center;
  padding: 32px 22px;
  max-width: 1180px;
  margin: 0 auto;
}

.page-breadcrumb {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
  font-size: 14px;
}

.page-breadcrumb__link {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  transition: color 0.2s ease;
}

.page-breadcrumb__link:hover {
  color: rgba(255, 255, 255, 0.95);
}

.page-breadcrumb__sep {
  color: rgba(255, 255, 255, 0.4);
}

.page-breadcrumb__current {
  color: rgba(255, 255, 255, 0.95);
  font-weight: 500;
}

.page-hero__title {
  margin: 0;
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.1;
  font-weight: 700;
  color: #ffffff;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--page-card-border);
  color: var(--page-text);
  background: #ffffff;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
  text-decoration: none;
  font-family: "Montserrat", Helvetica, sans-serif;
  font-weight: 500;
  font-size: 15px;
}

.page-btn:hover {
  transform: translateY(-2px);
  background: #f3f4f6;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.page-btn--primary {
  background: #337ab7;
  border-color: #337ab7;
  color: #ffffff;
}

.page-btn--primary:hover {
  background: #2563a8;
  border-color: #2563a8;
}

.page-btn--ghost {
  background: transparent;
  border-color: var(--page-card-border);
  color: var(--page-text);
}

.page-btn--ghost:hover {
  background: #f3f4f6;
}

.page-btn--sm {
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14px;
}

.page-section {
  width: 90%;
  margin: 0 auto;
  padding-top: 18px;
}

.page-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  align-items: start;
}

/* Filter Sidebar */
.filter-sidebar {
  position: sticky;
  top: 24px;
  background: var(--page-card);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.filter-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--page-card-border);
}

.filter-sidebar__toggle-mobile {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--page-muted);
  transition: color 0.2s ease, transform 0.3s ease;
}

.filter-sidebar__toggle-mobile:hover {
  color: var(--page-text);
}

.filter-sidebar__toggle-mobile[aria-expanded="false"] svg {
  transform: rotate(180deg);
}

.filter-sidebar__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--page-text);
  font-family: "Montserrat", Helvetica, sans-serif;
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-sidebar__icon {
  color: var(--page-muted);
}

/* Scope Selector Dropdown */
.filter-scope {
  position: relative;
  width: 100%;
}

.filter-scope__select {
  width: 100%;
  padding: 14px 40px 14px 16px;
  border: 1px solid var(--page-card-border);
  border-radius: 10px;
  background: #f9fafb;
  color: var(--page-text);
  font-size: 15px;
  font-weight: 500;
  font-family: "Montserrat", Helvetica, sans-serif;
  cursor: pointer;
  appearance: none;
  transition: all 0.2s ease;
}

.filter-scope__select:hover {
  border-color: var(--page-accent);
  background: #ffffff;
}

.filter-scope__select:focus {
  outline: none;
  border-color: var(--page-accent);
  box-shadow: 0 0 0 3px rgba(51, 122, 183, 0.1);
  background: #ffffff;
}

.filter-scope__arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--page-muted);
}

.filter-sidebar__reset {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: 1px solid var(--page-card-border);
  color: var(--page-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  transition: all 0.2s ease;
  font-family: "Montserrat", Helvetica, sans-serif;
  font-weight: 500;
}

.filter-sidebar__reset.visible {
  display: flex;
}

.filter-sidebar__reset:hover {
  background: #f3f4f6;
  border-color: var(--page-text);
  color: var(--page-text);
}

/* Filter Groups */
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-group__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  padding: 8px 0;
  cursor: pointer;
  color: var(--page-text);
  font-size: 15px;
  font-weight: 500;
  transition: color 0.2s ease;
  font-family: "Montserrat", Helvetica, sans-serif;
}

.filter-group__toggle:hover {
  color: var(--page-accent);
}

.filter-group__label {
  text-align: left;
}

.filter-group__icon {
  transition: transform 0.2s ease;
  color: var(--page-muted);
}

.filter-group__toggle[aria-expanded="false"] .filter-group__icon {
  transform: rotate(-90deg);
}

.filter-group__content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 4px;
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
  opacity: 1;
}

.filter-group__content[data-collapsed="true"] {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* Filter Options */
.filter-option {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background 0.2s ease;
  position: relative;
}

.filter-option:hover {
  background: #f3f4f6;
}

.filter-option--checkbox {
  gap: 12px;
}

/* Hide native checkbox */
.filter-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Custom checkbox */
.filter-checkbox__custom {
  width: 18px;
  height: 18px;
  border: 2px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
  background: #ffffff;
}

.filter-checkbox:checked + .filter-checkbox__custom {
  border-color: var(--page-accent);
  background: var(--page-accent);
}

.filter-checkbox:checked + .filter-checkbox__custom::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -60%) rotate(45deg);
}

.filter-checkbox:focus + .filter-checkbox__custom {
  box-shadow: 0 0 0 3px rgba(51, 122, 183, 0.1);
}

.filter-option__label {
  font-size: 14px;
  color: var(--page-muted);
  line-height: 1.4;
  transition: color 0.2s ease;
  font-family: "Montserrat", Helvetica, sans-serif;
  flex: 1;
}

.filter-option:hover .filter-option__label,
.filter-checkbox:checked ~ .filter-option__label {
  color: var(--page-text);
}

/* Templates Content */
.templates-content {
  min-width: 0;
}

/* Search Section */
.search-section {
  margin-bottom: 24px;
}

.search-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--page-card);
  border: 1px solid var(--page-card-border);
  border-radius: 12px;
  padding: 12px 16px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.search-container:focus-within {
  border-color: var(--page-accent);
  box-shadow: 0 0 0 3px rgba(51, 122, 183, 0.1);
}

.search-icon {
  color: var(--page-muted);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--page-text);
  font-size: 15px;
  font-family: "Montserrat", Helvetica, sans-serif;
  padding: 0;
}

.search-input::placeholder {
  color: var(--page-muted);
}

.search-input::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--page-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.search-clear:hover {
  background: #f3f4f6;
  color: var(--page-text);
}

.search-clear.visible {
  display: flex;
}

.search-results {
  margin-top: 12px;
  font-size: 14px;
  color: var(--page-muted);
  font-family: "Montserrat", Helvetica, sans-serif;
}

.page-empty {
  padding: 32px;
  text-align: center;
  border: 1px solid var(--page-card-border);
  background: var(--page-card);
  border-radius: 16px;
}

.page-empty__title {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--page-text);
}

.page-empty__desc {
  margin: 0;
  color: var(--page-muted);
}

.page-section__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.page-section__title {
  margin: 0;
  font-size: 22px;
  font-family: "Montserrat", Helvetica, sans-serif;
  font-weight: 700;
  color: var(--page-text);
}

.page-section__desc {
  margin: 0;
  color: var(--page-muted);
  max-width: 80ch;
  line-height: 1.5;
  font-family: "Montserrat", Helvetica, sans-serif;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.template-card[data-filtered="true"] {
  display: none;
}

.page-note {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--page-card-border);
  background: rgba(0, 0, 0, 0.2);
  color: var(--page-muted);
}


    .template-card {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0;
      padding: 0;
      position: relative;
      background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(255, 255, 255, 0.7) 100%
      );
      border: 1px solid #e5e7eb;
      border-radius: 12px;
      backdrop-filter: blur(15px);
      -webkit-backdrop-filter: blur(15px);
      box-shadow: 0px 8px 32px 0px rgba(31, 38, 135, 0.08);
      overflow: hidden;
      transition: all 0.3s ease;
    }

    .template-card:hover {
      transform: translateY(-8px);
      box-shadow: 0px 16px 48px 0px rgba(31, 38, 135, 0.15);
      background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(255, 255, 255, 0.8) 100%
      );
    }

    .template-image {
      position: relative;
      height: 200px;
      overflow: hidden;
      margin: 20px;
      border-radius: 8px;
    }

    .template-image img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      transition: transform 0.3s ease;
    }

    .template-card:hover .template-image img {
      transform: scale(1.05);
    }

    .template-content {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 12px;
      padding: 20px;
      position: relative;
      align-self: stretch;
      width: 100%;
    }

    .template-info {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 6px;
      position: relative;
      align-self: stretch;
      width: 100%;
    }

    .template-title {
      position: relative;
      width: fit-content;
      margin: 0;
      font-family: 'Work Sans', Helvetica, sans-serif;
      font-weight: 700;
      color: #000000;
      font-size: 18px;
      letter-spacing: 0;
      line-height: normal;
    }

    .template-description {
      margin: 0;
      font-family: 'Work Sans', Helvetica, sans-serif;
      font-weight: 400;
      color: #4b5563;
      font-size: 14px;
      letter-spacing: 0;
      line-height: 1.5;
    }

    .template-footer {
      display: flex;
      justify-content: space-around;
      padding: 16px 20px;
      position: relative;
      align-self: stretch;
      width: 100%;
      gap: 8px;
      flex-direction: row;
      align-items: center;
    }

    .template-button--ghost {
       background: rgba(51, 122, 183, 0.08) !important;
       transition: all 0.3s ease !important;
       color: #337ab7 !important;
    }

     .template-button--ghost:hover {
      background: rgba(51, 122, 183, 0.15) !important;
      transform: translateY(-2px) !important;
    }

    .template-button {
      flex: 1;
      padding: 13px 16px;
      background: linear-gradient(135deg, #337ab7 0%, #1e62c8 100%);
      color: white;
      border: none;
      border-radius: 46px;
      cursor: pointer;
      transition: all 0.3s ease;
      font-family: 'Work Sans', Helvetica, sans-serif;
      font-weight: 400;
      font-size: 13px;
      text-align: center;
    }

    .template-button:hover {
      transform: translateY(-2px);
    }

@media (min-width: 720px) {
  .page-shell {
    padding: 36px 24px 72px;
  }

  .page-hero {
    min-height: 480px;
  }

  .page-hero__inner {
    padding: 48px 32px;
  }
}

@media (min-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

@media (max-width: 1024px) {
  .page-hero {
    width: 100%;
  }

  .page-hero__title {
    font-size: 56px;
  }

  .page-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .filter-sidebar {
    position: static;
    order: -1;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .page-hero {
    min-height: 370px;
  }

  .page-shell {
    padding: 28px 16px 48px;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .template-card {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
  }

  .filter-sidebar__toggle-mobile {
    display: block;
  }

  .filter-sidebar .filter-scope,
  .filter-sidebar .filter-group,
  .filter-sidebar .filter-sidebar__reset {
    animation: slideUp 0.3s ease forwards;
  }

  .filter-sidebar.collapsed .filter-scope,
  .filter-sidebar.collapsed .filter-group,
  .filter-sidebar.collapsed .filter-sidebar__reset {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    animation: slideDown 0.3s ease forwards;
    pointer-events: none;
  }
}

@media (max-width: 480px) {
  .page-hero {
    min-height: 270px;
  }

  .filter-sidebar {
    padding: 16px;
  }

  .template-button {
    width: 100%;
  }
}

