/* GLOBAL RESET & FONTS */
* { box-sizing: border-box; }
.txyf-app {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f3f4f6;
  min-height: 100vh;
  color: #1f2937;
}
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* --- HERO SECTION (Advanced & Appealing) --- */
.hero-section {
  /* Modern Deep Blue-Purple Gradient */
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #8b5cf6 100%);
  color: white;
  padding: 60px 20px 80px; /* Extra padding bottom for overlap effect */
  text-align: center;
  border-radius: 0 0 40px 40px; /* Curved Bottom */
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px -10px rgba(37, 99, 235, 0.4);
}

/* Background Pattern Overlay (Optional for 'Advanced' feel) */
.hero-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: radial-gradient(circle at 20% 150%, rgba(255,255,255,0.1) 0%, transparent 50%);
  pointer-events: none;
}

.hero-section h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.hero-section .subtitle {
  font-size: 16px;
  opacity: 0.9;
  margin-bottom: 30px;
  line-height: 1.6;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  font-weight: 400;
}

/* --- SEARCH BAR (Glassmorphism) --- */
.search-bar {
  max-width: 650px;
  margin: 0 auto 24px;
  display: flex;
  gap: 10px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  padding: 8px;
  border-radius: 60px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 20px;
  font-size: 16px;
  color: white;
}
.search-bar input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}
.search-bar input:focus {
  outline: none;
}

.search-bar button {
  padding: 12px 32px;
  background: #ffffff;
  color: #2563eb;
  border: none;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.search-bar button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  background: #f8fafc;
}

/* --- CATEGORY PILLS (Horizontal Scroll on Mobile) --- */
.category-pills {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap; /* Default for desktop */
}

.pill {
  padding: 8px 20px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.pill:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

/* --- MOBILE RESPONSIVENESS FOR HERO --- */
@media (max-width: 768px) {
  .hero-section {
    padding: 40px 15px 60px;
    border-radius: 0 0 30px 30px;
  }
  .hero-section h1 { font-size: 26px; }
  
  /* Search Bar: NO STACKING */
  .search-bar {
    flex-direction: row; /* Keep in one line */
    border-radius: 12px;
    padding: 6px;
  }
  .search-bar input {
    font-size: 14px;
    padding: 10px;
    width: 0; /* Let flex handle width */
  }
  .search-bar button {
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 8px;
  }
  
  /* Pills: Horizontal Scroll (No Stack) */
  .category-pills {
    flex-wrap: nowrap; /* Don't wrap to next line */
    overflow-x: auto; /* Enable scroll */
    justify-content: flex-start; /* Align start */
    padding-bottom: 10px;
    scrollbar-width: none; /* Hide scrollbar Firefox */
    -ms-overflow-style: none; /* Hide scrollbar IE */
    mask-image: linear-gradient(to right, black 85%, transparent 100%); /* Fade effect */
  }
  .category-pills::-webkit-scrollbar { 
    display: none; 
  }
}

/* --- MOBILE FILTER BUTTON (Fixed Visibility) --- */
.mobile-filter-toggle {
  display: none;
  margin-top: -30px; /* Pull up to overlap hero */
  margin-bottom: 24px;
  position: relative;
  z-index: 10;
}

.mobile-filter-toggle button {
  width: 100%;
  padding: 16px;
  /* Blue Gradient Background */
  background: linear-gradient(90deg, #2563eb, #4f46e5);
  color: white !important; /* Force White Text */
  border: none;
  border-radius: 16px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.4);
  transition: transform 0.2s;
}

.mobile-filter-toggle button:active {
  transform: scale(0.98);
}
.mobile-filter-toggle button::before {
  content: '⚙️'; /* Icon */
  font-size: 18px;
}

/* --- FILTERS SECTION (Desktop) --- */
.filters-section {
  background: white;
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
  border: 1px solid #e5e7eb;
  position: relative;
  top: -30px; /* Overlap hero slightly */
}
.filters-row { display: flex; gap: 20px; align-items: flex-end; }
.filter-group { flex: 1; }
.filter-group label {
  display: block; font-size: 12px; font-weight: 700; 
  color: #6b7280; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px;
}
.filter-group select {
  width: 100%; padding: 12px;
  border: 2px solid #f3f4f6; border-radius: 10px;
  font-size: 14px; font-weight: 500; color: #374151;
  background-color: #fff; cursor: pointer;
  transition: border-color 0.2s;
}
.filter-group select:focus { border-color: #2563eb; outline: none; }
.filter-actions { display: flex; gap: 10px; }
.btn-primary {
  background: #2563eb; color: white; border: none;
  padding: 12px 24px; border-radius: 10px; font-weight: 600;
  cursor: pointer; box-shadow: 0 4px 12px rgba(37,99,235,0.2);
}
.btn-secondary {
  background: #f3f4f6; color: #4b5563; border: none;
  padding: 12px 24px; border-radius: 10px; font-weight: 600; cursor: pointer;
}

/* --- CARDS GRID (FIXED FOR COMPACT & 2-COL MOBILE) --- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* PC: 4 Columns */
  gap: 15px; /* Compact Gap */
  margin-bottom: 40px;
  width: 100%;
}

/* COMPACT CARD DESIGN */
.txyf-card-compact {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px; /* Small padding */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none !important;
  transition: transform 0.2s, box-shadow 0.2s;
  min-height: 120px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  position: relative;
  overflow: hidden;
}

.txyf-card-compact:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.08);
  border-color: #cbd5e1;
}

