/* Person Profile Page Styles */
/* Accessibility shared styles are in assets/css/accessibility.css */

html { background: #0f1419; }
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans Hebrew', Arial, sans-serif;
  background: linear-gradient(135deg, #1a1f36 0%, #0f1419 100%);
  color: #e8eefc;
  min-height: 100vh;
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(26, 31, 54, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding: 20px 24px;
  z-index: 1001;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.3s ease;
}

.header.hide { transform: translateY(-100%); }

.header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  background: linear-gradient(135deg, #fff 0%, #9cc2ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-nav {
  display: flex;
  gap: 16px;
  align-items: center;
}

.header-controls {
  display: flex;
  gap: 16px;
  align-items: center;
}

.header-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #9cc2ff;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-admin-link {
  color: #fbbf24;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid rgba(251,191,36,0.35);
  border-radius: 6px;
  transition: background 0.2s;
  white-space: nowrap;
}
.header-admin-link:hover { background: rgba(251,191,36,0.15); }

.header-logout-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.25);
  color: rgba(232,238,252,0.7);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
  font-family: inherit;
  white-space: nowrap;
}
.header-logout-btn:hover { background: rgba(255,255,255,0.15); color: #e8eefc; }

/* Hamburger button — hidden on desktop */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
  color: rgba(232,238,252,0.85);
  transition: background 0.2s;
}
.hamburger-btn:hover { background: rgba(255,255,255,0.15); }
.hamburger-btn.active { background: rgba(255,255,255,0.12); }
.hamburger-btn .hb-open { display: none; }
.hamburger-btn.active .hb-closed { display: none; }
.hamburger-btn.active .hb-open { display: inline; }

.lang-switcher {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 6px 10px;
  display: flex;
  gap: 8px;
  direction: ltr;
}

