/* =========================
   SERVICES – shared styles for schedule & admin pages
   Uses the same theme variables from style.css
========================= */

/* ---------- page wrapper ---------- */
.services-page {
  max-width: 1000px;
  margin: 100px auto 40px;
  padding: 0 20px;
}

.services-page h1 {
  font-family: 'Playfair Display', serif;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: center;
  color: var(--title);
  margin-bottom: 10px;
}

.services-page .subtitle {
  text-align: center;
  color: #6b5d4d;
  margin-bottom: 36px;
  font-size: 15px;
}

.admin-edit-link {
  text-align: center;
  margin: -20px 0 32px;
  font-size: 13px;
}

.admin-edit-link a {
  color: var(--gold-accent);
  text-decoration: none;
  transition: color 0.2s;
}

.admin-edit-link a:hover {
  color: var(--title);
}

/* ---------- week navigation ---------- */
.week-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.week-nav button {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 15px;
  padding: 8px 20px;
  border: 1px solid var(--gold-accent);
  background: var(--stone-lighter);
  color: var(--title);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.week-nav button svg {
  flex-shrink: 0;
}

/* Desktop default: show the full Bulgarian label, hide the abbreviation.
   On phones the rule inside the @media block flips this. The two spans
   keep the markup readable for screen readers and search engines while
   letting CSS swap the visible variant. */
.week-nav .lbl-short { display: none; }
.week-nav .lbl-full  { display: inline; }

.week-nav button:hover {
  background: var(--gold-accent);
  color: #fff;
}

.week-nav .week-label {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--title);
}

/* ---------- day card ---------- */
.day-card {
  background: var(--stone-lighter);
  border: 1px solid rgba(176,144,128,0.25);
  border-radius: 8px;
  margin-bottom: 24px;
  overflow: hidden;
}

.day-card-header {
  background: var(--stone-mid);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.day-card-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 19px;
  font-weight: 600;
  color: var(--title);
  margin: 0;
}

.day-card-header .day-date {
  font-size: 18px;
  font-family: 'Lora', Georgia, serif !important;
  color: #7a6b5a;
}

.day-card-body {
  padding: 0;
  font-family: 'Lora', Georgia, serif !important;
}

.day-card-empty {
  padding: 20px 24px;
  color: #999;
  font-style: italic;
  font-size: 15px;
}

/* ---------- service row ---------- */
.service-row {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(176,144,128,0.15);
  align-items: start;
}

.service-row:last-child {
  border-bottom: none;
}

/* ---------- service line (morning / evening) ---------- */
.service-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.service-line:last-of-type {
  margin-bottom: 6px;
}

.service-time-inline {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--title);
  white-space: nowrap;
  min-width: 46px;
}

.service-name {
  font-family: 'Lora', Georgia, serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-dark);
}

.service-time {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--title);
  white-space: nowrap;
}

.duty-priest {
  text-align: center;
  /* Pull tight under the week-nav above (which has margin-bottom: 36px).
     We sit just below the week label — like a subtitle, not a section. */
  margin: -24px 0 22px;
  font-family: 'Lora', Georgia, serif;
  font-size: 14px;
  font-style: italic;
  color: var(--gold-accent);
  /* When empty (no duty priest for the week, or show_on_duty=0), the
     element collapses — no awkward gap. */
  min-height: 0;
}

.duty-priest:empty {
  display: none;
}

/* The old <h4> selector is kept for safety in case any cached/older
   schedule.js bundles are still in play during a deploy window. */
.duty-priest h4 {
  font-family: 'Lora', Georgia, serif;
  font-size: 14px;
  font-style: italic;
  font-weight: 400;
  color: var(--gold-accent);
  margin: 0;
}

.service-info {
  text-align: left;
}

.service-info h4 {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-dark);
  margin: 0 0 3px;
}

.service-info p {
  font-size: 15px;
  color: #6b5d4d;
  margin: 0;
  line-height: 1.5;
}

.service-info p.desc-important {
  font-weight: 700;
  color: #000000;
}

.service-info p.desc-major {
  font-weight: 700;
  color: #e60000;
}

.service-meta {
  font-size: 13px;
  color: #8a7b6a;
  text-align: right;
}

