/**
 * @file
 * Theme — page-level compositions that wire the components into the four
 * imported screens (home, listing, doctor detail, article) plus Drupal
 * element overrides (messages, tables, contact/hours cards).
 */

/* ============================================================
   LISTING PAGE — results header + filter bar + active filters
   ============================================================ */
.listing-header {
  max-width: var(--content-max);
  margin-inline: auto;
  padding: 28px var(--gutter) 8px;
}

.listing-header__title {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: var(--text-h1);
  color: var(--blue-600);
  margin: 0 0 6px;
}

.listing-header__count {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--gray-500);
  margin: 0 0 20px;
}

.filter-bar {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: var(--space-4);
}

/* Views exposed filter form, styled as the design's search / filter bar.
   On a views *page* the fields live directly in .views-exposed-form; in an
   exposed-form *block* that class is a wrapper and the real <form> is nested,
   so the flex row is applied to whichever element holds the widgets. */
.views-exposed-form {
  max-width: var(--content-max);
  margin-inline: auto;
  padding: 0 var(--gutter) var(--space-4);
}

.views-exposed-form,
.views-exposed-form > form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-end;
}

.views-exposed-form > form {
  width: 100%;
}

.views-exposed-form .form-item {
  margin: 0;
  min-width: 180px;
  max-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.views-exposed-form label {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: 0.8125rem;
  color: var(--ink-900);
  margin: 0;
}

.views-exposed-form .form-actions {
  display: flex;
  gap: var(--space-2);
  align-items: flex-end;
  margin: 0;
}

/* "Caută" submit — green accent (positive action), matching the design. */
.views-exposed-form .form-submit {
  background: var(--green-600);
}

.views-exposed-form .form-submit:hover {
  background: var(--green-700);
}

/* Hero search: a white card sitting on the tinted hero band. */
.front-hero .views-exposed-form {
  max-width: 940px;
  padding: var(--space-4);
  background: var(--white);
  border: 1px solid var(--line-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  text-align: left;
}

/* Persistent search bar on inner pages, just under the breadcrumb. */
.region-hero-search {
  background: var(--white);
  border-bottom: 1px solid var(--line-200);
}

.region-hero-search .views-exposed-form {
  padding-block: var(--space-4);
}

/* Front-page cross-type search (custom form). The root form's #attributes
   bubble to this block wrapper, so it carries the class and reads as the white
   hero card; the inner <form> is the flex row of fields. */
.front-hero .medici-front-search {
  max-width: 940px;
  margin-inline: auto;
  padding: var(--space-4);
  background: var(--white);
  border: 1px solid var(--line-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  text-align: left;
}

.medici-front-search form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-end;
}

/* Field columns (județ / oraș / specialitate / nume). */
.medici-front-search .form-item-judet,
.medici-front-search .form-item-oras,
.medici-front-search .form-item-specialitate,
.medici-front-search .form-item-name {
  margin: 0;
  min-width: 160px;
  max-width: 230px;
  flex: 1 1 160px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.medici-front-search .form-item > label {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: 0.8125rem;
  color: var(--ink-900);
  margin: 0;
}

.medici-front-search .form-actions {
  margin: 0;
  align-self: flex-end;
}

.medici-front-search .form-submit {
  background: var(--green-600);
}

.medici-front-search .form-submit:hover {
  background: var(--green-700);
}

/* ---- Type selector as a pill/tab group (Medici active by default) ---- */
/* #type=radios renders a <fieldset class="search-typetabs"> with a <legend>
   and, inside .fieldset-wrapper, a container holding the option .form-items. */
.medici-front-search .search-typetabs {
  flex: 1 1 100%;
  min-width: 0;
  margin: 0 0 var(--space-1);
  padding: 0;
  border: 0;
}

.medici-front-search .search-typetabs > legend {
  float: none;
  width: auto;
  padding: 0;
  margin: 0 0 6px;
}

.medici-front-search .search-typetabs .fieldset-legend {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: 0.8125rem;
  color: var(--ink-900);
}

/* The pill "track": a horizontal row wrapping the radio options. */
.medici-front-search .search-typetabs .fieldset-wrapper > div {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--gray-050, #f3f5f8);
  padding: 4px;
  border-radius: 999px;
}

.medici-front-search .search-typetabs .form-item {
  margin: 0;
}

/* Hide the native radio; its label becomes the clickable pill. */
.medici-front-search .search-typetabs input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.medici-front-search .search-typetabs label {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: 0.9rem;
  color: var(--gray-600, #5b6672);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-base);
}

.medici-front-search .search-typetabs label:hover {
  color: var(--blue-600);
}

/* Active pill emphasised. */
.medici-front-search .search-typetabs input[type="radio"]:checked + label {
  background: var(--blue-600);
  color: var(--white);
  box-shadow: var(--shadow-card);
}

.medici-front-search .search-typetabs input[type="radio"]:focus-visible + label {
  outline: 2px solid var(--blue-600);
  outline-offset: 2px;
}

.filter-bar__field {
  min-width: 170px;
}

.filter-bar__field .form-item {
  margin-bottom: 0;
}

.filter-bar__spacer {
  margin-left: auto;
}

.active-filters {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: var(--space-6);
}

.active-filters__label {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--gray-500);
}

/* ============================================================
   DOCTOR DETAIL — identity header + two-column body
   ============================================================ */
.profile-header {
  display: flex;
  gap: 20px;
  align-items: center;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 28px var(--gutter) 0;
}

.profile-header__body {
  flex: 1;
}

.profile-header__titles {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-header__name {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: 2rem;
  color: var(--blue-600);
  margin: 0;
}

.profile-header__specialty {
  font-family: var(--font-display);
  font-weight: var(--weight-medium);
  font-size: var(--text-h3);
  color: var(--ink-700);
  margin: 4px 0 8px;
}

/* The specialty is an entity-reference field; drop its label chrome and
   render the term inline as a plain subtitle. */
.profile-header__specialty .field,
.profile-header__specialty .field__items,
.profile-header__specialty .field__item {
  display: inline;
}

.profile-header__specialty .field__label {
  display: none;
}

.profile-header__specialty a {
  color: var(--ink-700);
  text-decoration: none;
}

/* Stacked detail sections (Despre / Locație / Recenzii) */
.detail-section {
  margin-bottom: var(--space-5);
}

.detail-section__title {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: 1.15rem;
  color: var(--blue-600);
  margin: 0 0 var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.detail-section__count {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: var(--weight-medium);
  color: var(--gray-500);
  background: var(--gray-050, #f3f5f8);
  border-radius: 999px;
  padding: 2px 10px;
}

/* Configured fields render as clean label / value rows in page style.
   The stable9 base emits classless field markup — a wrapper <div> holding a
   label <div> followed by one or more value <div>s — so we style by structure. */
.node-fields > div {
  display: flex;
  gap: var(--space-4);
  align-items: baseline;
  padding: 11px 0;
  margin: 0;
  border-bottom: 1px solid var(--line-200);
}

.node-fields > div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

/* First inner div is the field label. */
.node-fields > div > div:first-child {
  flex: 0 0 168px;
  color: var(--gray-500);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: var(--weight-medium);
}

/* Remaining inner divs are the value(s). */
.node-fields > div > div ~ div {
  color: var(--ink-900);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: var(--leading-body);
}

.node-fields > div > div ~ div a {
  color: var(--blue-600);
  text-decoration: none;
}

@media (max-width: 480px) {
  .node-fields > div {
    flex-direction: column;
    gap: 2px;
  }
  .node-fields > div > div:first-child {
    flex-basis: auto;
  }
}

/* Review subject line */
.review__subject {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: 0.95rem;
  color: var(--ink-900);
  margin: 0 0 2px;
}

.review + .review {
  border-top: 1px solid var(--line-200);
  padding-top: 14px;
}

/* Contact card (sidebar) */
.contact-card__title,
.sidebar-card__title {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: 1.05rem;
  color: var(--blue-600);
  margin: 0 0 14px;
}

.contact-card__row {
  display: flex;
  gap: var(--space-2);
  margin-bottom: 10px;
}

.contact-card__label {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--gray-500);
  width: 70px;
  flex: none;
}

.contact-card__value {
  font-family: var(--font-body);
  font-size: 0.925rem;
  color: var(--ink-900);
}

.contact-card__actions {
  margin-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Hours / program table */
.hours-table {
  width: 100%;
  border-collapse: collapse;
}

.hours-table tr,
.hours-row {
  display: flex;
  justify-content: space-between;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-200);
  font-family: var(--font-body);
  font-size: 0.925rem;
}

.hours-table tr:last-child,
.hours-row:last-child {
  border-bottom: none;
}

.hours-row__day {
  color: var(--ink-900);
  font-weight: var(--weight-medium);
}

.hours-row__time {
  color: var(--ink-700);
}

/* Location map (OpenStreetMap embed) */
.map-card {
  overflow: hidden;
}

.map-embed {
  display: block;
  width: 100%;
  height: 360px;
  border: 0;
}

.map-card__address {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin: var(--space-3) 0 0;
  font-family: var(--font-body);
  font-size: 0.925rem;
  color: var(--ink-700);
}

.map-card__address svg {
  color: var(--gray-500);
  flex: none;
}

.map-card__address a {
  margin-left: auto;
  font-size: var(--text-sm);
  color: var(--blue-600);
}

/* Review item */
.review {
  margin-bottom: 0;
}

.review__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.review__author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.review__author strong {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: 0.95rem;
  color: var(--ink-900);
}

.review__date {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--gray-500);
}

.review__text {
  font-family: var(--font-body);
  font-size: 0.925rem;
  line-height: var(--leading-body);
  color: var(--ink-700);
  margin: 8px 0 0;
}

.reviews-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ============================================================
   ARTICLE DETAIL
   ============================================================ */
.article {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px var(--gutter) 0;
}

.article__title {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: 2.5rem;
  line-height: 1.15;
  color: var(--blue-600);
  margin: 16px 0;
}

.article__lead {
  font-family: var(--font-body);
  font-size: var(--text-h3);
  line-height: 1.5;
  color: var(--ink-700);
  margin: 0 0 var(--space-6);
}

.article__meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--line-200);
}

.article__meta-name {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: 0.95rem;
  color: var(--ink-900);
}

.article__meta-info {
  font-family: var(--font-body);
  font-size: 0.825rem;
  color: var(--gray-500);
}

.article__hero {
  height: 360px;
  margin: var(--space-6) 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-200);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: repeating-linear-gradient(45deg, var(--blue-050), var(--blue-050) 12px, var(--white) 12px, var(--white) 24px);
}

.article__hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article__body {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--ink-900);
}

