/* =========================
   Workshops – Public View
   ========================= */

.workshops-public {
  padding: clamp(2rem, 4vw, 3.5rem);
  max-width: 1200px;
  margin: 0 auto;
}

/* Header */
.public-header {
  margin-bottom: 2rem;
  max-width: 640px;
}

.public-header h1 {
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.public-header p {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Calendar Toolbar (from user/workshops) */
.calendar-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 10;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.month-nav h1 {
  flex: 1;
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}

.month-nav .btn-icon {
  flex: 0 0 auto;
}

.toolbar-right {
  position: relative;
  z-index: 10;
}

/* Calendar */
.calendar-grid {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 10px 30px var(--shadow-soft);
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.calendar-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  display: table;
}

.calendar-table thead {
  background: rgba(0, 0, 0, 0.02);
  border-bottom: 1px solid var(--border-light);
  display: table-header-group;
}

.calendar-table thead tr {
  display: table-row;
}

.calendar-table tbody {
  display: table-row-group;
}

.calendar-table tbody tr {
  display: table-row;
}

.calendar-table thead th {
  text-align: center;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1rem 0;
  border-right: 1px solid var(--border-light);
}

.calendar-table thead th:last-child {
  border-right: none;
}

.calendar-table tbody td {
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  display: table-cell;
}

.calendar-table tbody tr:last-child td {
  border-bottom: none;
}

.calendar-table tbody td:last-child {
  border-right: none;
}

.calendar-day {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0.5rem;
  min-height: 140px;
  height: 140px;
  width: 100%;
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(180, 86, 40, 0.1);
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.calendar-day:hover {
  background: rgba(180, 86, 40, 0.03);
}

.calendar-day:active {
  background: rgba(180, 86, 40, 0.06);
}

.calendar-day.other-month {
  opacity: 0.35;
  background: rgba(0, 0, 0, 0.01);
}

.calendar-day.today {
  background: rgba(180, 86, 40, 0.02);
  border-left: 3px solid var(--fox-orange);
  padding-left: calc(0.5rem - 2px);
}

.day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.day-number {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.day-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.event {
  font-size: 0.75rem;
  padding: 0.3rem 0.4rem;
  border-radius: 4px;
  margin-bottom: 0.25rem;
  cursor: pointer;
  transition: opacity 0.15s ease;
  line-height: 1.3;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  user-select: none;
  -webkit-user-select: none;
}

.event:hover {
  opacity: 0.85;
}

.event:active {
  opacity: 0.7;
  transform: scale(0.98);
}

.event-one-on-one {
  background: rgba(180, 86, 40, 0.15);
  color: var(--fox-orange);
  border-left: 3px solid var(--fox-orange);
}

.event-group {
  background: rgba(65, 152, 211, 0.15);
  color: #2c6fa3;
  border-left: 3px solid #4198d3;
}

.event-closed {
  opacity: 0.6;
  text-decoration: line-through;
}

.event-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.event-time {
  font-size: 0.7rem;
  opacity: 0.8;
}

@media (max-width: 900px) {
  .calendar-table thead th {
    font-size: 0.75rem;
    padding: 0.75rem 0;
  }

  .calendar-day {
    min-height: 130px;
    height: auto;
    padding: 0.4rem;
  }

  .day-number {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
  }

  .event {
    font-size: 0.8rem;
  }
}

/* subtle helper states retained */
.calendar-day:hover {
  background: #fff;
}

.calendar-day.is-today {
  outline: 2px solid rgba(180, 86, 40, 0.25);
  outline-offset: 2px;
}

/* Copy mobile behavior from user/workshops.css for consistent responsive UX */
@media (max-width: 768px) {
  .toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1 1 auto;
  }

  .month-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex: 1 1 auto;
  }

  .month-nav h1 {
    font-size: 1.25rem;
    margin: 0 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 0 1 60%;
    text-align: center;
  }

  .month-nav .btn-icon {
    flex: 0 0 44px;
  }

  #todayBtn {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
    touch-action: manipulation;
  }

  .calendar-toolbar {
    /* stack month header then controls */
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
    position: relative;
    z-index: 120;
  }

  .month-nav {
    order: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  #todayBtn {
    order: 2;
    margin-top: 0.5rem;
  }

  .toolbar-right {
    order: 3;
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 0.5rem;
  }

  .toolbar-right {
    display: flex;
    justify-content: center;
    width: 100%;
    z-index: 20;
    position: relative;
  }

  .toolbar-right .btn-primary {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
    touch-action: manipulation;
    z-index: 20;
    position: relative;
  }

  /* Mobile calendar header with abbreviated days */
  .calendar-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 5;
  }

  .calendar-table thead th {
    font-size: 0;
    padding: 0.6rem 0;
  }

  .calendar-table thead th::after {
    content: attr(data-short);
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
  }

  /* Mobile calendar grid improvements */
  .calendar-grid {
    position: relative;
    z-index: 1;
  }

  .calendar-day {
    min-height: 120px;
    height: auto;
    padding: 0.4rem;
    touch-action: manipulation;
    position: relative;
    z-index: 2;
  }

  .calendar-day.today {
    padding-left: calc(0.4rem - 2px);
  }

  .day-header {
    margin-bottom: 0.35rem;
  }

  .day-number {
    font-size: 0.9rem;
    font-weight: 700;
  }

  .day-name {
    display: none;
  }

  .event {
    font-size: 0.7rem;
    padding: 0.3rem 0.35rem;
    margin-bottom: 0.2rem;
    touch-action: manipulation;
  }

  .event-title {
    font-size: 0.7rem;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
    line-height: 1.3;
    margin-bottom: 0.25rem;
    display: block;
  }

  .event-time {
    font-size: 0.65rem;
    display: block;
    margin-top: 0.15rem;
  }

  .modal-content {
    width: 95%;
    max-height: 95vh;
    z-index: 1001;
  }

  .modal-overlay {
    z-index: 1000;
  }
}