.lang-btn {
  background: transparent;
  border: none;
  color: rgba(232,238,252,0.6);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.lang-btn:hover, .lang-btn.active {
  background: rgba(156,194,255,0.25);
  color: #9cc2ff;
}

.back-link {
  color: #9cc2ff;
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.back-link:hover {
  background: rgba(156,194,255,0.1);
  color: #b5d4ff;
}

.contribute-link {
  color: #6ee7b7;
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.3s ease;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.2);
}

.contribute-link:hover {
  background: rgba(16,185,129,0.2);
  color: #a7f3d0;
  border-color: rgba(16,185,129,0.3);
}

.content {
  max-width: 1000px;
  margin: 100px auto 60px auto;
  padding: 0 24px;
}

.person-header {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 32px;
  margin-bottom: 32px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.person-avatar {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  background: rgba(156,194,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 600;
  color: #9cc2ff;
  flex-shrink: 0;
}

.person-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 12px;
}

.person-info {
  flex: 1;
}

.person-info h1 {
  margin: 0 0 8px 0;
  font-size: 32px;
  background: linear-gradient(135deg, #fff 0%, #9cc2ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.person-meta {
  font-size: 14px;
  color: rgba(232,238,252,0.6);
  line-height: 1.8;
  margin-bottom: 12px;
}

.person-meta-item {
  display: inline-block;
  margin-right: 16px;
}

.person-occupation {
  display: inline-block;
  padding: 6px 12px;
  background: rgba(156,194,255,0.15);
  border-radius: 6px;
  font-size: 13px;
  color: #9cc2ff;
  margin-top: 8px;
}

.person-previous-name {
  font-size: 13px;
  color: rgba(232,238,252,0.5);
  font-style: italic;
  margin-bottom: 8px;
  line-height: 1.6;
}

.person-previous-name small {
  color: rgba(232,238,252,0.4);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section {
  margin-bottom: 32px;
}

.section h2 {
  font-size: 18px;
  font-weight: 600;
  color: #9cc2ff;
  margin: 0 0 16px 0;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 1px;
}

.bio {
  background: rgba(255,255,255,0.04);
  border-left: 3px solid #9cc2ff;
  border-radius: 0 6px 6px 0;
  padding: 20px;
  line-height: 1.8;
  color: rgba(232,238,252,0.85);
}

[dir="ltr"] .bio {
  border-left: none;
  border-right: 3px solid #9cc2ff;
  border-radius: 6px 0 0 6px;
}

.timeline {
  position: relative;
  padding-left: 32px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(156,194,255,0.3);
}

.timeline-item {
  position: relative;
  padding-bottom: 24px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -28px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9cc2ff;
  border: 2px solid #1a1f36;
}

.timeline-year {
  font-weight: 600;
  color: #9cc2ff;
  font-size: 14px;
}

.timeline-event {
  color: rgba(232,238,252,0.85);
  font-size: 14px;
  margin-top: 4px;
}

.relations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.relation-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 16px;
  text-decoration: none;
  color: #9cc2ff;
  transition: all 0.3s ease;
  cursor: pointer;
}

.relation-card:hover {
  background: rgba(156,194,255,0.1);
  border-color: rgba(156,194,255,0.3);
  transform: translateY(-2px);
}

.relation-card .type {
  font-size: 11px;
  text-transform: uppercase;
  color: rgba(232,238,252,0.5);
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.relation-card .name {
  font-weight: 600;
  font-size: 16px;
}

.empty {
  color: rgba(232,238,252,0.4);
  font-size: 14px;
  padding: 20px;
  text-align: center;
}

@media (max-width: 768px) {
  .content {
    margin-top: 80px;
  }
  .person-header {
    padding: 20px;
    flex-direction: column;
  }
  .person-avatar {
    width: 80px;
    height: 80px;
    font-size: 32px;
  }
  .person-info h1 {
    font-size: 24px;
  }
  .header {
    flex-wrap: wrap;
    gap: 12px;
  }
  .relations-grid {
    grid-template-columns: 1fr;
  }
  .timeline {
    padding-left: 24px;
  }
}

/* Mobile-specific improvements for phones */
@media (max-width: 640px) {
  .header {
    padding: 10px 16px;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .header h1 {
    font-size: 17px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
  }

  /* Primary nav stays on the bar */
  .header-nav {
    gap: 6px;
    flex-shrink: 0;
  }

  .back-link {
    font-size: 13px;
    padding: 6px 8px;
  }

  .contribute-link {
    font-size: 13px;
    padding: 6px 8px;
  }

  /* Secondary controls hidden, shown as dropdown */
  .header-controls {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: rgba(20, 26, 46, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.12);
    padding: 14px 20px;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    z-index: 1002;
  }
  .header-controls.open {
    display: flex;
  }

  /* Show hamburger button */
  .hamburger-btn {
    display: flex;
    flex-shrink: 0;
  }

  .lang-switcher {
    padding: 5px 8px;
    gap: 6px;
  }

  .lang-btn {
    font-size: 12px;
    padding: 4px 8px;
  }

  .header-user-name {
    font-size: 14px;
    max-width: none;
  }

  .header-admin-link, .header-logout-btn {
    font-size: 13px;
    padding: 7px 14px;
  }

  .content {
    margin-top: 72px;
  }

  .person-header {
    padding: 16px;
    gap: 16px;
  }

  .person-avatar {
    width: 64px;
    height: 64px;
    font-size: 28px;
  }
}

/* Photo Gallery */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.photo-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: transform 0.2s;
}

.photo-item:hover {
  transform: translateY(-4px);
}

.photo-item img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  display: block;
  background: rgba(0, 0, 0, 0.2);
}

.photo-caption {
  padding: 12px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

.photo-year {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4px;
}

/* Photo Document Placeholder */
.photo-document {
  cursor: pointer;
}

.photo-document-placeholder {
  width: 100%;
  height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.photo-document:hover .photo-document-placeholder {
  background: rgba(156, 194, 255, 0.15);
  border-color: rgba(156, 194, 255, 0.4);
}

.photo-document-icon {
  font-size: 48px;
  margin-bottom: 8px;
  opacity: 0.8;
}

.photo-document-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

.photo-document:hover .photo-document-label {
  color: #9cc2ff;
}

/* Photo with Original Document Link */
.photo-item.has-original-doc {
  position: relative;
}

.photo-doc-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 2;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

[dir="rtl"] .photo-doc-badge {
  right: auto;
  left: 8px;
}

.photo-doc-badge:hover {
  background: rgba(107, 179, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.8);
  transform: scale(1.1);
}

.photo-original-link {
  font-size: 11px;
  color: rgba(156, 194, 255, 0.7);
  margin-top: 4px;
  font-style: italic;
}

/* Photo Lightbox Viewer */
.photo-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 20px 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  cursor: pointer;
}

.lightbox-content {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 1400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;
  animation: zoomIn 0.3s ease;
  gap: 16px;
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.lightbox-content img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  flex-shrink: 1;
}

.lightbox-caption {
  color: #fff;
  font-size: 16px;
  padding: 12px 24px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 8px;
  max-width: 600px;
  text-align: center;
  flex-shrink: 0;
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  border: 2px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10001;
}

.lightbox-close:hover {
  background: rgba(255, 59, 48, 0.9);
  border-color: rgba(255, 255, 255, 0.8);
  transform: rotate(90deg);
}

/* Search Box */
.search-box {
  position: relative;
  margin-top: 16px;
  margin-bottom: 8px;
}

.search-box input {
  width: 100%;
  padding: 12px 40px 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #e8eefc;
  font-size: 14px;
  transition: all 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: #6bb3ff;
  background: rgba(255, 255, 255, 0.08);
}

.search-box input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.search-box .search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  pointer-events: none;
  opacity: 0.5;
}

/* RTL support for search box */
[dir="rtl"] .search-box input {
  padding: 12px 16px 12px 40px;
}

[dir="rtl"] .search-box .search-icon {
  right: auto;
  left: 12px;
}

/* Document Folders */
.document-folder {
  margin-top: 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.folder-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.folder-header:hover {
  background: rgba(255, 255, 255, 0.08);
}

.folder-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.folder-name {
  font-weight: 600;
  font-size: 16px;
  flex: 1;
  color: #9cc2ff;
}

.folder-count {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
}

.folder-toggle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  transition: transform 0.2s;
}

.folder-download {
  background: rgba(76, 175, 80, 0.25);
  border: 1px solid rgba(76, 175, 80, 0.5);
  color: #81c784;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
  margin-right: 12px;
}

.folder-download:hover {
  background: rgba(76, 175, 80, 0.35);
  border-color: rgba(76, 175, 80, 0.7);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.folder-download:active {
  transform: translateY(0);
}

.folder-download:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.download-icon {
  font-size: 16px;
  line-height: 1;
}

.download-text {
  white-space: nowrap;
}

/* Hide download text on small screens */
@media (max-width: 768px) {
  .download-text {
    display: none;
  }
  
  .folder-download {
    padding: 8px 10px;
    margin-right: 4px;
  }
}

.folder-contents {
  padding: 8px 12px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Documents List */
.documents-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.document-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
  margin-left: 20px;
}

[dir="rtl"] .document-item {
  margin-left: 0;
  margin-right: 20px;
}

.document-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #6bb3ff;
  transform: translateX(4px);
  cursor: pointer;
}

[dir="rtl"] .document-item:hover {
  transform: translateX(-4px);
}

.document-item.document-unavailable {
  opacity: 0.55;
  cursor: default;
}

.document-item.document-unavailable:hover {
  background: inherit;
  border-color: inherit;
  transform: none;
  cursor: default;
}

.document-unavailable-label {
  font-size: 12px;
  color: #8899bb;
  margin-top: 4px;
  font-style: italic;
}

.document-icon {
  width: 40px;
  height: 40px;
  background: rgba(74, 144, 226, 0.2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

/* Preview images for photo documents */
.document-preview {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(107, 179, 255, 0.3);
}

.document-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.document-item.has-preview {
  padding: 8px 16px 8px 8px;
}

[dir="rtl"] .document-item.has-preview {
  padding: 8px 8px 8px 16px;
}

.document-item.has-preview:hover .document-preview {
  border-color: #6bb3ff;
}

.document-info {
  flex: 1;
  min-width: 0;
}

.document-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.document-description {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.document-meta {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4px;
}

.document-snippet {
  margin-top: 8px;
}

.document-snippet mark {
  background-color: #f39c12;
  color: #000;
  padding: 2px 4px;
  border-radius: 2px;
  font-weight: 600;
}

/* Videos List */
.videos-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.links-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.external-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(107, 179, 255, 0.1);
  border: 1px solid rgba(107, 179, 255, 0.3);
  border-radius: 8px;
  color: #6bb3ff;
  text-decoration: none;
  font-size: 15px;
  transition: all 0.2s;
  width: fit-content;
}

.external-link:hover {
  background: rgba(107, 179, 255, 0.2);
  border-color: #6bb3ff;
  color: #90caff;
}

.video-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s;
  cursor: pointer;
}

.video-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #6bb3ff;
}

.video-thumbnail {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.3);
}

.video-info {
  padding: 16px;
}

.video-title {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 8px;
}

.video-description {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 8px;
}

.video-year {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}
/* Documents Section - Primary Focus */
.documents-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.document-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.2s;
  display: flex;
  align-items: start;
  gap: 16px;
}

.document-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #6bb3ff;
  transform: translateY(-2px);
}