.article__body h2 {
  font-size: var(--text-h2);
  color: var(--blue-600);
  margin: 32px 0 12px;
}

.article__body p {
  margin: 0 0 20px;
}

.article__tags {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: var(--space-6) 0;
  border-top: 1px solid var(--line-200);
}

/* ============================================================
   POPULAR CATEGORIES (front page icon grid)
   ============================================================ */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

.category-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-4);
  background: var(--white);
  border: 1px solid var(--line-200);
  border-radius: var(--radius-md);
  text-align: center;
  text-decoration: none;
  color: var(--ink-900);
  transition: var(--transition-base);
}

.category-tile:hover {
  border-color: var(--blue-600);
  box-shadow: var(--shadow-card-hover);
  color: var(--ink-900);
  text-decoration: none;
}

.category-tile__icon {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--blue-100);
  color: var(--blue-600);
}

.category-tile__label {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: 0.95rem;
}

@media (max-width: 768px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-header { flex-wrap: wrap; }
  .profile-header__name { font-size: 1.6rem; }
  .article__title { font-size: 1.9rem; }
  .article__hero { height: 220px; }
}

/* ============================================================
   DRUPAL ELEMENT OVERRIDES
   ============================================================ */

/* Status messages */
.messages {
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  border: 1px solid var(--line-200);
  font-size: var(--text-sm);
}