@media (max-width: 480px) {
  .month-nav h1 {
    font-size: 1.1rem;
  }

  .calendar-table thead th::after {
    font-size: 0.65rem;
    letter-spacing: 0.3px;
  }

  .calendar-day {
    min-height: 110px;
    height: auto;
    padding: 0.3rem;
  }

  .calendar-day.today {
    padding-left: calc(0.3rem - 2px);
  }

  .day-number {
    font-size: 0.85rem;
  }

  .event {
    font-size: 0.65rem;
    padding: 0.25rem 0.3rem;
  }

  .event-title {
    font-weight: 600;
    font-size: 0.65rem;
    margin-bottom: 0.25rem;
    white-space: normal;
    overflow: visible;
    word-break: break-word;
    line-height: 1.3;
    display: block;
  }

  .event-time {
    font-size: 0.6rem;
    display: block;
    margin-top: 0.1rem;
  }
}

/* Add inner padding around the calendar card and responsive tweaks */
.workshops-public > .calendar-grid {
  padding: 1rem;
}

.workshops-public .workshops-public-inner > .calendar-grid {
  padding: 0.85rem;
  border-radius: 12px;
}

/* Open Workshops card above calendar */
.open-workshops-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.04);
}
.open-workshops-header h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.125rem;
  font-weight: 700;
}
.open-workshops-list .open-workshop-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-light);
}
.open-workshop-left { flex: 1 1 auto; }
.open-workshop-title { font-weight: 700; margin-bottom: 0.25rem; }
.open-workshop-meta { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.35rem; }
.open-workshop-details { color: var(--text-secondary); font-size: 0.95rem; }
.open-workshop-actions { display: flex; flex-direction: column; gap: 0.5rem; margin-left: 1rem; }
.open-workshop-actions .btn-ghost { min-width: 120px; }
.open-workshop-actions .btn-primary { min-width: 140px; }

@media (max-width: 768px) {
  .open-workshops-list .open-workshop-item { flex-direction: column; align-items: stretch; }
  .open-workshop-actions { flex-direction: row; justify-content: flex-end; gap: 0.5rem; margin-left: 0; margin-top: 0.5rem; flex-wrap: wrap; }
  .open-workshop-actions .btn-ghost, .open-workshop-actions .btn-primary { width: auto; flex: 1 1 calc(50% - 0.5rem); min-width: 0; box-sizing: border-box; }
  .open-workshops-list .open-workshop-item, .open-workshop-actions { box-sizing: border-box; }
}
.workshops-public > .calendar-grid {
  padding: 1rem;
}

@media (max-width: 900px) {
  .workshops-public > .calendar-grid {
    padding: 0.6rem;
  }

  .workshops-public .workshops-public-inner > .calendar-grid {
    padding: 0.5rem;
  }
  .workshops-public .workshops-admin > .calendar-grid {
    padding: 0.5rem;
  }

  .calendar-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .month-nav h1 {
    font-size: 1.1rem;
  }
}

/* Public sign-in modal overlay and dialog — centered overlay */
/* Modal base: hidden by default using opacity/visibility/pointer-events so it can animate */
#publicSignInModal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10060;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms cubic-bezier(.2,.9,.2,1), visibility 220ms ease;
}

/* When opened, add .is-open to animate in */
#publicSignInModal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Backdrop overlay */
#publicSignInModal .rl-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 220ms cubic-bezier(.2,.9,.2,1);
}

#publicSignInModal.is-open .rl-modal__overlay {
  opacity: 1;
}

/* Dialog: animate translate + scale for easing in */
#publicSignInModal .rl-modal__dialog {
  position: relative;
  z-index: 10061;
  max-width: 520px;
  width: calc(100% - 2rem);
  margin: 0;
  background: var(--bg-card, #ffffff);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
  transform: translateY(8px) scale(.98);
  opacity: 0;
  transition: transform 220ms cubic-bezier(.2,.9,.2,1), opacity 220ms ease;
}