.service-meta .priest-name {
  display: block;
  font-weight: 500;
  color: #5a4a2c;
}

.service-meta .feast-name {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  font-family: 'Lora', Georgia, serif !important;
}

.service-info .feast-name {
  font-size: 16px;
  font-weight: 600;
  font-family: 'Lora', Georgia, serif !important;
}

.badge-recurring {
  display: inline-block;
  font-size: 11px;
  background: var(--gold-accent);
  color: #fff;
  padding: 1px 8px;
  border-radius: 10px;
  margin-left: 8px;
  vertical-align: middle;
}

/* ---------- ADMIN form ---------- */
.admin-section {
  margin-bottom: 40px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full {
  grid-column: 1 / -1;
}

.form-group label {
  font-family: 'Playfair Display', serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--title);
  margin-bottom: 5px;
}

.form-group input,
.form-group select,
.form-group textarea {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(176,144,128,0.45);
  border-radius: 4px;
  background: #fff;
  color: var(--text-dark);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--gold-accent);
}

.form-group textarea {
  resize: vertical;
  min-height: 70px;
}

.btn {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 10px 28px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--gold-accent);
  color: #fff;
}

.btn-primary:hover { background: #9a7868; }

.btn-secondary {
  background: var(--stone-mid);
  color: var(--title);
}

.btn-secondary:hover { background: #d0c4b5; }

.btn-danger {
  background: #c0504d;
  color: #fff;
}

.btn-danger:hover { background: #a8403d; }

.btn-sm {
  font-size: 12px;
  padding: 5px 14px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

/* ---------- admin table ---------- */
.services-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.services-table th {
  font-family: 'Playfair Display', serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--title);
  background: var(--stone-mid);
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid rgba(176,144,128,0.35);
}

.services-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(176,144,128,0.15);
  vertical-align: middle;
}

.services-table tr:hover td {
  background: rgba(240,235,227,0.6);
}

.services-table .actions {
  white-space: nowrap;
  display: flex;
  gap: 6px;
}

/* ---------- toast / message ---------- */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--title);
  color: #f0ebe3;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  z-index: 5000;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- back link ---------- */
.back-link {
  display: inline-block;
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--gold-accent);
  text-decoration: none;
  transition: color 0.2s;
}

.back-link:hover { color: var(--title); }

.back-link::before {
  content: '← ';
}

