/* Globális alapbeállítások */
html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

body {
  background-image: url("/img/bg.webp");
  background-size: cover;
  background-attachment: fixed;
}

/* Megakadályozza a háttérben lévő oldal görgetését, ha egy elem aktív */
body.no-scroll {
    overflow: hidden;
}

/* Szöveges elemek és tipográfia */
h1, h2, h3 {
  font-family: 'Playfair Display', Georgia, "Times New Roman", serif;
  letter-spacing: 1px;
  line-height: 2em;
  margin: 0;
  text-align: center;
}

a {
  text-decoration: none;
  color: inherit;
  display: block;
}

#toggleUploadBtn {
  display: block;
  margin: 20px auto;
  padding: 10px 20px;
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s ease;
}

#toggleUploadBtn:hover {
  background-color: #218838;
}

#uploadBtn {
  margin-top: 15px;
  padding: 10px 20px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s ease;
}

#uploadBtn:hover {
  background-color: #0056b3;
}

.filter-btn-container {
  text-align: center;
  margin-bottom: 20px;
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.filter-btn {
  background-color: #555;
  color: white;
  padding: 8px 15px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  white-space: nowrap;
}

.filter-btn:hover {
  background-color: #777;
}

.filter-btn.active {
  background-color: #007bff;
}

#randomImageBtn {
  background-color: #ff9800;
  margin-left: 0;
}

#randomImageBtn:hover {
  background-color: #e68900;
}

/* Képgaléria elrendezés */
/* Galéria konténer */
#galleryContainer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  margin-top: 30px;
  justify-items: center;
  padding: 0 15px;
}

/* Kártya-stílus a képeknek */
.image-item {
  background: rgba(30,30,30,0.4);       /* üveg hatás */
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 15px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.image-item.hidden-for-public {
  border: 2px solid red;
  opacity: 0.8;
  background-color: #ffe0e0;
}

.image-item.hidden-for-public .admin-label {
  color: red;
  font-weight: bold;
  margin-bottom: 10px;
}

.image-item:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 12px 30px rgba(0,0,0,0.5);
}

/* Képkeret */
.image-frame {
  width: 100%;
  height: 250px;
  overflow: hidden;
  border-radius: 15px;
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Képek */
img.thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.4s ease;
}

img.thumbnail:hover {
  transform: scale(1.05);
}

/* Képaláírás */
.image-item h3 {
  margin-top: 10px;
  font-size: 1.1em;
  font-weight: 600;
  color: #fff;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* Képcímek formázása */
.image-item h3 {
  margin-top: 10px;
  color: #fff;
  font-size: 1.1em;
  width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: normal;
  max-height: 2.2em;
  line-height: 1.1em;
  box-sizing: border-box;
}

.upload-time {
  font-size: 0.9em;
  color: #ccc;
  margin-top: 4px;
  margin-bottom: 10px;
}

/* Komment szekció */
.comments-section {
  width: 100%;
  text-align: left;
  margin-top: 15px;
  box-sizing: border-box;
}

.comments-list {
  max-height: 150px;
  overflow-y: auto;
  margin-bottom: 10px;
  padding-right: 5px;
  box-sizing: border-box;
  width: 100%;
}

.comments-list p {
  background: #2e2e2e;
  padding: 5px 10px;
  border-radius: 6px;
  margin-bottom: 5px;
  color: #eee;
  font-size: 14px;
  word-wrap: break-word;
  box-sizing: border-box;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  box-sizing: border-box;
  width: 100%;
}

.comment-form input[type="text"],
.comment-form textarea {
  padding: 6px 10px;
  border-radius: 6px;
  border: none;
  font-size: 14px;
  background-color: #444;
  color: #eee;
  width: 100%;
  box-sizing: border-box;
}

.comment-form button {
  background-color: #4caf50;
  border: none;
  color: white;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s ease;
  box-sizing: border-box;
}

.comment-form button:hover {
  background-color: #45a049;
}

/* Képfeltöltő konténer - MODERN (Javítva) */
#uploadSection {
    background: rgba(30, 30, 30, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.05);

    /* Animációhoz szükséges átmenetek */
    transition: opacity 0.5s ease, transform 0.5s ease;
    
    /* Alapértelmezett, elrejtett állapot, animációhoz */
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none; /* A lényeg! A kattintás nem működik, ha rejtett */
    position: fixed; /* Ez segít a többi tartalom fölé emelni */
    top: 130px; /* Vagy ami neked szimpatikus */
    left: 50%;
    transform: translateX(-50%) translateY(-20px); /* A középre helyezéshez */
    
    /* Megtartott alapstílusok */
    max-width: 500px;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    box-sizing: border-box;
}

/* A feltöltő konténer látható állapota (JavaScripttel adja hozzá) */
#uploadSection.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto; /* Újra engedélyezi a kattintást */
}

/* Drop terület - MODERN (Változatlan, ha megfelel) */
#dropArea {
    border: 2px solid #007bff;
    background-color: rgba(0, 123, 255, 0.1);
    color: #a0c4ff;
    cursor: pointer;
    transition: all 0.4s ease;
    padding: 20px;
    text-align: center;
    margin-bottom: 15px;
    border-radius: 12px;
    box-sizing: border-box;
}

/* Hover és drag & drop kiemelés */
#dropArea.highlight,
#dropArea:hover {
    background-color: rgba(0, 123, 255, 0.3);
    border-color: #3498db;
}

/* Feltöltési üzenet */
#uploadMessage {
    margin-top: 15px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

/* Képnéző panel - Modernizált */
#imageViewer {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95); /* Kicsit sötétebb háttér */
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 999;
  padding: 0;
  box-sizing: border-box;
  justify-content: center;
  align-items: center;
}

