/**
 * Collection Page Styles
 * Styles specific to koleksi.html - story collection and filtering
 */

/* ============================================================================
   Decorative Background
   ============================================================================ */

.page-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.page-bg::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(139, 115, 85, 0.08) 0%, transparent 70%);
  border-radius: 50%;
}

.page-bg::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(192, 133, 82, 0.06) 0%, transparent 70%);
  border-radius: 50%;
}

/* ============================================================================
   Page Header
   ============================================================================ */

.page-header {
  background: linear-gradient(135deg, #fffbf4 0%, #f9f2e6 55%, #f6eede 100%);
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%238b7355' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
}

.page-header h1 {
  background: linear-gradient(135deg, #8b7355 0%, #6d5844 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================================================
   Sidebar & Filters
   ============================================================================ */

/* Scrollable sidebar */
.sidebar-container {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #d97706 #fef3c7;
}

.sidebar-container::-webkit-scrollbar {
  width: 6px;
}

.sidebar-container::-webkit-scrollbar-track {
  background: #fef3c7;
  border-radius: 3px;
}

.sidebar-container::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #8b7355 0%, #6d5844 100%);
  border-radius: 3px;
}

.sidebar-container::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #6d5844 0%, #5a4a38 100%);
}

/* Glassmorphism filter cards */
.filter-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(139, 115, 85, 0.12);
  box-shadow: 0 4px 20px rgba(139, 115, 85, 0.06);
  transition: all 0.3s ease;
}

.filter-card:hover {
  box-shadow: 0 8px 30px rgba(139, 115, 85, 0.1);
  border-color: rgba(139, 115, 85, 0.2);
}

.filter-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: #8b7355;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}

.filter-card-header span:first-child {
  font-size: 1.1rem;
}

/* ============================================================================
   Category Buttons
   ============================================================================ */

.category-btn {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.category-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(139, 115, 85, 0.1), transparent);
  transition: left 0.5s ease;
}

.category-btn:hover::before {
  left: 100%;
}

.category-btn.active {
  background: linear-gradient(135deg, #f5ede0 0%, #ebe3d5 100%);
  border-color: #8b7355;
  box-shadow: 0 2px 8px rgba(139, 115, 85, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transform: translateX(4px);
}

.category-btn:hover:not(.active) {
  background: linear-gradient(135deg, #faf8f3 0%, #f5ede0 100%);
  border-color: #c08552;
  transform: translateX(2px);
}

.category-btn .category-count {
  background: rgba(139, 115, 85, 0.1);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
}

.category-btn.active .category-count {
  background: rgba(139, 115, 85, 0.15);
}

/* ============================================================================
   Checkbox Filters
   ============================================================================ */

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.filter-checkbox:hover {
  background: linear-gradient(135deg, #faf8f3 0%, #f5ede0 100%);
  border-color: rgba(139, 115, 85, 0.2);
}

.filter-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #8b7355;
  cursor: pointer;
}

.filter-checkbox input[type="checkbox"]:checked + span {
  color: #6d5844;
  font-weight: 500;
}

/* Difficulty indicators */
.difficulty-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.difficulty-dot.beginner { background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%); }
.difficulty-dot.intermediate { background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%); }
.difficulty-dot.advanced { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }

/* ============================================================================
   Results & Active Filters
   ============================================================================ */

.results-count {
  background: linear-gradient(135deg, #f5ede0 0%, #ebe3d5 100%);
  position: relative;
  overflow: hidden;
}

.results-count::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, rgba(139, 115, 85, 0.15) 0%, transparent 70%);
}