.document-icon {
  width: 48px;
  height: 48px;
  background: rgba(107, 179, 255, 0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.document-icon.pdf { background: rgba(231, 76, 60, 0.2); }
.document-icon.doc { background: rgba(41, 128, 185, 0.2); }
.document-icon.txt { background: rgba(149, 165, 166, 0.2); }
.document-icon.image { background: rgba(46, 204, 113, 0.2); }

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

.document-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.document-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.document-category {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(107, 179, 255, 0.2);
  border-radius: 12px;
  font-size: 12px;
  color: #9cc2ff;
  text-transform: capitalize;
  flex-shrink: 0;
}

.document-description {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.6;
  margin: 8px 0;
}

.document-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 8px;
}

/* Grouped Documents */
.document-group {
  background: linear-gradient(135deg, rgba(156, 194, 255, 0.08) 0%, rgba(255, 255, 255, 0.05) 100%);
  border-left: 3px solid #6bb3ff;
}

.document-group:hover {
  background: linear-gradient(135deg, rgba(156, 194, 255, 0.12) 0%, rgba(255, 255, 255, 0.08) 100%);
}

.document-versions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.version-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(107, 179, 255, 0.15);
  border: 1px solid rgba(107, 179, 255, 0.3);
  border-radius: 8px;
  color: #9cc2ff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.version-button:hover {
  background: rgba(107, 179, 255, 0.25);
  border-color: #6bb3ff;
  transform: translateY(-1px);
}

