/* TEATED SEKTSIOON - Frontend */

/* === CONTAINER JA LAYOUT === */
.lhk-content-sections {
  display: grid !important;
  grid-template-columns: 1fr 300px !important;
  gap: 2rem !important;
  align-items: stretch !important;
  margin: 55px 0 2rem 0 !important;
  padding: 2rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 30%, #e2e8f0 70%, #f8fafc 100%);
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Sektsioonid - sama kõrgus */
.lhk-notices,
.lhk-quick-links {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  min-height: 400px !important;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
  position: relative;
}

/* Sisu võtab kogu vaba ruumi */
.lhk-notices__inner,
.lhk-quick-links__grid {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
}

/* === SEKTSIOONI PEALKIRI === */
.section-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 24px 0;
  color: #111827;
}

.lhk-notices .section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #111827;
}

/* === TEATED SISU === */
.lhk-notices__inner {
  display: flex;
  flex-direction: column;
  gap: 0.5rem; /* VÄIKSEM GAP */
}

/* EEMALDAME KÕIK ÜLELIIGSE RUUMI - AGGRESSIIVSELT */
.lhk-notices__inner p,
.lhk-notices__inner br,
.lhk-notices p,
.lhk-notices br,
.notice-card p,
.notice-card br,
.notice-link p,
.notice-link br,
.notice-content p,
.notice-content br {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  height: 0 !important;
  line-height: 0 !important;
}

/* === TEATE KAART === */
.notice-card {
  display: block !important;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  transition: all 0.15s ease;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin: 0 !important; /* EEMALDAME MARGIN */
}

.notice-card:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
  text-decoration: none;
  transform: translateY(-2px);
}

/* === TEATE LINK === */
.notice-link {
  display: flex !important;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem; /* VÄIKSEM PADDING */
  color: inherit;
  text-decoration: none;
  min-height: 60px; /* VÄIKSEM MIN-KÕRGUS */
  margin: 0 !important; /* EEMALDAME MARGIN */
}

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

/* === TUNNUSPILT - SUUREM === */
.notice-thumb {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.notice-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.notice-card:hover .notice-thumb img {
  transform: scale(1.05);
}

.notice-thumb:empty::before {
  content: "📄";
  font-size: 1.5rem;
  opacity: 0.4;
}

/* === TEATE SISU === */
.notice-content {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 !important; /* EEMALDAME MARGIN */
  padding: 0 !important; /* EEMALDAME PADDING */
}

.notice-date {
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 500;
  white-space: nowrap;
  min-width: 70px;
  display: flex !important;
  align-items: center;
  gap: 0.25rem;
  margin: 0 !important;
  padding: 0 !important;
}

.date-icon {
  color: #9ca3af;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.notice-title {
  font-weight: 600;
  color: #1f2937;
  line-height: 1.3;
  flex: 1;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 !important;
  padding: 0 !important;
}

/* === GRID LAYOUT === */
.layout-grid .lhk-notices__inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.5rem; /* VÄIKSEM GAP */
}

.layout-grid .notice-link {
  flex-direction: row !important;
  align-items: center;
  text-align: left;
  padding: 0.75rem; /* VÄIKSEM PADDING */
  min-height: 60px; /* VÄIKSEM MIN-KÕRGUS */
}

.layout-grid .notice-thumb {
  width: 60px;
  height: 60px;
}

.layout-grid .notice-content {
  flex-direction: row;
  align-items: center;
  text-align: left;
}

.layout-grid .notice-title {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* === LOAD MORE NUPP === */
.lhk-notices__load-more {
  margin-top: 1rem; /* VÄIKSEM MARGIN */
  text-align: center;
}

.lhk-load-more-btn {
  background: #2563eb;
  color: #fff;
  border: 1px solid #2563eb;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.lhk-load-more-btn:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

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

.lhk-load-more-btn .btn-loader {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.lhk-load-more-btn .icon.spin {
  animation: spin 1s linear infinite;
}

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

/* === MODAL - ÜLILÄGEMALZ-INDEX JA HEADER KOMPENSATSIOON === */
.lhk-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999999 !important; /* KÕRGEIM Z-INDEX */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  /* KOMPENSEERIME ADMIN BAR */
  padding-top: calc(1rem + 46px); /* Admin bar kõrgus + padding */
}

/* Admin bar olemas - desktopi z-index */
.admin-bar .lhk-modal {
  z-index: 100002 !important; /* ÜLE ADMIN BAR (100001) */
  padding-top: calc(1rem + 32px); /* Admin bar desktop kõrgus */
}

/* Sticky header kompensatsioon */
body.admin-bar .lhk-modal {
  padding-top: calc(1rem + 32px + 124px); /* Admin bar + header kõrgus */
}

.lhk-modal[hidden] {
  display: none;
}

.lhk-modal__backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  cursor: pointer;
  z-index: 999998;
}

.lhk-modal__dialog {
  position: relative;
  background: white;
  border-radius: 12px;
  max-width: 900px;
  width: 100%;
  max-height: calc(90vh - 200px); /* VÄHENDA KÕRGUST HEADER JAOKS */
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  z-index: 999999 !important;
  margin-top: auto;
  margin-bottom: auto;
}

.lhk-modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(0,0,0,0.1);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 24px;
  z-index: 1000000 !important;
  transition: background-color 0.2s ease;
  font-weight: bold;
  color: #666;
}