#viewerContent {
  display: flex;
  width: 95%; /* Nagyobb szélesség */
  max-width: 1500px;
  max-height: 95vh;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.18);
  overflow: hidden; /* Ez a legfontosabb: megszünteti a fő konténer görgetését */
}

#leftPanel {
  flex: 3; /* A bal panel legyen szélesebb */
  display: flex;
  flex-direction: column;
  padding: 2rem;
  align-items: center;
  overflow-y: auto; /* A bal panel kaphat görgetést, ha a képek túl sokak */
}

#rightPanel {
  flex: 1; /* A jobb panel szűkebb */
  background: rgba(0, 0, 0, 0.2);
  padding: 2rem;
  overflow-y: auto; /* A jobb panel görgetése a kommenteknek */
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 5px 0 10px rgba(0,0,0,0.1);
  min-width: 350px; /* Alap minimum szélesség */
}

/* Kép konténer */
#mainImageContainer {
  width: 100%;
  max-width: 800px;
  text-align: center;
  flex-shrink: 0;
}

#mainImage {
  max-width: 100%;
  max-height: 70vh; /* Nagyobb képek is elférnek, de nem lógnak ki */
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 15px;
  object-fit: contain;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease;
}

#imageTitle {
  margin-top: 1rem;
  font-size: 1.5em;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

#relatedImagesContainer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 15px;
  width: 100%;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#relatedImagesContainer img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#relatedImagesContainer img:hover {
  transform: scale(1.05);
  border-color: #3498db;
  box-shadow: 0 6px 20px rgba(52, 152, 219, 0.5);
}

/* Bezárás gomb stílusa */
#closeViewer {
    /* Pozíció és rétegezés megtartása */
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    
    /* Gomb stílusok hozzáadása */
    background-color: #555;
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

/* Hover effekt a gombhoz */
#closeViewer:hover {
    background-color: #777;
}

/* Komment szekció stílusa a viewerben */
#commentsSectionViewer {
  color: #fff;
}

#commentsSectionViewer .comments-list {
  max-height: none; /* A konténer görgetése miatt felesleges */
  overflow-y: visible;
  padding-right: 0;
}

#commentsSectionViewer .comments-list p {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

#commentsSectionViewer .comment-form input,
#commentsSectionViewer .comment-form textarea {
  background-color: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
}

@media (max-width: 1000px) {
    #viewerContent {
        flex-direction: column; /* Mobil nézetben oszlopba rendeződik */
        overflow-y: auto; /* A fő konténer görgethetővé válik */
        max-height: 95vh;
    }
    #leftPanel, #rightPanel {
        width: 100%;
        max-height: none;
        overflow-y: visible;
    }
    #rightPanel {
        margin-top: 2rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-left: none;
    }
}

/* Lightbox */
#lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  justify-content: center;
  align-items: center;
}

#lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  box-shadow: 0 0 15px black;
  cursor: pointer;
}

/* Globális komment popup */
#globalCommentPopup {
  display: none;
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  max-height: 600px;
  overflow-y: auto;
  background: white;
  padding: 20px;
  border: 2px solid #007bff;
  z-index: 9999;
  color: black;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
  box-sizing: border-box;
}

/* Kiemelt link buborékok */
.featured-link-section {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-top: 40px;
  padding: 0 15px;
}

.bubble-desc {
  max-width: 90%; /* link-bubble2-ben 570px */
  margin: 5px auto 10px auto; /* link-bubble2-ben 8px auto 20px auto */
  color: #a0c4ff;
  font-size: 0.8em; /* link-bubble2-ben 0.9em */
  text-align: center;
  font-style: italic;
  user-select: none;
}

/* Kisebb képernyőkre (mobilok) */
@media (max-width: 768px) {

  /* Képgaléria konténer */
  #galleryContainer {
    grid-template-columns: 1fr;
    gap: 25px;
    padding: 0 10px;
  }

  .image-item {
    max-width: 100%;
    padding: 15px;
  }

  .image-frame {
    height: 200px;
  }

  .image-item h3 {
    font-size: 1em;
    max-height: none;
    white-space: normal;
  }

  .upload-time {
    font-size: 0.8em;
  }

  /* Komment szekció */
  .comments-section {
    width: 100%;
    padding: 0;
  }

  .comments-list {
    max-height: 120px;
    font-size: 13px;
    width: 100%;
    padding-right: 0;
  }

  .comments-list p {
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
  }

  .comment-form,
  .chat-input {
    flex-direction: column;
    width: 100%;
  }

  .comment-form input,
  .comment-form button,
  .chat-input input,
  .chat-input button {
    width: 100%;
  }

  .comment-form input[type="text"],
  .comment-form textarea {
    font-size: 13px;
    padding: 7px 10px;
  }

  /* Admin vezérlők */
  .admin-controls {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
  }

  .admin-controls button {
    width: auto;
    margin: 5px;
    white-space: nowrap;
  }

  .comment-admin-controls {
    display: block;
    margin-top: 5px;
    text-align: center;
  }

  .comment-admin-controls button {
    margin: 3px 5px;
    width: auto;
  }

  /* Feltöltési szekció */
  #uploadSection {
    margin: 30px auto 20px auto;
    padding: 20px;
    max-width: 95%;
  }

  #toggleUploadBtn {
    font-size: 14px;
    padding: 8px 15px;
  }

  #imageSearch { /* Ennek a szelektorra nem volt definíció fent, feltételezem, hogy egy input mező */
    width: calc(100% - 20px);
    margin-left: 10px;
    margin-right: 10px;
  }

  /* Lightbox */
  #lightbox-img {
    max-width: 95vw;
    max-height: 80vh;
  }

  /* Globális komment popup */
  #globalCommentPopup {
    width: 95%;
    top: 30px;
    max-height: 85vh;
    padding: 15px;
  }