/* Row 1: Top (Icon/Name + Badge) */
.tc-row-top {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}
.tc-exam-info {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 700; color: #64748b; text-transform: uppercase;
}
.tc-exam-info img { width: 18px; height: 18px; object-fit: contain; border-radius: 4px; }

/* Badges */
.tc-badges { display: flex; gap: 4px; }
.tc-badge { font-size: 9px; font-weight: 800; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; }
.tc-new { background: #dcfce7; color: #15803d; }
.tc-done { background: #e0f2fe; color: #0369a1; display: none; }

/* Attempted Logic */
.txyf-card-compact.is-attempted .tc-done { display: inline-block; }
.txyf-card-compact.is-attempted .tc-new { display: none; }

/* Row 2: Title */
.tc-row-mid { margin-bottom: 12px; flex-grow: 1; }
.tc-title {
  font-size: 13px; font-weight: 700; color: #0f172a; line-height: 1.35; margin: 0; text-align: left;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Row 3: Stats */
.tc-row-bot {
  display: flex; justify-content: space-between; align-items: flex-end;
  border-top: 1px dashed #f1f5f9; padding-top: 8px;
}
.tc-meta-left {
  display: flex; flex-direction: column; gap: 2px;
  font-size: 10px; font-weight: 600; color: #64748b; text-align: left;
}
.tc-meta-right { text-align: right; }
.tc-users {
  font-size: 10px; font-weight: 700; color: #4f46e5;
  background: #eef2ff; padding: 3px 6px; border-radius: 4px;
}

/* --- RESPONSIVE FIXES --- */
@media (max-width: 1024px) {
  .cards-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 600px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr) !important; /* Force 2 Columns on Mobile */
    gap: 10px;
  }
  .txyf-card-compact { padding: 10px; min-height: 110px; }
  .tc-title { font-size: 12px; } /* Slightly smaller text for mobile */
}
/* --- PAGINATION --- */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 40px; }
.pg {
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid #e5e7eb; background: white;
  font-weight: 600; color: #374151; cursor: pointer;
  transition: all 0.2s;
}
.pg.active, .pg:hover {
  background: #2563eb; color: white; border-color: #2563eb;
}

/* --- MOBILE PANEL --- */
.mobile-filter-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 998;
  backdrop-filter: blur(4px);
}
.mobile-filter-overlay.show { display: block; }

.mobile-filter-panel {
  position: fixed; top: 0; right: -100%;
  width: 85%; max-width: 320px; height: 100%;
  background: white; z-index: 999;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 20px; display: flex; flex-direction: column;
  box-shadow: -10px 0 30px rgba(0,0,0,0.1);
}
.mobile-filter-panel.show { right: 0; }

.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.panel-header strong { font-size: 20px; }
.panel-body { flex: 1; }
.panel-body .filter-group { margin-bottom: 24px; }
.panel-actions { display: flex; gap: 12px; margin-top: 20px; }
.panel-actions button { flex: 1; padding: 14px; border-radius: 12px; }

/* Responsive adjustments */
@media (max-width: 768px) {
  .filters-section { display: none; }
  .mobile-filter-toggle { display: block; }
  .cards-grid { grid-template-columns: 1fr; }
}