/* Základní proměnné – výchozí (světlý režim) */
:root {
  --main-bg-light: #ffffff;
  --main-text-light: #000000;
  --header-bg-light: #3c763c;
  --button-bg-light: #3c763c;
  --button-hover-light: #336633;
  
  --transition-duration: 0.3s;
}

/* Tmavý režim – aplikujte přidáním třídy "dark" na body */
body.dark {
  /* Přepis základních proměnných pro tmavý režim */
  --main-bg-light: #181819;
  --main-text-light: #ffffff;
  --header-bg-light: #202020;
  --button-bg-light: #202020;
  --button-hover-light: #303030;
}

/* Alternativní modrá verze – přidáním třídy "blue" na body */
body.blue {
  --main-bg-light: #e0f7fa;
  --main-text-light: #006064;
  --header-bg-light: #00796b;
  --button-bg-light: #00796b;
  --button-hover-light: #004d40;
}

/* Alternativní červená verze – přidáním třídy "red" na body */
body.red {
  --main-bg-light: #ffebee;
  --main-text-light: #b71c1c;
  --header-bg-light: #d32f2f;
  --button-bg-light: #d32f2f;
  --button-hover-light: #c62828;
}

/* Základní styly */
body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background-color: var(--main-bg-light);
  color: var(--main-text-light);
  transition: background-color var(--transition-duration), color var(--transition-duration);
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background-color: var(--header-bg-light);
  transition: background-color var(--transition-duration);
  position: fixed;
  width: 100%;
  box-sizing: border-box;
  z-index: 1000;
  height: 64px;
}
header h1 {
  margin: 0;
  font-size: 1.5rem;
  color: #ffffff;
}
header p {
  color: #ffffff;
}
nav {
  display: flex;
  gap: 0.5rem;
}
.nav-link {
  background-color: var(--button-bg-light);
  color: #ffffff;
  border: none;
  padding: 0.25rem 0.5rem;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color var(--transition-duration), color var(--transition-duration);
}
.nav-link:hover {
  background-color: var(--button-hover-light);
}
button#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  color: #ffffff;
  transition: color var(--transition-duration);
}

/* Main */
main {
  max-width: 60%;
  margin: 0 auto;
  padding: 2rem;
  padding-top: 84px;
  min-height: calc(100vh - 120px);
}

/* Footer */
footer {
  text-align: center;
  padding: 1rem 0;
  background-color: var(--header-bg-light);
  transition: background-color var(--transition-duration);
  width: 100%;
  color: #ffffff;
}

/* Grafy a karty */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.graph {
  background: var(--main-bg-light);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 30px;
  max-width: 10000px;
  width: 150%;
  transition: background-color var(--transition-duration);
}
body.dark .graph {
  background: var(--main-bg-light);
  /* Pokud chcete změnit i grafy, upravte zde */
}

/* Titulky a canvas */
h2 {
  text-align: center;
  margin-bottom: 1rem;
}
canvas {
  max-width: 100%;
}

/* Karty prokliků */
.card-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-top: 50px;
}
.card {
  background-color: var(--main-bg-light);
  color: var(--main-text-light);
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  padding: 40px;
  width: 300px;
  height: 200px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background-color var(--transition-duration);
}
.card:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  background-color: var(--button-hover-light);
  color: #ffffff;
}
body.dark .card {
  background-color: var(--main-bg-light);
  color: var(--main-text-light);
  /* Úprava pro dark theme, případně změňte */
}
body.dark .card:hover {
  background-color: var(--button-hover-light);
  color: #ffffff;
}

/* Panel pohlednic */
.postcard {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-top: 12px;
  margin-bottom: 24px;
  padding: 16px;
  border-radius: 8px;
  background-color: var(--main-bg-light);
  border: 1px solid #ccc;
  transition: background-color var(--transition-duration), border-color var(--transition-duration);
  width: 100%;
  box-sizing: border-box;
}
body.dark .postcard {
  background-color: var(--main-bg-light);
  border-color: #444;
}
.postcard-image img {
  max-width: 150px;
  height: auto;
  border-radius: 8px;
}
.postcard-info {
  flex: 1;
}
.postcard-info h2 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--main-text-light);
}
body.dark .postcard-info h2 {
  color: var(--main-text-light);
}
.postcard-info p {
  margin: 0;
  font-size: 14px;
  color: var(--main-text-light);
}
body.dark .postcard-info p {
  color: var(--main-text-light);
}