.messages--status {
  background: var(--success-100);
  border-color: var(--green-600);
  color: var(--green-700);
}

.messages--warning {
  background: var(--warning-100);
  border-color: var(--warning-600);
  color: #9a6f04;
}

.messages--error {
  background: var(--danger-100);
  border-color: var(--danger-600);
  color: var(--danger-600);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

table th {
  text-align: left;
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  color: var(--ink-900);
  background: var(--surface-100);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line-200);
}

table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line-200);
}

table tr:nth-child(even) td {
  background: var(--surface-100);
}

/* Field labels in default node output */
.field--label-inline .field__label {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  color: var(--ink-700);
  margin-right: var(--space-2);
}

/* Site branding block — constrain logo wherever it is placed
   (header is handled separately; this tames footer/other regions). */
.block-system-branding-block img {
  height: 40px;
  width: auto;
}

.region-footer-top .block-system-branding-block {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  justify-content: center;
}

.region-footer-top .block-system-branding-block a[rel="home"] + a[rel="home"] {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  color: var(--blue-600);
}

/* Hide the empty page-title block that core prints on listing/front pages */
.block-page-title-block h1:empty {
  display: none;
}

/* On full node pages the node template renders its own title, so suppress
   the standalone page-title block to avoid a duplicate heading. */
