/* ===========================
   CUSTOM STYLING FOR GOZIM
   =========================== */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #f8f9fa;
  color: #333;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.navbar-static-top {
  margin-bottom: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.5px;
}

.container {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0 8px;
  border-bottom: 1px solid #e0e0e0;
  margin: 0 0 16px;
  gap: 20px;
}

.header-content h1 {
  margin: 0 0 2px 0;
  font-size: 26px;
  font-weight: 700;
  color: #222;
}

.header-content .lead {
  margin: 0;
  font-size: 14px;
  color: #666;
  font-weight: 400;
}

.view-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-controls {
  display: inline-flex;
  padding: 2px;
  border: 1px solid #d5d9de;
  border-radius: 999px;
  background: #fff;
}

.theme-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #414955;
  font-size: 13px;
  font-weight: 600;
}

.theme-controls button:hover {
  background: #f0f3f7;
}

.theme-controls button[aria-pressed="true"] {
  background: #dfebfc;
  color: #0757cf;
}

.theme-controls button:focus-visible {
  outline: 2px solid #0757cf;
  outline-offset: -2px;
}

.theme-icon {
  width: 18px;
  height: 18px;
  flex: none;
  background: currentColor;
  mask: center / contain no-repeat;
}

.theme-icon-none { mask-image: url("/static/icons/theme-none.svg"); }
.theme-icon-light { mask-image: url("/static/icons/theme-light.svg"); }
.theme-icon-dark { mask-image: url("/static/icons/theme-dark.svg"); }

.btn-group {
  display: inline-flex;
  border-radius: 4px;
  overflow: hidden;
}

