/* ====================================================
   TERAL CATALOG MANAGER - Documents UI
   Theme-aligned design
   ==================================================== */

.tcm-documents-wrapper {
  --tcm-primary: var(--color-primary-600, #02a2e4);
  --tcm-primary-light: rgba(2, 162, 228, 0.08);
  --tcm-text: #0f2c49;
  --tcm-muted: #64748b;
  --tcm-border: #e2e8f0;
}

/* Section header */
.tcm-section-header {
  text-align: center;
  margin-bottom: 2rem;
}

.tcm-section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--tcm-text);
  margin: 0 0 0.5rem;
  position: relative;
  display: inline-block;
}

.tcm-section-title::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 3px;
  background: var(--tcm-primary);
}

.tcm-section-desc {
  font-size: 0.9375rem;
  color: var(--tcm-muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ====================================================
   TABS
==================================================== */
.tcm-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0;
  border-bottom: 2px solid var(--tcm-border);
}

.tcm-tab {
  padding: 0.75rem 1.5rem;
  background: #f8fafc;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--tcm-muted);
  border: 1px solid var(--tcm-border);
  border-bottom: none;
  transition: all 0.25s ease;
}

.tcm-tab:hover {
  background: #f1f5f9;
  color: var(--tcm-text);
}

.tcm-tab.active {
  background: #fff;
  color: var(--tcm-primary);
  border-color: var(--tcm-border);
  border-bottom: 2px solid #fff;
  margin-bottom: -2px;
}

/* ====================================================
   SEARCH BAR
==================================================== */
.tcm-search {
  display: block;
  width: 100%;
  max-width: 400px;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  margin: 0 0 1.5rem;
  border: 1px solid var(--tcm-border);
  border-radius: 8px;
  font-size: 0.9375rem;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat 1rem center;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.tcm-search:focus {
  border-color: var(--tcm-primary);
  box-shadow: 0 0 0 3px var(--tcm-primary-light);
}

.tcm-search::placeholder {
  color: #94a3b8;
}

/* ====================================================
   TABLE
==================================================== */
.tcm-tab-content {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--tcm-border);
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.tcm-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.tcm-table thead th {
  padding: 1rem 0.75rem;
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f8fafc;
  border-bottom: 2px solid var(--tcm-border);
  text-align: center;
  white-space: nowrap;
  color: var(--tcm-muted);
}

.tcm-table tbody td {
  padding: 1rem 0.75rem;
  font-size: 0.9375rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  text-align: center;
}

.tcm-table tbody tr:hover td {
  background: var(--tcm-primary-light);
}

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

/* Column widths */
.tcm-table th:first-child,
.tcm-table td:first-child {
  width: 100px;
}

.tcm-table th:nth-child(2),
.tcm-table td:nth-child(2) {
  font-weight: 600;
  color: var(--tcm-text);
  text-align: left;
  padding-left: 1rem;
}

/* ====================================================
   THUMBNAIL
==================================================== */
.tcm-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--tcm-border);
  transition: transform 0.2s, box-shadow 0.2s;
}

.tcm-thumb:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ====================================================
   PDF PREVIEW / DOWNLOAD
==================================================== */
.tcm-pdf-preview {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border: 1px solid var(--tcm-border);
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
  transition: all 0.2s ease;
}

.tcm-pdf-preview img {
  width: 64px;
  height: 84px;
  object-fit: contain;
}

.tcm-pdf-icon {
  width: 64px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tcm-primary-light);
  border-radius: 6px;
  color: var(--tcm-primary);
  font-size: 2rem;
}

.tcm-pdf-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--tcm-primary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tcm-pdf-preview:hover {
  border-color: var(--tcm-primary);
  box-shadow: 0 4px 12px rgba(2, 162, 228, 0.15);
}

.tcm-pdf-preview:hover .tcm-pdf-label {
  text-decoration: underline;
}

/* Empty cell */
.tcm-empty {
  color: #cbd5e1;
  font-size: 0.875rem;
}

/* ====================================================
   PAGINATION
==================================================== */
.tcm-pagination {
  display: flex !important;
  flex-direction: row !important;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1.5rem 0 0;
}

.tcm-pagination button {
  min-width: 36px;
  height: 36px;
  padding: 0 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--tcm-border);
  background: #fff;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tcm-pagination button:hover {
  border-color: var(--tcm-primary);
  color: var(--tcm-primary);
  background: var(--tcm-primary-light);
}

.tcm-pagination button.active {
  background: var(--tcm-primary);
  border-color: var(--tcm-primary);
  color: #fff;
}

/* ====================================================
   INLINE (from frontend.php)
==================================================== */
.tcm-hidden {
  display: none !important;
}

/* ====================================================
   MOBILE
==================================================== */
@media (max-width: 768px) {
  .tcm-section-header {
    margin-bottom: 1.5rem;
  }

  .tcm-section-title {
    font-size: 1.25rem;
  }

  .tcm-tabs {
    gap: 0.5rem;
  }

  .tcm-tab {
    flex: 1 1 auto;
    text-align: center;
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
  }

  .tcm-tab-content {
    padding: 1rem;
  }

  .tcm-search {
    max-width: 100%;
  }

  .tcm-table,
  .tcm-table tbody,
  .tcm-table tr {
    display: block;
    width: 100%;
  }

  .tcm-table {
    border: none;
  }

  .tcm-table thead {
    display: none;
  }

  .tcm-table tbody tr {
    background: #fff;
    border: 1px solid var(--tcm-border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .tcm-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border: none;
    text-align: left;
    font-size: 0.875rem;
  }

  .tcm-table td:first-child {
    justify-content: flex-start;
    gap: 1rem;
  }

  .tcm-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--tcm-text);
    flex: 0 0 38%;
  }

  .tcm-table td:first-child::before {
    display: none;
  }

  .tcm-thumb {
    width: 56px;
    height: 56px;
  }

  .tcm-pdf-preview {
    padding: 0.375rem;
  }

  .tcm-pdf-preview img {
    width: 48px;
    height: 64px;
  }

  .tcm-pagination {
    flex-wrap: wrap;
  }

  .tcm-pagination button {
    min-width: 40px;
  }
}
