/* DOKUMENDID SEKTSIOON */
.lhk-documents-section {
  padding: 40px 0;
  background: #f8f9fa;
}

.lhk-documents-section .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.section-title {
  text-align: center;
  font-size: 2.2rem;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 2rem;
  position: relative;
}

.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: linear-gradient(45deg, #3498db, #2980b9);
  margin: 15px auto 0 auto;
  border-radius: 2px;
}

/* FRONTEND KONTROLLID */
.documents-frontend-controls {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  border: 1px solid #e9ecef;
}

.controls-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.controls-title {
  font-size: 1rem;
  font-weight: 600;
  color: #2c3e50;
  display: flex;
  align-items: center;
  gap: 6px;
}

.results-info {
  font-size: 0.85rem;
  color: #6c757d;
  display: flex;
  align-items: center;
  gap: 8px;
}

.results-count {
  background: #3498db;
  color: white;
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.8rem;
  min-width: 20px;
  text-align: center;
}

.frontend-controls-row {
  display: grid;
  grid-template-columns: 2fr 1fr auto;
  gap: 12px;
  align-items: center;
}

.frontend-search-group {
  position: relative;
}

.frontend-search-input {
  width: 100%;
  padding: 10px 35px 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  background: #fff;
  height: 40px;
  box-sizing: border-box;
}

.frontend-search-input:focus {
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
  outline: none;
}

.search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #95a5a6;
  pointer-events: none;
}

.search-icon svg {
  width: 16px;
  height: 16px;
}

.frontend-filter-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  background: #fff;
  color: #2c3e50;
  transition: border-color 0.2s ease;
  cursor: pointer;
  height: 40px;
  box-sizing: border-box;
}

.frontend-filter-select:focus {
  border-color: #3498db;
  outline: none;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.frontend-clear-btn {
  background: #6c757d;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.frontend-clear-btn:hover {
  background: #5a6268;
}

/* KOMPAKTNE DOKUMENDID GRID */
.documents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 20px;
}

/* DOKUMENDI KAART - KOMPAKTNE */
.document-card {
  background: #fff;
  border: 1px solid #e1e5e9;
  border-radius: 6px;
  transition: all 0.2s ease;
  overflow: hidden;
  animation: slideInUp 0.4s ease-out;
  animation-fill-mode: both;
}

.document-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-color: #3498db;
}

.document-card.hidden {
  display: none !important;
}

/* DOKUMENDI LINK */
.document-link {
  display: block;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.document-link:hover {
  text-decoration: none;
  color: inherit;
}

/* DOKUMENDI SISU */
.document-content {
  padding: 12px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* DOKUMENDI HEADER - IKOON + PEALKIRI */
.document-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

/* DOKUMENDI IKOON - MUSTVALGE */
.document-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: #495057;
}

.document-icon svg {
  width: 100%;
  height: 100%;
  stroke-width: 2;
}

/* DOKUMENDI PEALKIRI */
.document-title {
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
  margin: 0;
  line-height: 1.3;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* DOKUMENDI KIRJELDUS */
.document-description {
  font-size: 12px;
  color: #6c757d;
  margin: 4px 0 8px 0;
  line-height: 1.3;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* KATEGOORIA BADGE */
.document-category-badge {
  margin-top: auto;
}

.category-tag {
  background: #f1f3f4;
  color: #5f6368;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 500;
  border: 1px solid #e8eaed;
}

/* NO RESULTS */
.no-results {
  text-align: center;
  padding: 40px 20px;
  color: #6c757d;
}

.no-results-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.no-results h3 {
  font-size: 18px;
  color: #495057;
  margin-bottom: 6px;
}

.no-results p {
  font-size: 13px;
  margin-bottom: 16px;
}

.no-results-btn {
  background: #6c757d;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background-color 0.3s ease;
}

.no-results-btn:hover {
  background: #5a6268;
}

/* HOVER EFEKTID */
.document-card:hover .document-icon {
  color: #3498db;
  transform: scale(1.1);
  transition: all 0.2s ease;
}

.document-card:hover .document-title {
  color: #3498db;
}

/* ANIMATSIOONID */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* LOAD MORE NUPP STIILID - LIHTNE MUST TEKST */
.documents-load-more {
  text-align: center;
  margin-top: 2rem;
  padding: 1.5rem 0;
}

.load-more-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  background: transparent !important;
  color: #333 !important;
  text-decoration: none !important;
  border: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  cursor: pointer;
  box-shadow: none !important;
}

.load-more-btn:hover {
  background: transparent !important;
  color: #666 !important;
  text-decoration: underline !important;
  transform: none;
  box-shadow: none !important;
}

.load-more-btn:active {
  transform: none;
}

.load-more-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.load-more-btn:hover svg {
  transform: translateY(2px);
}

.load-more-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.load-more-btn.loading .load-text {
  opacity: 0.7;
}

.load-more-btn .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(51,51,51,0.3);
  border-top: 2px solid #333;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: none;
}

.load-more-btn.loading .spinner {
  display: block;
}

.load-text {
  line-height: 1;
}

/* NUPPUDE ALA */
.documents-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  padding: 1.5rem 0;
}