.btn-group .btn {
  border-radius: 0;
  border: none;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-group .btn:first-child {
  border-radius: 4px 0 0 4px;
}

.btn-group .btn:last-child {
  border-radius: 0 4px 4px 0;
}

.btn-group .btn + .btn {
  margin-left: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-group .btn.active {
  background-color: #0275d8;
  border-color: #0275d8;
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.btn-group .btn.active:hover {
  background-color: #025aa5;
}

.btn-group .btn-default {
  background-color: #e9ecef;
  color: #495057;
  border: 1px solid transparent;
}

.btn-group .btn-default:hover {
  background-color: #dee2e6;
}

[hidden] {
  display: none !important;
}

/* Table View */
.archive-table-container {
  margin-bottom: 40px;
}

.archive-table {
  margin: 0;
  border-collapse: collapse;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.archive-table thead {
  background-color: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
}

.archive-table thead th {
  font-weight: 600;
  color: #495057;
  padding: 10px 12px;
  border: none;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.archive-table thead th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease;
}

.archive-table thead th.sortable:hover {
  background-color: #e9ecef;
}

.archive-table thead th.sortable button {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.archive-size {
  white-space: nowrap;
}

.archive-table thead th .sort-icon {
  display: inline-block;
  font-size: 12px;
  color: #adb5bd;
  margin-left: 4px;
  transition: color 0.15s ease;
}

.archive-table thead th.sort-asc .sort-icon,
.archive-table thead th.sort-desc .sort-icon {
  color: #0275d8;
  font-weight: bold;
}

/* Tree view styling */
.archive-table.archive-tree tbody tr.tree-category {
  background-color: #f8f9fa;
  font-weight: 600;
  cursor: default;
}

.archive-table.archive-tree tbody tr.tree-category:hover {
  background-color: #f8f9fa;
}

.archive-table.archive-tree tbody tr.tree-category .tree-category-cell {
  color: #222;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* Tree item rows with visual lines */
.archive-table.archive-tree tbody tr.tree-item {
  background-color: white;
}

.archive-table.archive-tree tbody td {
  vertical-align: middle;
}

.archive-table.archive-tree tbody tr.tree-category {
  cursor: pointer;
}

.tree-category-toggle {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
}

.tree-category-toggle:focus-visible {
  outline: 2px solid #0757cf;
  outline-offset: 2px;
}

.tree-chevron {
  width: 16px;
  height: 16px;
  margin: 0 12px 0 2px;
  vertical-align: middle;
  transition: transform 0.15s ease;
}

tr.tree-category.collapsed .tree-chevron {
  transform: rotate(-90deg);
}

.tree-folder-icon {
  color: #3b6fd4;
  width: 20px;
  height: 20px;
  margin-right: 6px;
}

.tree-count {
  color: #6c757d;
  font-weight: 400;
}

.tree-file-icon {
  width: 20px;
  height: 20px;
  margin-right: 6px;
  vertical-align: middle;
  color: #6c757d;
}

.archive-table.archive-tree tbody tr.tree-item .tree-root-cell {
  padding-left: 42px;
  white-space: nowrap;
}

.archive-table.archive-tree tbody tr.tree-item .tree-item-cell {
  position: relative;
  padding-left: 52px;
  white-space: nowrap;
}

tr.tree-item[data-tree-position] .tree-item-cell::before,
tr.tree-item[data-tree-position] .tree-item-cell::after {
  content: "";
  position: absolute;
  left: 21px;
  border-color: #9aa0a6;
  border-style: dotted;
  border-width: 0;
}

tr.tree-item[data-tree-position] .tree-item-cell::before {
  top: 0;
  bottom: 0;
  border-left-width: 1px;
}

tr.tree-item[data-tree-position="last"] .tree-item-cell::before {
  bottom: 50%;
}

tr.tree-item[data-tree-position] .tree-item-cell::after {
  top: 50%;
  width: 20px;
  border-top-width: 1px;
}

.archive-table tbody tr {
  transition: background-color 0.15s ease;
}

.archive-table tbody tr:hover {
  background-color: #f8f9fa;
}


.archive-table tbody td {
  padding: 2px 12px;
  font-size: 14px;
  line-height: 1.2;
}

.archive-title a {
  color: #0275d8;
  text-decoration: none;
  font-weight: 500;
}

.archive-title a:hover {
  color: #025aa5;
  text-decoration: underline;
}

.archive-language {
  color: #666;
  font-size: 13px;
}

.archive-articles {
  font-weight: 500;
  color: #495057;
}

.archive-description {
  color: #6c757d;
  font-size: 13px;
  max-width: 300px;
  white-space: normal;
}

.archive-actions {
  white-space: nowrap;
  padding: 2px 12px !important;
}

.archive-actions .btn {
  margin: 0 2px;
  font-size: 12px;
  padding: 2px 8px;
}

/* Card View */
.archive-cards {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 40px;
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.category-filters .btn {
  border-radius: 14px;
  padding: 3px 12px;
  font-size: 12px;
}

.category-filters .filter-language {
  color: #fff;
  background-color: #777;
  border-color: #777;
}

.category-filters .filter-language:hover,
.category-filters .filter-language:focus {
  color: #fff;
  background-color: #5e5e5e;
}

.category-filters .btn.active {
  box-shadow: inset 0 0 0 2px #222, 0 2px 4px rgba(0, 0, 0, 0.15);
}

.filter-count {
  opacity: 0.7;
  margin-left: 2px;
}

.archive-card[hidden] {
  display: none;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  padding: 16px;
  background-color: white;
}

.archive-card {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  height: 100%;
}

.archive-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.archive-card-image {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
  color: #0275d8;
  font-size: 44px;
  overflow: hidden;
  flex-shrink: 0;
}

.archive-card-image a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

.archive-card-image a:hover {
  opacity: 0.85;
}

.archive-cover {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.archive-card-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.archive-card-title {
  margin: 0 0 6px 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: #222;
}

.archive-card-title a {
  color: #0275d8;
  text-decoration: none;
}

.archive-card-title a:hover {
  color: #025aa5;
  text-decoration: underline;
}

.archive-card-meta {
  margin: 0 0 8px 0;
  font-size: 12px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.archive-card-meta .label {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.card-articles {
  white-space: nowrap;
}

.archive-card-description {
  margin: 0 0 10px 0;
  font-size: 12px;
  color: #6c757d;
  line-height: 1.4;
  flex: 1;
}

.archive-card .archive-actions {
  display: flex;
  gap: 6px;
  white-space: normal;
  flex-wrap: wrap;
}

.archive-card .archive-actions .btn {
  flex: 1;
  min-width: 40px;
  padding: 3px 10px;
  font-size: 12px;
}

/* Page Footer */
.page-footer {
  background-color: #2c3e50;
  color: #ecf0f1;
  padding: 30px 0;
  margin-top: auto;
  border-top: 1px solid #1a252f;
}

.page-footer .container {
  flex: none;
  max-width: 100%;
}

.page-footer .credit {
  margin: 0;
  text-align: center;
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* Responsive Design */
@media (max-width: 992px) {
  .archive-cards {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    padding: 10px 0 8px;
    margin-bottom: 16px;
    align-items: stretch;
  }

  .view-controls {
    justify-content: flex-start;
  }

  .header-content h1 {
    font-size: 28px;
  }

  .archive-cards {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
  }

  .archive-table thead th {
    padding: 12px 8px;
    font-size: 12px;
  }

  .archive-table tbody td {
    padding: 10px 8px;
    font-size: 12px;
  }

  .archive-description {
    max-width: 150px;
  }

  .archive-actions .btn {
    padding: 3px 8px;
    font-size: 11px;
    margin: 1px;
  }

  .archive-card-image {
    height: 160px;
    font-size: 48px;
  }

  .archive-card-body {
    padding: 16px;
  }

  .archive-card-title {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .page-header {
    padding: 20px 0 15px;
  }

  .header-content h1 {
    font-size: 24px;
  }

  .header-content .lead {
    font-size: 14px;
  }

  .archive-cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .archive-table-container {
    border-radius: 0;
  }

  .archive-table thead th {
    padding: 10px 6px;
    font-size: 11px;
  }

  .archive-table tbody td {
    padding: 8px 6px;
    font-size: 11px;
  }

  .btn-group .btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .archive-card {
    border-radius: 4px;
  }
}


.table.archive-table > tbody > tr > td {
  border-top: none;
}
