body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  background: #f9f9f9;
  color: #333;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-user-select: none; /* iOS Safari i Android WebKit */
  -ms-user-select: none;     /* stari IE */
  user-select: none;
}

header {
  background: linear-gradient(135deg, #4b0082, #800080);
  color: white;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

header h1 {
  font-size: 2.5rem;
  margin: 0;
}

header p {
  font-size: 1.2rem;
  margin-top: 0.5rem;
}

nav {
  background-color: #fff;
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 1rem 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

nav a {
  text-decoration: none;
  color: #4b0082;
  font-weight: bold;
  transition: color 0.2s;
}

nav a:hover {
  color: #800080;
}

.dream-summary {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
  text-align: center;
}

.dream-summary h2 {
  color: #800080;
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.dream-summary p {
  color: #333;
  font-size: 1.1rem;
  line-height: 1.6;
  font-style: italic;
  margin: 0;
}

.search-container {
  text-align: center;
  margin: 2rem auto;
  position: relative;
  max-width: 600px;
  width: 95%;
  box-sizing: border-box;
  overflow: visible;
}

.search-container input {
  padding: 0.8rem 1rem;
  font-size: 1rem;
  width: 100%;
  max-width: 400px;
  border: 1px solid #ccc;
  border-right: none;
  border-radius: 5px 0 0 5px;
  outline: none;
  box-sizing: border-box;
}

.search-container button {
  padding: 0.8rem 1rem;
  font-size: 1rem;
  background: #800080;
  color: white;
  border: 1px solid #800080;
  border-left: none;
  border-radius: 0 5px 5px 0;
  cursor: pointer;
  transition: background 0.2s;
  box-sizing: border-box;
}

.search-container button:hover {
  background: #4b0082;
}

.search-container #autocomplete {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  width: 100%;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 5px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  max-height: 200px;
  overflow-y: auto;
  z-index: 9999;
  box-sizing: border-box;
  visibility: visible;
  opacity: 1;
}

.search-container #autocomplete.active {
  display: block !important;
}

.search-container #autocomplete div {
  padding: 0.8rem;
  cursor: pointer;
  color: #000;
  font-size: 1rem;
  line-height: 1.5;
}

.search-container #autocomplete div:hover {
  background: #f0f0f0;
}

.search-container #search-results {
  display: none;
  background: #fff;
  padding: 1rem;
  border-radius: 5px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  margin-top: 1rem;
  max-width: 95%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.search-container #search-results.active {
  display: block;
}

.search-container #search-results a {
  color: #4b0082;
  text-decoration: none;
  font-weight: bold;
}

.search-container #search-results a:hover {
  text-decoration: underline;
}