.page--node-detail .block-page-title-block {
  display: none;
}

/* The node_claim "Claim this listing" button is merged into the sidebar
   "Revendică profil" CTA, so hide the inline one inside the node body. */
.node--detail .node-claim-button {
  display: none;
}

/* Safety net: our generic block/nav list styling must never leak into Drupal's
   contextual links (the admin pencil menus), which live inside blocks. Keep
   them collapsed until opened. */
.contextual ul.contextual-links {
  display: none;
}

.contextual.open ul.contextual-links {
  display: block;
}

.main-content .block-page-title-block {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.main-content .block-page-title-block h1 {
  padding-top: var(--space-8);
}

/* Frontpage / promoted views: render article-card rows as a responsive grid.
   :has() lets us target only the listings that contain article cards, so
   doctor/listing views (vertical stack) are untouched. */
.views-element-container > div:has(> .views-row .article-card) {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  max-width: var(--content-max);
  margin-inline: auto;
  padding: var(--space-8) var(--gutter);
}

.views-element-container > div:has(> .views-row .article-card) .views-row {
  min-width: 0;
}

@media (max-width: 980px) {
  .views-element-container > div:has(> .views-row .article-card) {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .views-element-container > div:has(> .views-row .article-card) {
    grid-template-columns: 1fr;
  }
}

/* "Medici recomandați" block on the front page — section heading + a 2-up
   grid of doctor cards (block view rows). */
#block-medici-recomandati {
  max-width: var(--content-max);
  margin-inline: auto;
  padding: var(--space-12) var(--gutter) 0;
}

#block-medici-recomandati > h2,
#block-medici-recomandati .block__title {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: var(--text-h2);
  color: var(--blue-600);
  margin: 0 0 var(--space-6);
}

#block-medici-recomandati [class*="js-view-dom-id"],
#block-medici-recomandati .view-content {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

#block-medici-recomandati .views-row {
  min-width: 0;
}

@media (max-width: 768px) {
  #block-medici-recomandati [class*="js-view-dom-id"],
  #block-medici-recomandati .view-content {
    grid-template-columns: 1fr;
  }
}

/* Comments (reviews via core comment module) */
.node-comments > section > h2 {
  /* Field label is hidden on the display; guard any residual thread heading. */
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.comment {
  padding: 14px 0;
  margin: 0;
  border-bottom: 1px solid var(--line-200);
}

.comment:first-of-type {
  padding-top: 0;
}

.comment__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.comment__author {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: 0.95rem;
  color: var(--ink-900);
}

.comment__author span {
  font-weight: inherit;
}

.comment__date {
  margin-left: auto;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--gray-500);
}

.comment__meta .permalink,
.comment__meta > a[href*="#comment"] {
  font-size: 0.8rem;
  color: var(--gray-500);
  text-decoration: none;
}

.comment__title {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: 0.95rem;
  margin: 0 0 2px;
}

.comment__title a {
  color: var(--ink-900);
  text-decoration: none;
}

.comment__body {
  font-family: var(--font-body);
  font-size: 0.925rem;
  line-height: var(--leading-body);
  color: var(--ink-700);
}

.comment__body p {
  margin: 0 0 6px;
}

.comment__body .links.inline {
  list-style: none;
  display: flex;
  gap: var(--space-3);
  padding: 0;
  margin: 6px 0 0;
  font-size: var(--text-sm);
}

.comment__body .links.inline a {
  color: var(--blue-600);
  text-decoration: none;
}

/* "Add new comment" form under the thread */
.node-comments .comment-form,
.node-comments form {
  margin-top: var(--space-5);
}