.lhk-modal__close:hover {
  background: rgba(0,0,0,0.2);
  color: #333;
}

.lhk-modal__content {
  padding: 2rem;
}

.lhk-modal__loader {
  width: 48px;
  height: 48px;
  margin: 40px auto;
  border-radius: 50%;
  border: 4px solid #e5e7eb;
  border-top-color: #2563eb;
  animation: lhkspin 1s linear infinite;
}

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

/* === ÜKSIKU TEATE SISU MODALIS === */
.notice-single {
  max-width: none;
}

.notice-single__head {
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 1rem;
}

.notice-single .date.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #f3f4f6;
  color: #6b7280;
  padding: 0.5rem 0.75rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.notice-single__title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
  line-height: 1.3;
}

/* TUNNUSPILT MODALIS - EI KUVA */
.notice-single__thumb {
  display: none !important;
}

.notice-single__content {
  font-size: 1rem;
  line-height: 1.7;
  color: #374151;
}

.notice-single__content h1,
.notice-single__content h2,
.notice-single__content h3,
.notice-single__content h4,
.notice-single__content h5,
.notice-single__content h6 {
  color: #111827;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.notice-single__content p {
  margin-bottom: 1rem;
}

.notice-single__content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1rem 0;
}

/* GALERII TUGI MODALIS */
.notice-single__content .wp-block-gallery,
.notice-single__content .gallery {
  margin: 1.5rem 0;
}

.notice-single__content .wp-block-gallery .wp-block-image,
.notice-single__content .gallery-item {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.notice-single__content .wp-block-gallery .wp-block-image:hover,
.notice-single__content .gallery-item:hover {
  transform: scale(1.02);
}

/* === RESPONSIVE === */
@media (max-width: 782px) {
  /* Admin bar mobile kõrgus */
  .admin-bar .lhk-modal {
    padding-top: calc(1rem + 46px); /* Admin bar mobile kõrgus */
  }

  body.admin-bar .lhk-modal {
    padding-top: calc(1rem + 46px + 104px); /* Admin bar mobile + header mobile */
  }
}

@media (max-width: 768px) {
  .lhk-content-sections {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
    padding: 1.5rem;
  }

  .lhk-notices,
  .lhk-quick-links {
    min-height: auto !important;
    padding: 1rem;
  }

  .notice-link {
    padding: 0.6rem; /* VÄIKSEM PADDING */
    gap: 0.6rem;
    min-height: 50px; /* VÄIKSEM MIN-KÕRGUS */
  }

  .notice-thumb {
    width: 50px; /* VÄIKSEM MOBIILIS */
    height: 50px; /* VÄIKSEM MOBIILIS */
  }

  .notice-title {
    font-size: 0.9rem;
  }

  .notice-date {
    font-size: 0.75rem;
    min-width: 60px;
  }

  .date-icon {
    width: 12px;
    height: 12px;
  }

  .layout-grid .lhk-notices__inner {
    grid-template-columns: 1fr;
    gap: 0.5rem; /* VÄIKSEM GAP */
  }

  .lhk-modal {
    padding: 0.5rem;
    padding-top: calc(0.5rem + 104px); /* Mobile header kõrgus */
  }

  .lhk-modal__dialog {
    max-width: 95vw;
    margin: 0;
    max-height: calc(100vh - 150px); /* ROHKEM RUUMI MOBILE HEADER JAOKS */
  }

  .lhk-modal__content {
    padding: 1.5rem;
  }

  .notice-single__title {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .lhk-content-sections {
    padding: 1rem;
  }

  .lhk-notices__inner {
    gap: 0.25rem; /* VEEL VÄIKSEM GAP */
  }

  .notice-link {
    padding: 0.5rem; /* VEEL VÄIKSEM PADDING */
    min-height: 45px; /* VEEL VÄIKSEM */
  }

  .notice-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem; /* VÄIKSEM GAP */
  }

  .notice-date {
    min-width: auto;
    order: -1;
    display: flex;
    align-items: center;
    gap: 0.25rem;
  }

  .notice-title {
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
  }

  .lhk-modal {
    padding: 0.25rem;
    padding-top: calc(0.25rem + 94px); /* Väike mobile header */
  }

  .lhk-modal__dialog {
    max-height: calc(100vh - 120px);
  }

  .lhk-modal__content {
    padding: 1rem;
  }

  .notice-single__title {
    font-size: 1.25rem;
  }
}

/* === SCROLL LUKUSTAMINE MODAL AVAMISEL === */
body.lhk-modal-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
}

/* === PRINTIMINE === */
@media print {
  .lhk-modal,
  .lhk-load-more-btn {
    display: none !important;
  }

  .lhk-notices {
    border: none;
    box-shadow: none;
    background: white !important;
  }

  .notice-card {
    break-inside: avoid;
    border: 1px solid #ccc;
  }
}