/* Tlačítka na pohlednicích */
.postcard-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px;
}
.ownership-toggle, .wishlist-toggle, .info-button {
  background: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.3s ease;
  padding: 0;
  line-height: 1;
}
.ownership-toggle {
  border: 2px solid #4CAF50;
  color: #4CAF50;
}
.ownership-toggle.owned {
  background-color: #4CAF50;
  color: var(--main-bg-light);
}
.ownership-toggle:hover {
  transform: scale(1.1);
  background-color: #4CAF50;
  color: var(--main-bg-light);
}
.wishlist-toggle {
  border: 2px solid #FFD700;
  color: #FFD700;
  font-size: 20px;
}
.wishlist-toggle.wishlisted {
  background-color: #FFD700;
  color: var(--main-bg-light);
}
.wishlist-toggle:hover {
  transform: scale(1.1);
  background-color: #FFD700;
  color: var(--main-bg-light);
}
.info-button {
  border: 2px solid #007bff;
  color: #007bff;
  font-weight: bold;
}
.info-button:hover {
  transform: scale(1.1);
  background-color: #007bff;
  color: var(--main-bg-light);
}
.close-modal:hover {
  transform: scale(1.1);
  background-color: #ff0000;
  color: var(--main-bg-light);
}
body.dark .ownership-toggle {
  border-color: #4CAF50;
  color: #4CAF50;
}
body.dark .ownership-toggle.owned {
  color: var(--main-bg-light);
}
body.dark .ownership-toggle:hover {
  color: var(--main-bg-light);
}
body.dark .wishlist-toggle {
  border-color: #FFD700;
  color: #FFD700;
}
body.dark .wishlist-toggle.wishlisted {
  color: var(--main-bg-light);
}
body.dark .wishlist-toggle:hover {
  color: var(--main-bg-light);
}
body.dark .info-button {
  border-color: #007bff;
  color: #007bff;
}
body.dark .info-button:hover {
  color: var(--main-bg-light);
}
body.dark .close-modal {
  color: #ff5555;
}
body.dark .close-modal:hover {
  background-color: #ff0000;
  color: var(--main-bg-light);
}
.close-modal {
  background: none;
  border: 2px solid #ff0000;
  color: #ff0000;
  font-size: 20px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

/* Modální okno */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.8);
  align-items: center;
  justify-content: center;
}
.modal-content {
  background: var(--main-bg-light) !important;
  color: var(--main-text-light) !important;
  padding: 20px;
  border-radius: 10px;
  width: 90%;
  max-width: 400px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.modal-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 10px auto;
  border-radius: 8px;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
body.dark .modal-content {
  background: var(--main-bg-light) !important;
  color: var(--main-text-light) !important;
}

/* Vyhledávací formulář mimo header */
.search-form {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 1rem 0;
}
@media screen and (min-width: 769px) {
  .search-form {
    justify-content: flex-start;
  }
}
.search-form input[type="text"] {
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  width: 250px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.search-form input[type="text"]:focus {
  outline: none;
  border-color: #336633;
  box-shadow: 0 0 5px rgba(51, 102, 51, 0.5);
}
.search-form button {
  background-color: #3c763c;
  color: #ffffff;
  border: none;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}
.search-form button:hover {
  background-color: #336633;
}
body.dark .search-form input[type="text"] {
  background-color: var(--main-bg-dark);
  color: var(--main-text-dark);
  border: 1px solid #444;
}
body.dark .search-form button {
  background-color: var(--button-bg-dark);
  color: var(--main-text-dark);
}
body.dark .search-form button:hover {
  background-color: var(--button-hover-dark);
}

/* Filtrační tlačítka */
.filter-buttons {
  text-align: left;
  margin-bottom: 1rem;
}
.filter-button {
  display: inline-block;
  padding: 0.5rem 1rem;
  margin-right: 10px;
  text-decoration: none;
  color: var(--main-text-light);
  background: none;
  border: 1px solid transparent;
  transition: border-color 0.3s ease;
}
.filter-button:hover {
  border-color: var(--button-hover-light);
}
.filter-button.selected {
  border-color: var(--button-bg-light);
}
body.dark .filter-button {
  color: var(--main-text-dark);
}
body.dark .filter-button:hover {
  border-color: var(--button-hover-dark);
}
body.dark .filter-button.selected {
  border-color: var(--button-bg-dark);
}

/* Stránkovací odkazy – šipky */
.pagination {
  text-align: center;
  margin-top: 20px;
}
.pagination a {
  display: inline-block;
  padding: 8px 12px;
  background-color: var(--header-bg-light);
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  margin: 0 5px;
  transition: background-color 0.3s ease;
}
.pagination a:hover {
  background-color: var(--button-hover-light);
}
.pagination span {
  margin: 0 10px;
  font-size: 1rem;
}

/* Administrátorské prostředí – tabulka */
.admin-container {
  display: flex;
  gap: 20px;
  max-width: 1000px;
  margin: 0 auto;
}
.left-column, .right-column {
  flex: 1;
  min-width: 300px;
}
.add-form {
  background: #f7f7f7;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}
.add-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: bold;
}
.add-form input[type="text"],
.add-form input[type="number"],
.add-form textarea {
  width: 100%;
  padding: 8px;
  margin-bottom: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}
.add-form input[type="file"] {
  margin-bottom: 12px;
}
.add-form input[type="submit"] {
  background: var(--header-bg-light);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
}
.add-form input[type="submit"]:hover {
  background: var(--button-hover-light);
}
.search-form {
  text-align: center;
  margin-bottom: 20px;
}
.search-form input[type="text"] {
  width: 300px;
  padding: 6px;
}
.search-form button {
  padding: 6px 12px;
  background: var(--header-bg-light);
  color: #fff;
  border: none;
  cursor: pointer;
}
.search-form button:hover {
  background: var(--button-hover-light);
}
table {
  width: 100%;
  border-collapse: collapse;
}
colgroup col:nth-child(1),
colgroup col:nth-child(2),
colgroup col:nth-child(4),
colgroup col:nth-child(5) {
  width: auto;
}
colgroup col:nth-child(3) {
  width: 200px;
}
colgroup col:nth-child(6) {
  width: 100px;
}
table th, table td {
  border: 1px solid #ccc;
  padding: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
table th {
  background: #f7f7f7;
}
.delete-link {
  color: red;
  text-decoration: none;
}
/* Popis – fixní šířka */
.desc-cell {
  width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.desc-cell.expanded {
  white-space: normal;
}

/* Responzivní úpravy pro mobil */
@media screen and (max-width: 768px) {
  main {
    max-width: 100%;
    padding: 1rem;
    padding-top: 74px;
  }
  .ownership-toggle, .wishlist-toggle, .info-button, .close-modal {
    width: 50px;
    height: 50px;
    font-size: 26px;
  }
  .postcard-info p {
    display: none;
  }
  .postcard {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .postcard-image img {
    max-width: 100%;
    width: auto;
  }
  .postcard-actions {
    justify-content: center;
    padding-top: 15px;
  }
  header {
    padding: 1rem;
  }
  header h1 {
    font-size: 1.2rem;
  }
}

/* Přihlašovací / registrační panel */

.auth-panel {
  max-width: 400px;
  margin: 80px auto;
  padding: 30px;
  background: var(--main-bg-light);
  color: var(--main-text-light);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  text-align: center;
}

.auth-panel h2 {
  margin-bottom: 20px;
  font-size: 1.6rem;
  font-weight: bold;
}

.auth-panel form input {
  width: 100%;
  padding: 10px;
  margin: 10px 0;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 1rem;
  box-sizing: border-box;
  background-color: var(--main-bg-light);
  color: var(--main-text-light);
}

.auth-panel form button {
  padding: 10px 20px;
  background: var(--button-bg-light);
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  transition: background var(--transition-duration);
  width: auto;
  min-width: 140px;
}

.auth-panel form button:hover {
  background: var(--button-hover-light);
}

.auth-panel .message {
  font-size: 0.9rem;
  color: red;
  margin-bottom: 10px;
}

.auth-panel p {
  margin-top: 15px;
  font-size: 0.95rem;
}

.auth-panel a {
  color: var(--button-bg-light);
  font-weight: bold;
  text-decoration: none;
}

.auth-panel a:hover {
  text-decoration: underline;
}

/* Dark mode podpora */
body.dark .auth-panel {
  background: var(--main-bg-light);
  color: var(--main-text-light);
}

body.dark .auth-panel input {
  background-color: var(--main-bg-light);
  color: var(--main-text-light);
  border: 1px solid #555;
}

body.dark .auth-panel a {
  color: var(--button-bg-light);
}

/* Vyvážený layout pro chybovou stránku */

body.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  background-color: var(--main-bg-light);
  color: var(--main-text-light);
}

body.error-page main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  box-sizing: border-box;
}

