/* ==========================================================================
   MacroSpyder - Resource & Document Download Hub Stylesheet
   Path: assets/css/pages/documents.css
   ========================================================================== */

:root {
  --doc-hero-glow: radial-gradient(circle at 50% -10%, rgba(16, 185, 129, 0.18), transparent 70%),
                   radial-gradient(circle at 85% 20%, rgba(99, 102, 241, 0.12), transparent 50%);
  --card-glow-hover: 0 12px 32px rgba(16, 185, 129, 0.12), 0 2px 6px rgba(0, 0, 0, 0.2);
  --spotlight-gradient: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(99, 102, 241, 0.08) 50%, rgba(17, 24, 39, 0.6) 100%);
}

[data-theme="light"] {
  --doc-hero-glow: radial-gradient(circle at 50% -10%, rgba(16, 185, 129, 0.1), transparent 70%),
                   radial-gradient(circle at 85% 20%, rgba(99, 102, 241, 0.06), transparent 50%);
  --card-glow-hover: 0 12px 32px rgba(16, 185, 129, 0.1), 0 2px 8px rgba(0, 0, 0, 0.06);
  --spotlight-gradient: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(99, 102, 241, 0.05) 50%, rgba(255, 255, 255, 0.95) 100%);
}

/* Page Base */
body.documents-body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Container */
.doc-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
  box-sizing: border-box;
}

/* Hero Section */
.doc-hero {
  background: var(--doc-hero-glow);
  padding: 32px 0 22px;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.doc-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.3;
  pointer-events: none;
}

.doc-hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 860px;
  margin: 0 auto;
}

.doc-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: 0.2px;
}

.doc-badge-pill .pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.doc-hero-title {
  font-size: 34px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.6px;
  line-height: 1.25;
  margin: 0 0 10px;
}

.doc-hero-title span.gradient-text {
  background: linear-gradient(120deg, var(--accent) 0%, #3b82f6 50%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.doc-hero-desc {
  font-size: 14.5px;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0 auto 20px;
  max-width: 680px;
}

/* Stat Counters Row */
.doc-stats-row {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 36px;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
}

.doc-stat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.doc-stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.doc-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.2;
}

.doc-stat-label {
  font-size: 11.5px;
  color: var(--text-3);
  font-weight: 500;
}

/* Spotlight Card (Tài Liệu Tiêu Điểm) */
.doc-spotlight-section {
  padding: 32px 0 12px;
}

.doc-spotlight-card {
  background: var(--spotlight-gradient);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 16px;
  padding: 28px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 28px;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.doc-spotlight-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #f59e0b;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.doc-spotlight-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 10px;
  line-height: 1.35;
}

.doc-spotlight-summary {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0 0 16px;
}

.doc-spotlight-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 20px;
}

.doc-spotlight-highlight-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.doc-spotlight-highlight-item svg {
  color: var(--accent);
}

.doc-spotlight-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.doc-spotlight-visual {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.doc-cover-preview {
  width: 100%;
  height: 160px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--text-2);
  position: relative;
  overflow: hidden;
}

.doc-cover-preview::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background: var(--accent);
}

.doc-cover-format-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  background: #ef4444;
  color: #fff;
}

.doc-meta-specs {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Control & Filter Toolbar */
.doc-toolbar-section {
  padding: 16px 0 20px;
  position: relative;
  background: transparent;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.doc-toolbar-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.doc-toolbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.doc-search-box {
  position: relative;
  flex: 1;
  min-width: 260px;
  max-width: 480px;
}

.doc-search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.doc-search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 14px 9px 40px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.doc-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.doc-filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.doc-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.doc-select:focus {
  border-color: var(--accent);
}

.doc-view-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}

.doc-view-btn {
  background: transparent;
  border: none;
  color: var(--text-3);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.doc-view-btn.active, .doc-view-btn:hover {
  background: var(--surface-2);
  color: var(--accent);
}

/* Category Tabs */
.doc-category-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.doc-category-tabs::-webkit-scrollbar {
  display: none;
}

.doc-tab-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.doc-tab-btn:hover {
  border-color: var(--text-3);
  color: var(--text);
}

.doc-tab-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 700;
}

.doc-tab-count {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.15);
  font-family: 'JetBrains Mono', monospace;
}

.doc-tab-btn.active .doc-tab-count {
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
}

/* Document Grid View */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.doc-card:hover {
  transform: translateY(-3px);
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: var(--card-glow-hover);
}

.doc-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.doc-format-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.doc-format-badge.pdf { background: rgba(239, 68, 68, 0.12); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.25); }
.doc-format-badge.xlsx { background: rgba(16, 185, 129, 0.12); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.25); }
.doc-format-badge.exe, .doc-format-badge.xll { background: rgba(59, 130, 246, 0.12); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.25); }
.doc-format-badge.zip { background: rgba(168, 85, 247, 0.12); color: #a855f7; border: 1px solid rgba(168, 85, 247, 0.25); }
.doc-format-badge.doc, .doc-format-badge.docx { background: rgba(14, 165, 233, 0.12); color: #0ea5e9; border: 1px solid rgba(14, 165, 233, 0.25); }

.doc-tier-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}

.doc-tier-pill.free {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.doc-tier-pill.vip {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.doc-tier-pill.standard {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
}

.doc-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  margin: 0 0 8px;
}

.doc-card-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  margin: 0 0 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.doc-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-bottom: 14px;
}

.doc-card-meta-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.doc-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons */
.btn-doc-download {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #0b0f19;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-doc-download:hover {
  background: #0ea5e9;
  color: #fff;
}

.btn-doc-download.locked {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.btn-doc-download.locked:hover {
  border-color: #a855f7;
  color: #c084fc;
}

.btn-doc-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-doc-preview:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Document List View */
.doc-list-view {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 40px;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.doc-table th {
  background: var(--surface-2);
  color: var(--text-3);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.doc-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.doc-table tr:last-child td {
  border-bottom: none;
}

.doc-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Empty State */
.doc-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}

.doc-empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 14px;
  opacity: 0.5;
}

/* Modal Popup Preview & Details */
.doc-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.doc-modal-overlay.active {
  display: flex;
}

.doc-modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.4);
  animation: modalFadeIn 0.2s ease-out;
  position: relative;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.doc-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.doc-modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}

.doc-modal-close-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.doc-modal-body {
  padding: 24px;
}

.doc-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--surface-2);
}

/* Toast Notification */
.doc-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #10b981;
  color: #000;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.doc-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .doc-spotlight-card {
    grid-template-columns: 1fr;
  }
  .doc-hero-title {
    font-size: 28px;
  }
  .doc-grid {
    grid-template-columns: 1fr;
  }
}