#publicSignInModal.is-open .rl-modal__dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Ensure modal content does not use page flow positioning */
#publicSignInModal .rl-modal__close {
  position: absolute !important;
  right: 0.75rem !important;
  top: 0.75rem !important;
  transform: none !important;
  z-index: 10070 !important;
  border: none;
  background: transparent;
  color: var(--text-muted, #888);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  transition: color 0.15s ease;
}

#publicSignInModal .rl-modal__close:hover {
  color: var(--text-primary, #333);
}

#publicSignInModal .rl-modal__header {
  margin-bottom: 1rem;
}

#publicSignInModal .rl-modal__header h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary, #333);
}

#publicSignInModal .rl-modal__divider {
  border: 0;
  height: 1px;
  background: var(--border-light, #e5e5e5);
  margin: 1rem 0;
}

#publicSignInModal .rl-modal__body {
  margin-bottom: 1.5rem;
}

#publicSignInModal .rl-modal__body p {
  margin: 0;
  line-height: 1.6;
  color: var(--text-secondary, #666);
  font-size: 1rem;
}

#publicSignInModal .rl-modal__footer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#publicSignInModal .rl-modal__footer .btn-primary,
#publicSignInModal .rl-modal__footer .btn-ghost {
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

/* Mobile responsive tweaks for Open Workshops card */
@media (max-width: 768px) {
  .open-workshops-card {
    padding: 0.6rem;
  }

  .open-workshops-header h2 {
    font-size: 1rem;
  }

  .open-workshops-list .open-workshop-item {
    padding: 0.5rem 0;
    gap: 0.5rem;
  }

  .open-workshop-title { font-size: 1rem; }
  .open-workshop-meta { font-size: 0.9rem; }
  .open-workshop-details {
    font-size: 0.95rem;
    color: var(--text-secondary);
    /* clamp to 3 lines on small screens */
    display: -webkit-box;
    /* Standard property for broader compatibility */
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .open-workshop-actions {
    flex-direction: row;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
  }

  .open-workshop-actions .btn-primary,
  .open-workshop-actions .btn-ghost {
    padding: 0.75rem 1rem;
    min-width: 48%;
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  .open-workshops-card { padding: 0.5rem; }
  .open-workshop-title { font-size: 0.98rem; }
  .open-workshop-meta { font-size: 0.85rem; }
  .open-workshop-actions .btn-primary, .open-workshop-actions .btn-ghost { min-width: 46%; }
}

/* Mobile modal header and sizing overrides (phones only) */
@media (max-width: 600px) {
  /* Make dialog full-width-ish and constrain to viewport height */
  #publicSignInModal .rl-modal__dialog {
    width: 92vw;
    max-width: 95vw;
    max-height: 95vh;
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
  }

  /* Modal header: orange band with top-aligned title and flex-positioned close */
  #publicSignInModal .modal-header {
    background: var(--fox-orange);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    box-sizing: border-box;
    position: relative;
  }

  /* Header title should expand and not be cramped */
  #publicSignInModal .rl-modal__header {
    margin: 0;
    padding: 0;
    flex: 1 1 auto;
    min-width: 0;
  }

  #publicSignInModal .rl-modal__header h3 {
    color: #ffffff;
    font-size: 1.05rem;
    margin: 0;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 48px;
  }

  /* Place the close button at absolute top-right corner within header */
  #publicSignInModal .rl-modal__close {
    position: absolute !important;
    right: 16px !important;
    top: 12px !important;
    transform: none !important;
    z-index: 10070 !important;
    background: transparent;
    color: #ffffff;
    font-size: 1.25rem;
    padding: 4px 6px;
    width: auto;
    height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
  }

  /* Modal body should scroll if content overflows */
  #publicSignInModal .rl-modal__body {
    padding: 16px;
    overflow: auto;
  }

  #publicSignInModal .rl-modal__footer {
    padding: 16px;
  }
}

/* (Removed mobile open-workshops header styles — undo of prior change) */

/* Extra compact tweaks for very small phones */
@media (max-width: 420px) {
  #publicSignInModal .modal-header {
    padding: 12px;
  }

  #publicSignInModal .rl-modal__header h3 {
    font-size: 1rem;
  }

  #publicSignInModal .rl-modal__close {
    padding: 6px 8px;
    font-size: 1.1rem;
    min-width: 40px;
    min-height: 40px;
  }

  #publicSignInModal .rl-modal__body {
    padding: 12px;
  }

  .open-workshops-card { padding: 0.4rem; }
  .open-workshop-actions .btn-primary,
  .open-workshop-actions .btn-ghost {
    padding: 0.6rem 0.85rem;
    font-size: 0.92rem;
  }
}
