/* General reset and base styles */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background-color: #f6e9ff; /* soft violet background reminiscent of the example */
  color: #2b193d; /* dark plum for contrast */
  min-height: 100vh;
}

/* Container utility */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

/* Header styles */
.page-header {
  background-color: transparent;
  padding: 2rem 0 1rem;
  text-align: left;
}

.site-title {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.site-tagline {
  margin-top: 0.5rem;
  font-size: 1.1rem;
  font-weight: 400;
  max-width: 700px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-top: 1.5rem;
}

/* Filter button */
.filter-btn {
  background-color: #ffffff;
  border: 1px solid #d7c2ef;
  color: #3f1a65;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border-radius: 2rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.filter-btn:hover {
  background-color: #e8d6f7;
}

/* Search bar */
.search-wrapper {
  position: relative;
  flex: 1;
  max-width: 300px;
}

.search-wrapper input {
  width: 100%;
  padding: 0.5rem 2.5rem 0.5rem 1rem;
  font-size: 1rem;
  border: 1px solid #d7c2ef;
  border-radius: 2rem;
  background-color: #ffffff;
  color: #3f1a65;
  outline: none;
}

.search-icon {
  position: absolute;
  right: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: #9c7dc5;
}

/* Filter panel styles */
.filter-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  background-color: #ffffff;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  z-index: 100;
  overflow-y: auto;
}

.filter-panel h2 {
  margin-top: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #3f1a65;
}

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

.filter-category h3 {
  margin: 0.5rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: #3f1a65;
}

.filter-category label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
  color: #3f1a65;
  cursor: pointer;
}

/* Custom checkbox styling */
.filter-category input[type="checkbox"] {
  margin-right: 0.4rem;
  accent-color: #754fa0; /* color of checkbox when selected */
}

.apply-btn {
  background-color: #754fa0;
  color: #ffffff;
  border: none;
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  border-radius: 2rem;
  cursor: pointer;
  width: 100%;
}

.apply-btn:hover {
  background-color: #5e3d83;
}

/* Cards grid */
.cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto 3rem;
}

/* Individual card */
.card {
  background-color: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
  padding: 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
}

.card-image-wrapper {
  width: 150px;
  height: 150px;
  margin-bottom: 1rem;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #d7c2ef;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-name {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #3f1a65;
}

.card-ranks {
  margin: 0.2rem 0;
  font-size: 0.9rem;
  color: #7a5a9e;
}

