/* ==========================================================================
   HANDBOOK (CẨM NANG & KINH NGHIỆM CƯỚI) - STYLES
   Tương đồng 100% với Android HandbookScreen.kt & HandbookDetailScreen.kt
   ========================================================================== */

/* Handbook Header & Search */
.handbook-header-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.handbook-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.handbook-title-row h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.handbook-search-box {
  position: relative;
  margin-bottom: 1rem;
}

.handbook-search-input {
  width: 100%;
  height: 48px;
  padding: 0.75rem 2.8rem 0.75rem 2.8rem;
  background: var(--bg-surface-alt);
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  color: var(--text-main);
  transition: all 0.2s ease;
  outline: none;
}

.handbook-search-input:focus {
  background: #FFFFFF;
  border-color: var(--rose-gold);
  box-shadow: 0 0 0 3px var(--rose-gold-glow);
}

.handbook-search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--rose-gold);
  pointer-events: none;
  font-size: 1.1rem;
}

.handbook-clear-search {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 50%;
  font-size: 1.1rem;
  line-height: 1;
  display: none;
}

.handbook-clear-search:hover {
  color: var(--text-heading);
  background: rgba(0, 0, 0, 0.05);
}

/* Category Filter Chips (Tương đương CategoryFilterRow trên Android) */
.handbook-categories-scroll {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scrollbar-width: thin;
}

.handbook-categories-scroll::-webkit-scrollbar {
  height: 4px;
}
.handbook-categories-scroll::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

.handbook-chip {
  padding: 0.5rem 1.15rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 20px;
  white-space: nowrap;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.handbook-chip:hover {
  background: var(--bg-surface-alt);
  border-color: var(--rose-gold);
  color: var(--rose-gold-dark);
}

.handbook-chip.active {
  background: var(--rose-gold);
  border-color: var(--rose-gold);
  color: #FFFFFF;
  box-shadow: 0 4px 10px var(--rose-gold-glow);
}

/* Featured Article Hero Banner */
.handbook-featured-hero {
  position: relative;
  height: 220px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.handbook-featured-hero:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.handbook-featured-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.handbook-featured-hero:hover img {
  transform: scale(1.03);
}

.handbook-featured-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.4) 40%, rgba(0,0,0,0.85) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
}

.handbook-featured-badge {
  align-self: flex-start;
  padding: 0.35rem 0.75rem;
  background: linear-gradient(135deg, var(--primary-gold) 0%, #B8972E 100%);
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.handbook-featured-title {
  color: #FFFFFF;
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 0.4rem;
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.handbook-featured-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.85);
}

/* Handbook Articles Grid */
.handbook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.handbook-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.handbook-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--rose-gold);
}

.handbook-card-cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-surface-alt);
  overflow: hidden;
}

.handbook-card-cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.handbook-card:hover .handbook-card-cover-wrap img {
  transform: scale(1.05);
}

.handbook-card-category {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 0.3rem 0.7rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  color: var(--rose-gold-dark);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
}

.handbook-card-btn-detail {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 0.3rem 0.7rem;
  background: var(--rose-gold);
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.handbook-card-body {
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.handbook-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.4;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.handbook-card-summary {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.handbook-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.handbook-author-date {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.handbook-readtime {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
  color: var(--rose-gold-dark);
}

/* Empty State */
.handbook-empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-light);
}

.handbook-empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

/* ==========================================================================
   ARTICLE DETAIL MODAL / DRAWER (Tương đồng HandbookDetailScreen.kt)
   ========================================================================== */
.handbook-detail-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.handbook-detail-modal.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.handbook-detail-dialog {
  background: var(--bg-surface);
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  border-radius: var(--radius-xl, 20px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.handbook-detail-modal.active .handbook-detail-dialog {
  transform: translateY(0) scale(1);
}

/* Sticky Modal Header */
.handbook-detail-header {
  padding: 1rem 1.25rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.handbook-detail-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.handbook-btn-back {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-heading);
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.handbook-btn-back:hover {
  background: var(--rose-gold-light);
  color: var(--rose-gold-dark);
}

.handbook-detail-category-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  background: var(--rose-gold-light);
  color: var(--rose-gold-dark);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
}

.handbook-detail-content-scroll {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 2rem;
}

.handbook-detail-cover {
  width: 100%;
  height: 280px;
  object-fit: cover;
  background: var(--bg-surface-alt);
}

.handbook-detail-body {
  padding: 1.75rem 2rem;
}

.handbook-detail-title {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-heading);
  line-height: 1.35;
  margin-bottom: 0.75rem;
}

.handbook-detail-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.handbook-detail-text {
  font-size: 0.98rem;
  line-height: 1.85;
  color: var(--text-main);
  white-space: pre-line;
}

.handbook-detail-text strong,
.handbook-detail-text b {
  color: var(--text-heading);
  font-weight: 700;
}

/* Related articles section inside detail */
.handbook-related-section {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

.handbook-related-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 1rem;
}

.handbook-related-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.handbook-related-item {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-alt);
  cursor: pointer;
  transition: all 0.2s ease;
}

.handbook-related-item:hover {
  background: #FFFFFF;
  border-color: var(--rose-gold);
  transform: translateX(4px);
}

.handbook-related-img {
  width: 72px;
  height: 52px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.handbook-related-meta {
  flex: 1;
}

.handbook-related-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-heading);
  line-height: 1.35;
  margin-bottom: 0.2rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.handbook-related-item-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Dashboard Featured Card Widget (Tương đồng FeaturedArticleDashboardCard) */
.dash-handbook-banner {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  position: relative;
  cursor: pointer;
  height: 140px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dash-handbook-banner:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.dash-handbook-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dash-handbook-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.45) 50%, rgba(0, 0, 0, 0.2) 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.25rem 1.75rem;
}

.dash-handbook-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  background: var(--rose-gold);
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 6px;
  align-self: flex-start;
  margin-bottom: 0.45rem;
}

.dash-handbook-title {
  color: #FFFFFF;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.35;
  max-width: 80%;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.dash-handbook-sub {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

@media (max-width: 768px) {
  .handbook-grid {
    grid-template-columns: 1fr;
  }
  .handbook-detail-body {
    padding: 1.25rem 1rem;
  }
  .handbook-detail-cover {
    height: 200px;
  }
  .handbook-detail-title {
    font-size: 1.25rem;
  }
}