.ver-icon {
  font-size: 16px;
}

.ver-label {
  white-space: nowrap;
}

.ver-original {
  background: rgba(231, 76, 60, 0.15);
  border-color: rgba(231, 76, 60, 0.3);
  color: #ff9999;
}

.ver-original:hover {
  background: rgba(231, 76, 60, 0.25);
  border-color: rgba(231, 76, 60, 0.5);
}

.ver-transcribed {
  background: rgba(52, 152, 219, 0.15);
  border-color: rgba(52, 152, 219, 0.3);
  color: #5dade2;
}

.ver-transcribed:hover {
  background: rgba(52, 152, 219, 0.25);
  border-color: rgba(52, 152, 219, 0.5);
}

.document-year {
  display: flex;
  align-items: center;
  gap: 4px;
}

.document-type {
  text-transform: uppercase;
  font-weight: 500;
}

.document-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(107, 179, 255, 0.15);
  border: 1px solid rgba(107, 179, 255, 0.3);
  border-radius: 6px;
  color: #9cc2ff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  margin-top: 12px;
  display: inline-flex;
}

.document-link:hover {
  background: rgba(107, 179, 255, 0.25);
  border-color: #6bb3ff;
  color: #fff;
}

.document-link::after {
  content: '→';
  font-size: 16px;
}

.empty-section {
  padding: 32px;
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
}