.card-quote {
  font-style: italic;
  font-size: 0.85rem;
  color: #4e2c78;
  margin: 0.5rem 0 1rem;
  min-height: 60px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.card-tags span {
  background-color: #f5f0fa;
  color: #4e2c78;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  white-space: nowrap;
  /* Limit overflow for long specialization names */
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Detail overlay styles */
.detail-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  padding: 1rem;
}

/* When the overlay element has the hidden attribute set, completely hide it */
.detail-overlay[hidden] {
  display: none !important;
}

.detail-dialog {
  background-color: #f6e9ff;
  border-radius: 1rem;
  padding: 2rem;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.detail-close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #4e2c78;
}

.detail-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.detail-image-wrapper {
  flex: 0 0 200px;
  height: 200px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid #d7c2ef;
}

.detail-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-info {
  flex: 1;
  min-width: 200px;
}

.detail-name {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  color: #2b193d;
}

/* Ranks displayed below the name in the detail overlay */
.detail-ranks {
  margin: 0.2rem 0;
  font-size: 1rem;
  color: #7a5a9e;
  font-weight: 500;
}

.detail-recipients {
  margin: 0.3rem 0;
  font-size: 1rem;
  color: #4e2c78;
  font-weight: 500;
}

/* Tags for specialization details */
.spec-tags {
  margin-top: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.spec-tag {
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  line-height: 1;
  font-weight: 500;
  white-space: nowrap;
}

/* Range tags use a gentle lavender background */
.range-tag {
  background-color: #e8d6f7;
  color: #4e2c78;
}

/* Strength tags use a soft pastel blue for contrast */
.strength-tag {
  background-color: #d9eaf7;
  color: #3f1a65;
}

/* Contact tags for region and email in detail overlay */
.contact-tag {
  display: inline-block;
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  font-weight: 500;
  margin-right: 0.4rem;
  margin-top: 0.2rem;
}
.region-tag {
  background-color: #e8d6f7;
  color: #4e2c78;
}
.email-tag {
  background-color: #d9eaf7;
  color: #3f1a65;
}

/* Specializations section */
.detail-specs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.spec-card {
  background-color: #ffffff;
  border-radius: 1rem;
  padding: 1rem 1.5rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  color: #2b193d;
}

.spec-name {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
  color: #3f1a65;
}

.spec-place {
  margin-top: 0.2rem;
  font-size: 0.9rem;
  font-style: italic;
  color: #7a5a9e;
}

.spec-description {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.4;
  color: #4e2c78;
}

.detail-footer {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
}

/* Contact information (region and email) in detail view */
.detail-region-email {
  margin: 0.3rem 0;
  font-size: 0.95rem;
  color: #4e2c78;
  font-weight: 500;
}

/* Responsive adjustments for details */
@media (max-width: 600px) {
  .detail-dialog {
    padding: 1rem;
  }
  .detail-image-wrapper {
    flex: 0 0 120px;
    height: 120px;
  }
  .detail-name {
    font-size: 1.6rem;
  }
  .spec-name {
    font-size: 1.2rem;
  }
}

/* Ensure that elements with the hidden attribute are actually hidden.
   Without this rule, our explicit styles (e.g., display:flex on the login
   container) can override the default hidden behaviour and keep elements
   visible. Setting display: none !important here guarantees that any
   element with [hidden] will be removed from the layout. */
[hidden] {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .site-title {
    font-size: 2rem;
  }
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
  .search-wrapper {
    max-width: 100%;
  }
}

/* ------------------------------------------------------------------ */
/* Additional styles for login overlay, about overlay, enhanced filters and logout */

/* Login overlay styles */
.login-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #f6e9ff;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 300;
}

.login-box {
  background-color: #ffffff;
  padding: 2rem 3rem;
  border-radius: 1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.login-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  color: #2b193d;
}

.login-box p {
  margin: 1rem 0 2rem;
  font-size: 1rem;
  color: #4e2c78;
}

/* About button next to filter
   It now displays text ("O bazie") and uses a pill-like shape similar to
   the filter button. This improves usability and makes the purpose clearer. */
.about-btn {
  background-color: #ffffff;
  border: 1px solid #d7c2ef;
  color: #3f1a65;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border-radius: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.about-btn:hover {
  background-color: #e8d6f7;
}

/* Close button for the filter panel */
.filter-close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #4e2c78;
}

.filter-close-btn:hover {
  color: #3f1a65;
}

/* Clear filters button */
.clear-btn {
  background-color: #f5f0fa;
  border: 1px solid #d7c2ef;
  color: #4e2c78;
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  border-radius: 2rem;
  width: 100%;
  margin-top: 0.5rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.clear-btn:hover {
  background-color: #e8d6f7;
}

/* Location filter input */
.filter-location {
  margin-bottom: 1rem;
}

.filter-location label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  color: #3f1a65;
  font-weight: 600;
}

.location-input {
  width: 100%;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border: 1px solid #d7c2ef;
  border-radius: 2rem;
  background-color: #ffffff;
  color: #3f1a65;
  outline: none;
}

/* Recipient tags displayed inside specialization cards */
.recipient-tag {
  background-color: #f6d7e8;
  color: #4e2c78;
}

/* About overlay styles */
.about-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  padding: 1rem;
}

.about-overlay[hidden] {
  display: none !important;
}

.about-dialog {
  background-color: #f6e9ff;
  border-radius: 1rem;
  padding: 2rem;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.about-close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #4e2c78;
}

.about-close-btn:hover {
  color: #3f1a65;
}

.about-dialog h2 {
  margin-top: 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: #2b193d;
}

.about-content h3 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
  font-weight: 600;
  color: #3f1a65;
}

.about-content p {
  margin: 0 0 0.8rem;
  font-size: 1rem;
  color: #4e2c78;
  line-height: 1.4;
}

/* Logout button style */
.logout-btn {
  background-color: #ffffff;
  border: 1px solid #d7c2ef;
  color: #3f1a65;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border-radius: 2rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.logout-btn:hover {
  background-color: #e8d6f7;
}

/* Center the rendered Google Sign-In button within its container. The
   generated button markup does not automatically take up the full width of
   the parent, so we use flexbox to center it. */
#googleSignInBtn {
  display: flex;
  justify-content: center;
}