/* ================================
   Filter Section
   ================================ */
.filter-section {
  padding: 0 0 2rem;
  position: sticky;
  top: 60px;
  z-index: 100;
  background: var(--bg-primary);
  backdrop-filter: blur(20px);
  padding-top: 1rem;
  margin-top: -1rem;
}

.filter-form {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Search Box */
.search-box {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.875rem 2.5rem 0.875rem 2.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.search-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.15);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-clear {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-card-hover);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

.search-clear:hover {
  background: var(--accent-red);
  color: #fff;
}

/* Filter Grid */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  align-items: end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.select-wrapper {
  position: relative;
}

.filter-select {
  width: 100%;
  padding: 0.625rem 2rem 0.625rem 0.875rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  appearance: none;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}

.filter-select:hover {
  border-color: var(--text-muted);
}

.filter-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.15);
}

.select-icon {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* Active Filters */
.active-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.active-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.active-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background: rgba(79, 195, 247, 0.1);
  border: 1px solid rgba(79, 195, 247, 0.3);
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--accent-blue);
}

.active-tag strong {
  font-weight: 600;
}

.tag-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(79, 195, 247, 0.2);
  color: var(--accent-blue);
  text-decoration: none;
  transition: var(--transition);
}

.tag-remove:hover {
  background: var(--accent-red);
  color: #fff;
}

/* ================================
   Results Section
   ================================ */
.results-section {
  padding: 1rem 0 4rem;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.results-count {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.results-count strong {
  color: var(--text-primary);
  font-weight: 700;
}

/* View Toggle */
.view-toggle {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.25rem;
}

.view-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.view-btn:hover {
  color: var(--text-primary);
}

.view-btn.active {
  background: var(--gradient-primary);
  color: #fff;
}

/* ================================
   KSB Grid
   ================================ */
.ksb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.ksb-grid.view-list {
  grid-template-columns: 1fr;
}

.ksb-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  opacity: 0;
  animation: cardFadeIn 0.5s forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ksb-card:hover {
  border-color: var(--card-accent, var(--accent-blue));
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.ksb-grid.view-list .ksb-card {
  flex-direction: row;
  align-items: stretch;
}

/* Status Bar */
.card-status-bar {
  height: 3px;
  width: 100%;
  transition: var(--transition);
}

.ksb-card:hover .card-status-bar {
  height: 4px;
}

.ksb-grid.view-list .card-status-bar {
  width: 4px;
  height: 100%;
}

/* Card Header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.25rem 1.25rem 0.75rem;
  gap: 0.75rem;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.ksb-card:hover .card-icon {
  transform: scale(1.1) rotate(-5deg);
}

.card-badges {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-success {
  background: rgba(129, 199, 132, 0.15);
  color: var(--accent-green);
}

.badge-danger {
  background: rgba(239, 83, 80, 0.15);
  color: var(--accent-red);
}

/* Card Body */
.card-body {
  padding: 0 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-clamp: 2;
}

.card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.meta-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.meta-row svg {
  flex-shrink: 0;
  color: var(--text-muted);
  margin-top: 1px;
}

.meta-location {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-clamp: 1;
}

.card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  margin-top: auto;
}

.stat-mini {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.stat-mini-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.stat-mini-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Card Footer */
.card-footer {
  display: flex;
  gap: 0.375rem;
  padding: 0.75rem 1.25rem 1.25rem;
  border-top: 1px solid var(--border-color);
  margin-top: 1rem;
}

.action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.action-btn:hover {
  transform: translateY(-2px);
}

.action-wa:hover {
  background: #25d366;
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.action-view:hover {
  background: var(--accent-blue);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 195, 247, 0.3);
}

.action-edit:hover {
  background: var(--accent-orange);
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 183, 77, 0.3);
}

.action-delete:hover {
  background: var(--accent-red);
  color: #fff;
  box-shadow: 0 4px 12px rgba(239, 83, 80, 0.3);
}

/* ================================
   List View Specific
   ================================ */
.ksb-grid.view-list .ksb-card {
  padding-right: 0;
}

.ksb-grid.view-list .card-header {
  padding: 1rem;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.ksb-grid.view-list .card-body {
  flex-direction: row;
  align-items: center;
  gap: 2rem;
  padding: 1rem;
  flex-wrap: wrap;
}

.ksb-grid.view-list .card-title {
  min-width: 200px;
  -webkit-line-clamp: 1;
  line-clamp: 1;
}

.ksb-grid.view-list .card-meta {
  flex: 1;
  flex-direction: row;
  gap: 1.5rem;
  min-width: 200px;
}

.ksb-grid.view-list .card-stats {
  margin: 0;
  width: auto;
}

.ksb-grid.view-list .card-footer {
  flex-direction: column;
  border-top: none;
  border-left: 1px solid var(--border-color);
  margin: 0;
  padding: 1rem;
}

/* ================================
   Empty State
   ================================ */
.empty-state {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 4rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.empty-illustration {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.empty-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.empty-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  max-width: 400px;
}

.empty-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ================================
   Pagination
   ================================ */
.pagination-wrapper {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
}

.pagination-wrapper ul {
  list-style: none;
  display: flex;
  gap: 0.375rem;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
  justify-content: center;
}

.pagination-wrapper li a,
.pagination-wrapper li span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
}

.pagination-wrapper li a:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.pagination-wrapper li.active span {
  background: var(--gradient-primary);
  border-color: transparent;
  color: #fff;
  font-weight: 700;
}

.pagination-wrapper li.disabled span {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ================================
   Modal
   ================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.modal-danger {
  background: rgba(239, 83, 80, 0.15);
  color: var(--accent-red);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.modal-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

/* ================================
   Responsive
   ================================ */
@media (max-width: 1024px) {
  .ksb-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

@media (max-width: 768px) {
  .filter-section {
    position: static;
    backdrop-filter: none;
    background: transparent;
  }

  .filter-form {
    padding: 1rem;
  }

  .filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ksb-grid {
    grid-template-columns: 1fr;
  }

  .ksb-grid.view-list .ksb-card {
    flex-direction: column;
  }

  .ksb-grid.view-list .card-body {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.875rem;
  }

  .ksb-grid.view-list .card-meta {
    flex-direction: column;
    gap: 0.5rem;
  }

  .ksb-grid.view-list .card-footer {
    flex-direction: row;
    border-left: none;
    border-top: 1px solid var(--border-color);
  }

  .ksb-grid.view-list .card-stats {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .card-title {
    font-size: 0.95rem;
  }

  .card-icon {
    width: 40px;
    height: 40px;
  }

  .pagination-wrapper li a,
  .pagination-wrapper li span {
    min-width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }
}

.modal-overlay[hidden] {
  display: none !important;
}