/* Document Preview Modal */
.doc-preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.doc-preview-content {
  background: linear-gradient(135deg, #1a1f36 0%, #0f1419 100%);
  border-radius: 16px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease-out;
}

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

.doc-preview-header {
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.doc-preview-info {
  flex: 1;
  min-width: 0;
}

.doc-preview-title {
  font-size: 20px;
  font-weight: 600;
  color: #e8eefc;
  margin: 0 0 8px 0;
}

.doc-preview-meta {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.doc-preview-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.doc-preview-close {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e8eefc;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 20px;
  flex-shrink: 0;
}

.doc-preview-close:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #ff6b6b;
  color: #ff6b6b;
}

.doc-preview-body {
  padding: 16px 24px 24px 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 200px;
  max-height: 60vh;
}

.doc-preview-snippet {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  line-height: 1.6;
  max-height: 500px;
  overflow: auto;
  position: relative;
  margin-bottom: 20px;
}

.doc-preview-icon-large {
  font-size: 32px;
  text-align: center;
  margin-bottom: 8px;
  opacity: 0.8;
}

.doc-preview-description {
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 16px;
  line-height: 1.6;
  font-size: 13px;
}

.doc-preview-actions {
  display: flex;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
}

.doc-preview-btn {
  flex: 1;
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.doc-preview-btn.primary {
  background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
  color: white;
}

.doc-preview-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

.doc-preview-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #e8eefc;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.doc-preview-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}

/* Copyright notice in doc preview modal */
.doc-copyright-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(255, 140, 0, 0.18);
  border-top: 2px solid rgba(255, 170, 0, 0.55);
  border-bottom: 2px solid rgba(255, 170, 0, 0.55);
}

.doc-copyright-notice .copyright-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.doc-copyright-notice p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
  color: #ffd264;
}

/* Copyright notice bar in document-viewer */
.viewer-copyright {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: rgba(255, 140, 0, 0.18);
  border-bottom: 2px solid rgba(255, 170, 0, 0.55);
  font-size: 14px;
  font-weight: 600;
  color: #ffd264;
  flex-shrink: 0;
  line-height: 1.5;
}

.viewer-copyright .copyright-icon {
  font-size: 20px;
  flex-shrink: 0;
}

/* Hierarchical Document Structure Styles */
.hierarchical-category {
  margin-bottom: 8px;
}

.hierarchical-category.level-0 {
  margin-bottom: 16px;
}

.hierarchical-category.level-1 .category-contents {
  padding-left: 20px;
}

.hierarchical-category.level-2 .category-contents {
  padding-left: 40px;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(74, 144, 226, 0.25) 0%, rgba(53, 122, 189, 0.2) 100%);
  border: 1px solid rgba(74, 144, 226, 0.4);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.category-header:hover {
  background: linear-gradient(135deg, rgba(74, 144, 226, 0.35) 0%, rgba(53, 122, 189, 0.3) 100%);
  border-color: rgba(74, 144, 226, 0.5);
  transform: translateX(-2px);
}

.category-header.expanded {
  background: linear-gradient(135deg, rgba(74, 144, 226, 0.35) 0%, rgba(53, 122, 189, 0.3) 100%);
  border-color: rgba(74, 144, 226, 0.5);
}

.category-toggle {
  font-size: 12px;
  color: #7fb3f5;
  transition: transform 0.2s;
  min-width: 16px;
}

.category-icon {
  font-size: 18px;
}

.category-title {
  flex: 1;
  color: #e8eefc;
  font-size: 15px;
}

.category-count {
  color: #b0c5e5;
  font-size: 13px;
  font-weight: normal;
}

.category-download-btn {
  background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  color: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.category-download-btn:hover {
  background: linear-gradient(135deg, #5a9df2 0%, #4589cd 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.category-download-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.category-download-btn .download-icon {
  font-size: 14px;
}

.category-contents {
  margin-top: 8px;
  padding-left: 16px;
}

/* Article Item Styles */
.article-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 16px;
  margin: 8px 0;
  transition: all 0.2s;
}

.article-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #6bb3ff;
}

.article-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.article-icon {
  font-size: 24px;
  flex-shrink: 0;
  margin-top: 4px;
}

.article-info {
  flex: 1;
}

.article-title {
  font-size: 16px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 4px;
  line-height: 1.4;
}

.article-meta {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.article-meta span {
  display: inline-block;
}

.article-versions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.article-version-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.article-version-btn.version-original {
  background: rgba(231, 76, 60, 0.15);
  border-color: rgba(231, 76, 60, 0.3);
  color: #ff9999;
}

.article-version-btn.version-original:hover {
  background: rgba(231, 76, 60, 0.25);
  border-color: rgba(231, 76, 60, 0.5);
  transform: translateY(-1px);
}

.article-version-btn.version-transcription {
  background: rgba(52, 152, 219, 0.15);
  border-color: rgba(52, 152, 219, 0.3);
  color: #5dade2;
}

.article-version-btn.version-transcription:hover {
  background: rgba(52, 152, 219, 0.25);
  border-color: rgba(52, 152, 219, 0.5);
  transform: translateY(-1px);
}

.version-icon {
  font-size: 16px;
}

.version-label {
  font-size: 14px;
}

/* RTL Support */
[dir="rtl"] .category-contents {
  padding-left: 0;
  padding-right: 16px;
}

[dir="rtl"] .hierarchical-category.level-1 .category-contents {
  padding-left: 0;
  padding-right: 20px;
}

[dir="rtl"] .hierarchical-category.level-2 .category-contents {
  padding-left: 0;
  padding-right: 40px;
}

[dir="rtl"] .category-header:hover {
  transform: translateX(2px);
}

[dir="rtl"] .category-download-btn {
  margin-left: 0;
  margin-right: 8px;
}

/* English (LTR) Override */
[dir="ltr"] .category-title {
  text-align: left;
}