main {
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.hero, .contact-info, .error-message {
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  text-align: center;
  margin-bottom: 3rem;
}

.hero h2, .contact-info h2, .error-message h2 {
  color: #800080;
  font-size: 2rem;
}

.hero p {
  color: #333;
  font-size: 1.1rem;
  line-height: 1.6;
}

.features, .dreams-list, .related-dreams {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.feature, .dream-item {
  background: #fff;
  padding: 1.5rem;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  text-align: center;
}

.feature h3, .dream-item a {
  color: #4b0082;
}

.dream-item a {
  font-weight: bold;
  text-decoration: none;
}

.dream-item a:hover {
  text-decoration: underline;
}

.alphabet-filter {
  text-align: center;
  margin-bottom: 2rem;
}

.alphabet-filter button {
  padding: 0.5rem 1rem;
  margin: 0.2rem;
  border: 1px solid #ccc;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.alphabet-filter button:hover {
  background: #f0f0f0;
}

.alphabet-filter button.active {
  background: #800080;
  color: white;
  border-color: #800080;
}

.pagination {
  text-align: center;
  margin-top: 2rem;
}

.pagination button {
  padding: 0.5rem 1rem;
  background: #800080;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.2s;
}

.pagination button:hover {
  background: #4b0082;
}

#load-more {
  display: block;
  margin: 2rem auto;
  padding: 0.8rem 2rem;
  background: #800080;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}

#load-more:hover {
  background: #4b0082;
}

.why-dreams {
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  text-align: center;
  margin: 2rem auto;
  max-width: 1200px;
}
.why-dreams h2 {
  color: #800080;
  font-size: 2rem;
  margin-bottom: 1rem;
}
.why-dreams p {
  color: #333;
  font-size: 1.1rem;
  line-height: 1.6;
}
@media (min-width: 601px) {
  .why-dreams {
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  }
  .why-dreams h2 {
    color: #800080;
    font-size: 2rem;
  }
}
@media (max-width: 600px) {
  .why-dreams {
    padding: 1rem;
  }
  .why-dreams h2 {
    color: #800080;
    font-size: 1.6rem;
  }
  .why-dreams p {
    font-size: 1rem;
  }
}

  .cta-button {
  display: inline-block;
  padding: 0.8rem 2rem;
  background: #800080;
  color: white;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 1.1rem;
  font-weight: bold;
  text-decoration: none;
  border-radius: 5px;
  border: 1px solid #800080;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.cta-button:hover {
  background: #4b0082;
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

@media (max-width: 600px) {
  .cta-button {
    padding: 0.6rem 1.5rem;
    font-size: 1rem;
  }
}

.category-section {
  margin-bottom: 2rem;
}

.category-section h2 {
  color: #800080;
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.category-title {
  display: block;
  padding: 1rem;
  margin: 0.5rem 0;
  background: #fff;
  border-radius: 5px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  color: #4b0082;
  font-size: 1.5rem;
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.category-title:hover {
  background: #f0f0f0;
  color: #800080;
}

.social-links {
  margin-top: 1rem;
}

.social-links a {
  margin: 0 0.5rem;
  font-size: 1.2rem;
  color: #4b0082;
  text-decoration: none;
}

.social-links a:hover {
  text-decoration: underline;
}

.contact .php-email-form {
  width: 100%;
}

.contact-section {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.form-group {
  flex: 1 1 100%;
}

.form-row .form-group {
  flex: 1 1 calc(50% - 10px);
}

.form-control {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 16px;
  box-sizing: border-box;
}

textarea.form-control {
  resize: vertical;
}

.text-center {
  text-align: center;
  margin-top: 20px;
}

button[type="submit"] {
  background-color: #800080;
  color: #fff;
  padding: 12px 30px;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
}

button[type="submit"]:hover {
  background-color: #4b0082;
}

.status-messages {
  margin: 15px 0;
  font-size: 14px;
  color: #333;
}

.status-messages .loading {
  display: none;
  color: #888;
}

.status-messages .error-message {
  display: none;
  color: red;
}

.status-messages .sent-message {
  display: none; /* Skriveno dok se ne doda d-block */
  background-color: #28a745; /* Zelena pozadina */
  color: white; /* Bijeli tekst */
  padding: 10px 15px; /* Unutarnji razmak */
  border-radius: 4px; /* Zaobljeni rubovi */
  font-weight: 500; /* Srednje podebljana slova */
  text-align: center; /* Centriran tekst */
}

.status-messages .sent-message.d-block {
  display: block !important;
}

.contact .php-email-form .error-message {
  display: none;
  color: #fff;
  background: #ed3c0d;
  text-align: left;
  padding: 15px;
  font-weight: 600;
}

.contact .php-email-form .error-message br + br {
  margin-top: 25px;
}

.contact .php-email-form .sent-message {
  display: none;
  color: #fff;
  background: #18d26e;
  text-align: center;
  padding: 15px;
  font-weight: 600;
}

.contact .php-email-form .loading {
  display: none;
  background: #fff;
  text-align: center;
  padding: 15px;
}

.contact .php-email-form .loading:before {
  content: "";
  display: inline-block;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  margin: 0 10px -6px 0;
  border: 3px solid #18d26e;
  border-top-color: #eee;
  -webkit-animation: animate-loading 1s linear infinite;
  animation: animate-loading 1s linear infinite;
}

.contact .php-email-form label {
  font-family: "Poppins", sans-serif;
  margin-bottom: 5px;
  color: #8a8c95;
}

.contact .php-email-form input, .contact .php-email-form textarea {
  border-radius: 0;
  box-shadow: none;
  font-size: 14px;
}

.contact .php-email-form input:focus, .contact .php-email-form textarea:focus {
  border-color: #5777ba;
}

.contact .php-email-form input {
  padding: 10px 15px;
}

.contact .php-email-form textarea {
  padding: 12px 15px;
}

.contact .php-email-form button[type="submit"] {
  background: #fff;
  border: 2px solid #5777ba;
  padding: 10px 24px;
  color: #5777ba;
  transition: 0.4s;
  border-radius: 50px;
  margin-top: 5px;
}

.contact .php-email-form button[type="submit"]:hover {
  background: #5777ba;
  color: #fff;
}

@-webkit-keyframes animate-loading {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes animate-loading {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@media (max-width: 1024px) {
  .contact .php-email-form {
    padding: 30px 15px 15px 15px;
  }
}

@media (max-width: 768px) {
  .contact .php-email-form {
    padding: 15px 0 0 0;
  }
}

footer {
  text-align: center;
  padding: 2rem;
  background: #4b0082;
  color: white;
}

#loader {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  background: rgba(255, 255, 255, 0.8);
  padding: 10px 20px;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  z-index: 1000;
}

#backToTop {
  display: none;
  position: fixed;
  bottom: 150px;
  right: 20px;
  background: #800080;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: background 0.2s, transform 0.2s;
  z-index: 1000;
}

#backToTop:hover {
  background: #4b0082;
  transform: scale(1.1);
}

#backToTop i {
  font-size: 1.2rem;
  line-height: 40px;
  text-align: center;
  display: block;
}

/* Stilovi za cesto-sanjani-snovi.html */
.intro-text {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
  color: #4b0082;
}

.intro-text h2 {
  color: #800080;
  font-size: 2rem;
  margin-bottom: 1rem;
}

.intro-text h3 {
  color: #800080;
  font-size: 1.4rem;
  margin: 1rem 0 0.5rem;
}

.intro-text p {
  color: #333;
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.popular-dreams {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.popular-dreams h2 {
  color: #800080;
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.dreams-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  clear: both;
}

/* Stilovi za tumačenje snova */
.dream-interpretation {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.dream-interpretation h2 {
  color: #800080;
  font-size: 2rem;
  margin-bottom: 1rem;
}

.dream-interpretation h3 {
  color: #800080;
  font-size: 1.4rem;
  margin: 1rem 0 0.5rem;
}

.dream-interpretation p {
  color: #333;
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.dream-interpretation p + h3 {
  margin-top: 1rem;
}

@media (max-width: 600px) {
  header h1 {
    font-size: 2rem;
  }

  header p {
    font-size: 1rem;
  }

  nav {
    flex-wrap: wrap;
    gap: 1rem;
  }
  
  .dream-summary {
    padding: 0 0.5rem;
  }

  .dream-summary h2 {
    font-size: 1.6rem;
  }

  .dream-summary p {
    font-size: 1rem;
  }

  .search-container {
    margin: 1rem auto;
    width: 95%;
    padding: 0 0.5rem;
    overflow: visible;
  }

  .search-container input {
    width: calc(100% - 2rem);
    max-width: none;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
  }

  .search-container button {
    width: calc(100% - 2rem);
    margin: 0.5rem auto 0;
    border: 1px solid #800080;
    border-radius: 5px;
    box-sizing: border-box;
  }

  .search-container #autocomplete {
    width: 100%;
    max-height: 150px;
    top: calc(100% + 1rem);
    left: 0;
    z-index: 9999;
    box-sizing: border-box;
    background: #fff;
    visibility: visible;
    opacity: 1;
  }

  .search-container #search-results {
    max-width: 95%;
    margin: 1rem auto;
  }

  .alphabet-filter {
    margin-bottom: 1rem;
  }

  .alphabet-filter button {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    margin: 0.1rem;
  }

  .dreams-list, .related-dreams {
    padding: 0 0.5rem;
    grid-template-columns: 1fr;
  }

  .pagination {
    margin-top: 1rem;
  }

  .intro-text {
    padding: 0 0.5rem;
  }

  .intro-text h2 {
    font-size: 1.6rem;
  }

  .intro-text h3 {
    font-size: 1.2rem;
  }

  .popular-dreams {
    padding: 0 0.5rem;
  }

  .popular-dreams h2 {
    font-size: 1.6rem;
  }
  
  .dream-interpretation {
    padding: 0 0.5rem;
  }

  .dream-interpretation h2 {
    font-size: 1.6rem;
  }

  .dream-interpretation h3 {
    font-size: 1.2rem;
  }

  #load-more {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }

  .category-title {
    font-size: 1.3rem;
    padding: 0.8rem;
  }

  #backToTop {
    bottom: 150px;
    right: 15px;
    width: 36px;
    height: 36px;
  }

  #backToTop i {
    font-size: 1rem;
    line-height: 36px;
  }

  main {
    padding: 1rem;
  }
}