.results-count-number {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #8b7355 0%, #6d5844 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================================================
   Mobile Filter Panel
   ============================================================================ */

.filter-panel {
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  overflow: hidden;
}

.filter-panel.collapsed {
  max-height: 0;
  opacity: 0;
}

.filter-panel.expanded {
  max-height: 2000px;
  opacity: 1;
}

@media (min-width: 1024px) {
  .filter-panel {
    max-height: none !important;
    opacity: 1 !important;
  }
}

/* Mobile filter toggle */
.filter-toggle-btn {
  background: linear-gradient(135deg, #ffffff 0%, #faf8f3 100%);
  border: 1px solid rgba(139, 115, 85, 0.2);
  box-shadow: 0 4px 15px rgba(139, 115, 85, 0.08);
  transition: all 0.3s ease;
}

.filter-toggle-btn:hover {
  box-shadow: 0 6px 20px rgba(139, 115, 85, 0.12);
  border-color: #c08552;
}

.filter-toggle-btn:active {
  transform: scale(0.98);
}

.filter-badge {
  background: linear-gradient(135deg, #8b7355 0%, #6d5844 100%);
  box-shadow: 0 2px 8px rgba(139, 115, 85, 0.25);
}

/* ============================================================================
   Sort Select
   ============================================================================ */

.sort-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%238b7355'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
  transition: all 0.2s ease;
}

.sort-select:hover {
  border-color: #c08552;
  box-shadow: 0 2px 8px rgba(139, 115, 85, 0.1);
}

.sort-select:focus {
  border-color: #8b7355;
  box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.12);
}

/* ============================================================================
   Grid Header
   ============================================================================ */

.grid-header {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(139, 115, 85, 0.12);
  border-radius: 1rem;
  padding: 1rem 1.25rem;
}

/* ============================================================================
   Keyboard Shortcut Hints
   ============================================================================ */

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 3px 8px;
  font-size: 0.65rem;
  font-family: 'SF Mono', Monaco, monospace;
  font-weight: 500;
  background: linear-gradient(180deg, #f5ede0 0%, #ebe3d5 100%);
  border: 1px solid rgba(139, 115, 85, 0.3);
  border-radius: 6px;
  color: #6d5844;
  box-shadow: 0 2px 0 rgba(139, 115, 85, 0.2), 0 3px 3px rgba(0,0,0,0.05);
}

/* ============================================================================
   Reset Button
   ============================================================================ */

.reset-btn {
  background: linear-gradient(135deg, #8b7355 0%, #6d5844 100%);
  border: none;
  box-shadow: 0 4px 15px rgba(139, 115, 85, 0.2);
  transition: all 0.3s ease;
  color: white;
}

.reset-btn:hover {
  background: linear-gradient(135deg, #6d5844 0%, #5a4a38 100%);
  box-shadow: 0 6px 20px rgba(139, 115, 85, 0.25);
  transform: translateY(-1px);
}

.reset-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(139, 115, 85, 0.2);
}

/* ============================================================================
   Search Input
   ============================================================================ */

.search-input {
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(139, 115, 85, 0.1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
  transition: all 0.3s ease;
}

.search-input:hover {
  border-color: rgba(139, 115, 85, 0.2);
}

.search-input:focus {
  background: #ffffff;
  border-color: #8b7355;
  box-shadow: 0 0 0 4px rgba(139, 115, 85, 0.1), inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.search-input::placeholder {
  color: #8b7355;
  opacity: 0.5;
}

/* ============================================================================
   Empty State
   ============================================================================ */

.empty-state {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border: 2px dashed rgba(139, 115, 85, 0.25);
  border-radius: 1.5rem;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #f5ede0 0%, #ebe3d5 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 1rem;
  box-shadow: 0 4px 15px rgba(139, 115, 85, 0.1);
}

/* ============================================================================
   Story Cards Grid
   ============================================================================ */

.stories-grid .card-hover {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(139, 115, 85, 0.1);
}

.stories-grid .card-hover:hover {
  transform: translateY(-8px);
  box-shadow: 0 25px 50px rgba(139, 115, 85, 0.12);
  border-color: rgba(139, 115, 85, 0.15);
}

/* Larger story cards */
.stories-grid .card-hover .thumbnail-placeholder {
  height: 220px;
}

.stories-grid .card-hover .p-6 {
  padding: 1.5rem;
}

@media (min-width: 768px) {
  .stories-grid .card-hover .thumbnail-placeholder {
    height: 240px;
  }
}

/* ============================================================================
   Animations
   ============================================================================ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.5s ease forwards;
}

.stories-grid > * {
  animation: fadeInUp 0.4s ease forwards;
}

.stories-grid > *:nth-child(1) { animation-delay: 0.05s; }
.stories-grid > *:nth-child(2) { animation-delay: 0.1s; }
.stories-grid > *:nth-child(3) { animation-delay: 0.15s; }
.stories-grid > *:nth-child(4) { animation-delay: 0.2s; }
.stories-grid > *:nth-child(5) { animation-delay: 0.25s; }
.stories-grid > *:nth-child(6) { animation-delay: 0.3s; }

/* Subtle hover glow */
.glow-hover {
  transition: all 0.3s ease;
}

.glow-hover:hover {
  box-shadow: 0 0 20px rgba(139, 115, 85, 0.15);
}
