/*
 * pc-components.css
 * Shared component styles: buttons, badges, tags, filters, search, toast,
 * empty state, section card, grid, library items, source tags, perf badges,
 * property sections, utility classes, animations, hover transitions, skeleton.
 */

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  outline: none;
  white-space: nowrap;
  line-height: 1;
}

.btn:active {
  transform: scale(0.97);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-lg {
  padding: 12px 28px;
  font-size: 15px;
  border-radius: 12px;
}

.btn-primary {
  background: linear-gradient(135deg, #6C5CE7, #A29BFE);
  color: #FFFFFF;
  box-shadow: 0 2px 10px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(108, 92, 231, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 2px 8px rgba(108, 92, 231, 0.2);
}

.btn-outline {
  background: transparent;
  color: #6C5CE7;
  border: 1.5px solid #6C5CE7;
}

.btn-outline:hover {
  background: #F0EEFF;
}

.btn-ghost {
  background: transparent;
  color: #636E72;
}

.btn-ghost:hover {
  background: #F1F5F9;
  color: #2D3436;
}

.btn-danger {
  background: rgba(214, 48, 49, 0.08);
  color: #D63031;
}

.btn-danger:hover {
  background: rgba(214, 48, 49, 0.15);
}

.btn-success {
  background: rgba(0, 184, 148, 0.1);
  color: #00B894;
}

.btn-success:hover {
  background: rgba(0, 184, 148, 0.18);
}

/* Icon-only Button */
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

.badge-primary {
  background: rgba(108, 92, 231, 0.1);
  color: #6C5CE7;
}

.badge-success {
  background: rgba(0, 184, 148, 0.1);
  color: #00B894;
}

.badge-warning {
  background: rgba(253, 203, 110, 0.2);
  color: #E17055;
}

.badge-danger {
  background: rgba(214, 48, 49, 0.08);
  color: #D63031;
}

.badge-info {
  background: rgba(9, 132, 227, 0.08);
  color: #0984E3;
}

/* ===== Tags ===== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  background: #F1F5F9;
  color: #636E72;
}

/* ===== Filter Chips ===== */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  background: #F1F5F9;
  color: #636E72;
  cursor: pointer;
  transition: all 0.2s;
  border: 1.5px solid transparent;
  white-space: nowrap;
}

.filter-chip:hover {
  background: #E8E0FF;
  color: #6C5CE7;
}

.filter-chip.selected {
  background: #F0EEFF;
  color: #6C5CE7;
  border-color: #6C5CE7;
  font-weight: 600;
}

.filter-chip .chip-count {
  font-size: 11px;
  opacity: 0.6;
}

/* ===== Filter Tabs ===== */
.filter-tab {
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  background: #F1F5F9;
  color: #64748B;
  cursor: pointer;
  transition: all 0.2s;
  border: 1.5px solid transparent;
}
.filter-tab:hover { background: #E2E8F0; }
.filter-tab.active {
  background: #F0EEFF;
  color: #6C5CE7;
  font-weight: 600;
  border: 1.5px solid #6C5CE7;
}

/* ===== Filter Buttons ===== */
.filter-btn {
  padding: 5px 16px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  background: #FFFFFF;
  color: #64748B;
  cursor: pointer;
  transition: all 0.2s;
  border: 1.5px solid #E2E8F0;
  white-space: nowrap;
}
.filter-btn:hover {
  border-color: #C4B5FD;
  color: #6C5CE7;
  background: #FAFAFE;
}
.filter-btn.active {
  background: #6C5CE7;
  color: #FFFFFF;
  border-color: #6C5CE7;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(108, 92, 231, 0.25);
}

/* ===== Tag Buttons ===== */
.pc-tag-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.tag-btn {
  padding: 5px 14px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  background: #FFFFFF;
  color: #64748B;
  cursor: pointer;
  transition: all 0.2s;
  border: 1.5px solid #E2E8F0;
  white-space: nowrap;
}
.tag-btn:hover {
  border-color: #C4B5FD;
  color: #6C5CE7;
  background: #FAFAFE;
}
.tag-btn.active {
  background: #6C5CE7;
  color: #FFFFFF;
  border-color: #6C5CE7;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(108, 92, 231, 0.25);
}
.tag-toggle-btn {
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  color: #6C5CE7;
  background: none;
  border: 1.5px dashed #C4B5FD;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.tag-toggle-btn:hover {
  background: #F0EEFF;
  border-color: #6C5CE7;
}

/* ===== Search Box ===== */
.search-box {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.search-box input {
  height: 38px;
  border: 1.5px solid #E2E8F0;
  border-radius: 10px;
  padding: 0 12px 0 36px;
  font-size: 13px;
  color: #2D3436;
  background: #FFFFFF;
  outline: none;
  transition: all 0.2s;
  width: 240px;
}

.search-box input:focus {
  border-color: #6C5CE7;
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.search-box input::placeholder {
  color: #B2BEC3;
}

.search-box .search-icon {
  position: absolute;
  left: 10px;
  font-size: 14px;
  color: #B2BEC3;
  pointer-events: none;
}

.search-box .search-clear {
  position: absolute;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #636E72;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  opacity: 0;
  pointer-events: none;
}

.search-box input:not(:placeholder-shown) ~ .search-clear {
  opacity: 1;
  pointer-events: auto;
}

.search-box .search-clear:hover {
  background: #CBD5E1;
}

/* ===== PC Toast ===== */
.toast-pc {
  position: fixed;
  top: 72px;
  right: 24px;
  background: #2D3436;
  color: #FFFFFF;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  z-index: 200;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s ease;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 400px;
}

.toast-pc.show {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.toast-pc .toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.toast-pc.toast-success {
  background: #00B894;
}

.toast-pc.toast-error {
  background: #D63031;
}

.toast-pc.toast-warning {
  background: #E17055;
}

/* ===== Empty State ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}

.empty-state .empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-state .empty-title {
  font-size: 16px;
  font-weight: 600;
  color: #2D3436;
  margin-bottom: 8px;
}

.empty-state .empty-desc {
  font-size: 13px;
  color: #B2BEC3;
  max-width: 320px;
}

/* ===== Section Card ===== */
.section-card {
  background: #FFFFFF;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  margin-bottom: 16px;
}

.section-card .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-card .section-title {
  font-size: 16px;
  font-weight: 700;
  color: #2D3436;
}

.section-card .section-action {
  font-size: 13px;
  color: #6C5CE7;
  cursor: pointer;
  font-weight: 500;
  transition: color 0.2s;
}

.section-card .section-action:hover {
  color: #A29BFE;
}

/* ===== Two Column Grid ===== */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ===== Library Items ===== */
.library-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.library-item {
  background: #FFFFFF;
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border: 1.5px solid transparent;
}

.library-item:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
  border-color: #E8E0FF;
}

.library-item.selected {
  border-color: #6C5CE7;
  background: #F8F7FF;
}

.library-item .item-content {
  flex: 1;
  min-width: 0;
}

.library-item .item-title {
  font-size: 14px;
  font-weight: 600;
  color: #2D3436;
  line-height: 1.5;
}

.library-item .item-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.library-item .item-desc {
  font-size: 13px;
  color: #636E72;
  margin-top: 6px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.library-item .item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  align-self: center;
}

/* ===== Source Tags ===== */
.source-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.source-tag.source-ai {
  background: rgba(108, 92, 231, 0.1);
  color: #6C5CE7;
}

.source-tag.source-competitor {
  background: rgba(253, 203, 110, 0.25);
  color: #E17055;
}

.source-tag.source-search {
  background: rgba(9, 132, 227, 0.1);
  color: #0984E3;
}

.source-tag.source-manual {
  background: rgba(0, 184, 148, 0.1);
  color: #00B894;
}

/* ===== Perf Badges ===== */
.perf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 500;
  background: #F8F9FD;
  color: #64748B;
}

.perf-badge.unused {
  background: #F1F5F9;
  color: #94A3B8;
}

.perf-badge.good {
  background: rgba(0, 184, 148, 0.08);
  color: #00B894;
}

.perf-badge.hot {
  background: rgba(253, 121, 168, 0.08);
  color: #FD79A8;
}

/* ===== Property Sections ===== */
.prop-section {
  display: none;
}
.prop-section.active {
  display: block;
  animation: pcFadeInUp 0.2s ease;
}

/* ===== Animations ===== */
@keyframes pcFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pcShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pcFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

@keyframes pcPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.97); }
}

@keyframes pcSlideInRight {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pcScaleIn {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ===== Hover Transitions ===== */
.timeline-segment {
  transition: all 0.2s ease;
}

.library-item {
  transition: all 0.2s ease;
}

.material-card {
  transition: all 0.2s ease;
}

.stat-card {
  transition: all 0.2s ease;
}

.topic-list-item {
  transition: all 0.2s ease;
}

/* ===== Loading Skeleton ===== */
.skeleton-pc {
  background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 37%, #F1F5F9 63%);
  background-size: 200% 100%;
  animation: pcShimmer 1.4s ease infinite;
  border-radius: 8px;
}

.skeleton-pc.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-pc.skeleton-title {
  height: 20px;
  width: 60%;
  margin-bottom: 12px;
}

.skeleton-pc.skeleton-card {
  height: 120px;
  border-radius: 14px;
}

/* ===== Page Transition ===== */
.pc-page {
  animation: pcPageFadeIn 0.25s ease;
}

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

/* ===== Utility Classes ===== */
.text-primary { color: #6C5CE7; }
.text-secondary { color: #636E72; }
.text-muted { color: #B2BEC3; }
.text-success { color: #00B894; }
.text-warning { color: #FDCB6E; }
.text-danger { color: #D63031; }
.text-pink { color: #FD79A8; }

.bg-primary { background: #6C5CE7; }
.bg-success { background: #00B894; }
.bg-warning { background: #FDCB6E; }
.bg-danger { background: #D63031; }

.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.d-flex { display: flex; }
.ai-center { align-items: center; }
.jc-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.flex-1 { flex: 1; min-width: 0; }

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.cursor-pointer { cursor: pointer; }
.no-select { user-select: none; }
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Modal ===== */
.pc-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  animation: pcFadeIn 0.15s ease;
}
.pc-modal {
  background: #fff;
  border-radius: 16px;
  width: 480px; /* default width; can be overridden via inline style from openModal(opts) */
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  animation: pcScaleIn 0.2s ease;
}
.pc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.pc-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #2D3436;
}
.pc-modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: none;
  font-size: 20px;
  color: #636E72;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pc-modal-close:hover { background: #F1F5F9; }
.pc-modal-body { padding: 20px 24px; }
.pc-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 24px 20px;
}
.pc-modal-field { margin-bottom: 16px; }
.pc-modal-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #636E72;
  margin-bottom: 6px;
}
.pc-modal-input {
  width: 100%;
  height: 40px;
  border: 1.5px solid #E2E8F0;
  border-radius: 10px;
  padding: 0 14px;
  font-size: 14px;
  color: #2D3436;
  outline: none;
  transition: border-color 0.2s;
}
.pc-modal-input:focus {
  border-color: #6C5CE7;
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

/* ===== Feedback Float Button ===== */
.feedback-float {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  background: linear-gradient(135deg, #6C5CE7, #A29BFE);
  color: #fff;
  border: none;
  border-radius: 14px 0 0 14px;
  cursor: pointer;
  box-shadow: -2px 2px 16px rgba(108, 92, 231, 0.35);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 3px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}
.feedback-float:hover {
  padding-right: 14px;
  box-shadow: -4px 4px 24px rgba(108, 92, 231, 0.5);
  background: linear-gradient(135deg, #5A4BD1, #6C5CE7);
}
.feedback-float-icon {
  font-size: 20px;
  margin-bottom: 4px;
}

/* Feedback Modal Overlay */
.feedback-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s;
}
.feedback-overlay.active {
  opacity: 1;
  visibility: visible;
}

.feedback-card {
  background: #fff;
  border-radius: 20px;
  width: 440px;
  max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.18);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.feedback-overlay.active .feedback-card {
  transform: translateY(0) scale(1);
}

.feedback-card-header {
  padding: 24px 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.feedback-card-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
}
.feedback-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #F1F5F9;
  color: #64748B;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.feedback-close-btn:hover {
  background: #E2E8F0;
  color: #334155;
}

.feedback-card-body {
  padding: 20px 28px 28px;
}

.feedback-type-group {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}
.feedback-type-btn {
  flex: 1;
  padding: 8px 4px;
  border: 1.5px solid #E2E8F0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #64748B;
  transition: all 0.2s;
  font-family: inherit;
}
.feedback-type-btn:hover {
  border-color: #C4B5FD;
  color: #6C5CE7;
}
.feedback-type-btn.active {
  border-color: #6C5CE7;
  background: #F0EEFF;
  color: #6C5CE7;
}
.feedback-type-btn span {
  display: block;
  font-size: 18px;
  margin-bottom: 2px;
}

.feedback-textarea {
  width: 100%;
  min-height: 120px;
  padding: 14px;
  border: 1.5px solid #E2E8F0;
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  color: #2D3436;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.feedback-textarea:focus {
  border-color: #6C5CE7;
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}
.feedback-textarea::placeholder {
  color: #94A3B8;
}

.feedback-hint {
  font-size: 12px;
  color: #94A3B8;
  margin: 8px 0 16px;
}

.feedback-submit-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #6C5CE7, #A29BFE);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.feedback-submit-btn:hover {
  background: linear-gradient(135deg, #5A4BD1, #6C5CE7);
  box-shadow: 0 4px 16px rgba(108, 92, 231, 0.4);
}
.feedback-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.feedback-success {
  text-align: center;
  padding: 20px 0;
}
.feedback-success-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.feedback-success h4 {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 8px;
}
.feedback-success p {
  font-size: 14px;
  color: #64748B;
  margin: 0;
}