.documents-load-more,
.documents-view-all {
  text-align: center;
}

/* VAATA KÕIKI NUPP - SÄILITAB TAUSTA */
.view-all-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white !important;
  text-decoration: none !important;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  border: none;
}

.view-all-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  color: white !important;
  text-decoration: none !important;
}

.view-all-btn:active {
  transform: translateY(0);
}

.view-all-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.view-all-btn:hover svg {
  transform: translateX(2px);
}

/* FILE UPLOAD METHODS */
.file-upload-methods {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.file-upload-btn,
.media-library-btn {
  background: #007cba;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: background-color 0.2s;
  flex: 1;
}

.file-upload-btn:hover {
  background: #005a87;
}

.media-library-btn {
  background: #6c757d;
}

.media-library-btn:hover {
  background: #5a6268;
}

.file-upload-input {
  display: none !important;
}

/* UPLOAD PROGRESS */
.upload-progress {
  margin-top: 10px;
  padding: 10px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  display: none;
}

.upload-progress.active {
  display: block;
}

.progress-bar {
  width: 100%;
  height: 20px;
  background: #e9ecef;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(45deg, #28a745, #20c997);
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 12px;
  color: #6c757d;
  text-align: center;
}

/* DOKUMENDILEHE SPETSIIFILISED STIILID */
.documents-archive-page {
  margin: 0;
  padding: 0;
}

.documents-archive-main {
  min-height: 100vh;
  padding: 2rem 0;
}

.documents-breadcrumb {
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #6b7280;
}

.documents-breadcrumb a {
  color: #3b82f6;
  text-decoration: none;
}

.documents-breadcrumb a:hover {
  text-decoration: underline;
}

.documents-archive-page .page-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 2rem;
  text-align: center;
}

/* Veendu, et dokumendilehel ei ole duplitseeritud stiilide konflikte */
.documents-archive-page .site-header,
.documents-archive-page .site-footer {
  /* Plugin'i päis ja jalus */
}

/* Peida WordPressi admin bar dokumendilehel */
.documents-archive-page #wpadminbar {
  display: none !important;
}

.documents-archive-page body {
  margin-top: 0 !important;
}

/* RESPONSIVE */
@media (max-width: 1200px) {
  .documents-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
  }
}

@media (max-width: 1024px) {
  .frontend-controls-row {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .frontend-clear-btn {
    grid-column: span 2;
    justify-self: center;
    width: fit-content;
  }
}

@media (max-width: 768px) {
  .lhk-documents-section {
    padding: 30px 0;
  }

  .section-title {
    font-size: 1.9rem;
  }

  .documents-frontend-controls {
    padding: 15px;
  }

  .frontend-controls-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .frontend-clear-btn {
    grid-column: span 1;
    width: 100%;
  }

  .controls-header {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

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

  .document-content {
    padding: 10px;
  }

  .document-title {
    font-size: 13px;
  }

  .document-description {
    font-size: 11px;
    -webkit-line-clamp: 1;
  }

  .category-tag {
    font-size: 9px;
    padding: 1px 4px;
  }

  .documents-actions {
    gap: 0.75rem;
  }

  .load-more-btn {
    font-size: 0.9rem;
  }

  .view-all-btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .lhk-documents-section .container {
    padding: 0 15px;
  }

  .section-title {
    font-size: 1.7rem;
  }

  .documents-frontend-controls {
    padding: 12px;
  }

  .documents-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }

  .document-header {
    gap: 6px;
  }

  .document-icon {
    width: 16px;
    height: 16px;
  }

  .document-title {
    font-size: 12px;
  }
}

/* Veendu, et nupud on alati nähtavad */
.documents-load-more,
.documents-view-all {
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
}