/* ---------- responsive ---------- */
@media (max-width: 768px) {
  .services-page {
    margin-top: 80px;
    padding: 0 14px;
  }

  .services-page h1 {
    font-size: 22px;
  }

  /* ── week navigation: label on top, buttons side by side ── */
  .week-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 28px;
  }

  .week-nav .week-label {
    grid-column: 1 / -1;
    font-size: 15px;
    text-align: center;
    order: -1;
  }

  .week-nav button {
    font-size: 14px;
    padding: 10px 16px;
    text-align: center;
    /* Center the SVG + label inside the button so the arrow doesn't
       drift to the button edge. */
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
  }

  /* ── PUBLIC SCHEDULE PAGE ONLY (sedmichno-razpisanie.html) ──
     The next block scopes a tighter mobile layout to the public weekly
     schedule: smaller H1, hidden chrome (back-link / subtitle / today-line),
     and a single-row week-nav with abbreviated button labels. Other pages
     that share `.services-page` (propovedi, novini, admin/*) keep the
     baseline mobile layout above. */
  .page-public-schedule .services-page {
    /* The fixed site-header is 72 px tall on mobile (see style.css —
       .hero-full uses margin-top:72px / -72px). 80 px gives 8 px of
       breathing room so the heading clears the header cleanly. */
    margin-top: 80px;
  }

  .page-public-schedule .services-page .back-link,
  .page-public-schedule .services-page .subtitle,
  .page-public-schedule .services-page .today-line {
    display: none;
  }

  .page-public-schedule .services-page h1 {
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 0.04em;
    margin-top: 0;
    margin-bottom: 10px;
  }

  /* Single-row week-nav: [‹ Пред] [LABEL] [Следв ›]. Overrides the
     1fr 1fr / label-on-top default above. */
  .page-public-schedule .week-nav {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
  }

  .page-public-schedule .week-nav .week-label {
    grid-column: auto;
    order: 0;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  .page-public-schedule .week-nav button {
    display: inline-flex;
    gap: 4px;
    font-size: 13px;
    padding: 8px 10px;
    min-height: 40px;
  }

  /* Show abbreviated button labels on the schedule page only. */
  .page-public-schedule .week-nav .lbl-full  { display: none; }
  .page-public-schedule .week-nav .lbl-short { display: inline; }

  /* ── day card ── */
  .day-card {
    margin-bottom: 18px;
    border-radius: 6px;
  }

  .day-card-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    gap: 0;
  }

  .day-card-header h3 {
    font-size: 16px;
  }

  .day-card-header .day-date {
    font-size: 14px;
  }

  .day-card-empty {
    padding: 16px;
    font-size: 14px;
  }

  /* ── service row: single column card layout ── */
  .service-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(176,144,128,0.18);
  }

  .service-line {
    gap: 8px;
    margin-bottom: 2px;
  }

  .service-time-inline {
    font-size: 15px;
    color: var(--gold-accent);
  }

  .service-name {
    font-size: 15px;
  }

  .service-time {
    font-size: 15px;
    color: var(--gold-accent);
  }

  .service-info h4 {
    font-size: 15px;
    margin: 0;
  }

  .service-info p {
    font-size: 15px;
  }

  .service-meta {
    text-align: left;
    font-size: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    color: #8a7b6a;
    padding-top: 2px;
  }

  .service-meta .priest-name {
    display: inline;
    font-weight: 500;
  }

  .service-meta .feast-name {
    display: inline;
    margin-top: 0;
  }

  .service-meta .priest-name::after {
    content: ' · ';
    font-weight: 400;
    color: #b0a090;
  }

  .service-meta .feast-name::before {
    content: none;
  }

  .badge-recurring {
    font-size: 10px;
    padding: 0 6px;
    margin-left: 6px;
  }

  /* ── admin form ── */
  .form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* =========================
   TODAY HIGHLIGHT + SCROLL-TO-TODAY PILL
   Added together so they're easy to find/remove as a unit.
========================= */

/* "Днес: събота, 20 юни" line under the page subtitle.
   Rendered only when viewing the week containing today. */
.today-line {
  text-align: center;
  margin: -28px 0 28px;
  font-family: 'Lora', Georgia, serif;
  font-size: 15px;
  color: var(--gold-accent);
  font-style: italic;
}

/* The day-card whose date matches today. Gold left border + subtle
   lift so it reads as the visual focus of the page. scroll-margin-top
   makes scrollIntoView land below the fixed site header. */
.day-card.is-today {
  border-left: 4px solid var(--gold-accent);
  box-shadow: 0 4px 14px rgba(176, 144, 128, 0.18);
  scroll-margin-top: 90px;
}

.day-card.is-today .day-card-header {
  background: #f0e7d8;
}

.day-card.is-today .day-card-header h3 {
  color: var(--gold-accent);
}

/* Small "ДНЕС" pill next to today's day name in the card header. */
.today-pill {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 9px;
  font-family: 'Playfair Display', serif;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  background: #a01515;
  color: #f5c842;
  border-radius: 10px;
  vertical-align: middle;
  position: relative;
  top: -2px;
}

/* Floating "Към днес" pill — bottom-right, fixed, visible only when
   today's card has scrolled out of view. JS toggles `.visible` to fade
   it in; the `hidden` attribute removes it from the layout entirely. */
.scroll-to-today {
  position: fixed;
  right: 16px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--gold-accent);
  border: none;
  border-radius: 22px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s;
}

.scroll-to-today:hover { background: #9a7868; }
.scroll-to-today:active { transform: translateY(10px) scale(0.96); }

.scroll-to-today.visible {
  opacity: 1;
  transform: translateY(0);
}

.scroll-to-today svg { flex-shrink: 0; }

/* Above 768px the page is short and visible enough that the pill is
   noise — desktop users have plenty of viewport and a regular scrollbar. */
@media (min-width: 769px) {
  .scroll-to-today { display: none !important; }
}
