:root {
  --bg: #f3f2f0;
  --panel: #ffffff;
  --text: #1a1a1a;
  --accent: #d96f15;
  --accent-light: #f0a050;
  --danger: #b82020;
  --danger-dark: #8f1818;
  --success: #239a3b;
  --muted: #565656;
  --border: #c4c2bc;
}

* {
  box-sizing: border-box;
  font-family: 'Arial', sans-serif;
}

body {
  margin: 0;
  background: linear-gradient(160deg, #2a2218 0%, #1c1814 30%, #2a2218 100%);
  color: var(--text);
  direction: rtl;
}

.main-header {
  background: linear-gradient(160deg, #1c1814 0%, #2a2218 50%, #1c1814 100%);
  color: white;
  text-align: center;
  padding: 1.5rem 1rem;
  border-bottom: 3px solid var(--accent);
}

.main-header h1 {
  font-size: 1.6rem;
  margin: 0.4rem 0 0.2rem;
  letter-spacing: 0.5px;
}

.main-header > p {
  margin: 0;
  font-size: 0.95rem;
  color: #c8bfb0;
}

.whatsapp-help {
  text-align: center;
  margin: 1rem 0 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.whatsapp-help a {
  color: #25d366;
  font-weight: bold;
  text-decoration: none;
}
.whatsapp-help a:hover {
  text-decoration: underline;
}

.header-logo {
  max-height: 140px;
  max-width: 280px;
  object-fit: contain;
  margin-bottom: 0.4rem;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.container {
  width: min(1100px, 95%);
  margin: 1.5rem auto;
  display: grid;
  gap: 1.2rem;
}

section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem;
}

section h2 {
  margin-top: 0;
  color: var(--accent);
}

.training-buttons {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.month-picker-wrap {
  display: grid;
  gap: 0.35rem;
}

.month-picker-wrap label {
  margin-bottom: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.month-picker-wrap input {
  min-width: 180px;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}

.legend-swatch.available {
  background: #2ca155;
}

.legend-swatch.blocked {
  background: #d34c4c;
}

.legend-swatch.full {
  background: #8d8d8d;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.45rem;
}

.calendar-weekday {
  text-align: center;
  font-weight: bold;
  color: var(--muted);
  padding: 0.35rem;
}

.calendar-day {
  min-height: 82px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
}

button.calendar-day {
  cursor: pointer;
}

.calendar-day-empty {
  border: none;
  background: transparent;
}

.calendar-day.available {
  background: #e6f7e5;
  border-color: #35a15a;
}

.calendar-day.blocked {
  background: #ffe6e6;
  border-color: #d34c4c;
  color: #772f2f;
}

.calendar-day.full {
  background: #ececec;
  border-color: #9a9a9a;
  color: #4d4d4d;
}

.calendar-day.selected {
  box-shadow: 0 0 0 3px rgba(217, 111, 21, 0.4);
}

.day-number {
  font-weight: bold;
  font-size: 1.05rem;
}

.day-subtitle {
  font-size: 0.78rem;
}

.day-times-panel {
  margin-top: 1rem;
  border-top: 1px dashed var(--border);
  padding-top: 1rem;
}

.time-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.time-option {
  border: 1px solid #d96f15;
  background: #fdf4eb;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  min-width: 140px;
  text-align: center;
}

.time-option strong {
  display: block;
  margin-bottom: 0.2rem;
}

.time-option span {
  font-size: 0.82rem;
  color: var(--muted);
}

.time-option.selected {
  box-shadow: 0 0 0 3px rgba(217, 111, 21, 0.4);
}

.selected-date-label {
  margin-top: 0;
  color: var(--accent);
  font-weight: bold;
}

.training-btn,
.admin-btn,
.submit-btn,
.danger-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1rem;
  cursor: pointer;
}

.training-btn.active,
.admin-btn.active {
  background: var(--accent-light);
}

.training-btn:hover,
.admin-btn:hover,
.submit-btn:hover,
.danger-btn:hover {
  opacity: 0.85;
}

.danger-btn {
  background: var(--danger);
}

.danger-btn:hover {
  background: var(--danger-dark);
}

.danger-btn-small {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.78rem;
  cursor: pointer;
  margin-right: 8px;
  vertical-align: middle;
}
.danger-btn-small:hover {
  background: var(--danger-dark);
}

.slots-grid,
.admin-slots-list {
  display: grid;
  gap: 0.75rem;
}

.slots-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.slot {
  width: 100%;
  border: 1px solid #d96f15;
  border-radius: 10px;
  padding: 0.85rem;
  background: #fdf4eb;
  text-align: center;
  cursor: pointer;
}

.slot.selected {
  box-shadow: 0 0 0 3px rgba(217, 111, 21, 0.4);
}

.slot strong,
.admin-slot-card strong {
  display: block;
  margin-bottom: 0.4rem;
}

.slot-meta {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
}

.field-group {
  margin-bottom: 0.8rem;
}

.field-group-submit {
  align-self: end;
}

label {
  display: block;
  margin-bottom: 0.3rem;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid #b9b9b9;
  border-radius: 6px;
}

input.field-error,
textarea.field-error,
input[type="file"].field-error {
  border-color: #d34c4c;
  background-color: #fff5f5;
}

.message {
  margin-top: 1rem;
  font-weight: bold;
}

.message.success {
  color: var(--success);
}

.message.error {
  color: var(--danger);
}

.note {
  color: var(--muted);
}

.hidden {
  display: none;
}

.empty-state {
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
}

.admin-shell {
  max-width: 980px;
}

.admin-calendar-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: end;
  margin-bottom: 0.85rem;
}

.day-editor {
  margin-top: 1rem;
  border-top: 1px dashed var(--border);
  padding-top: 1rem;
}

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.admin-form {
  max-width: 560px;
}

.admin-form-grid {
  max-width: none;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
}

.admin-slots-list {
  margin-top: 1rem;
}

.admin-slot-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafaf7;
}

.admin-slot-main {
  flex: 1;
}

.slot-edit-label {
  display: block;
  margin: 0.25rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.slot-edit-input {
  max-width: 280px;
  margin-bottom: 0.35rem;
}

.slot-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.registrants-block {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
}

.registrants-title {
  font-weight: bold;
  margin-bottom: 0.35rem;
}

.registrants-list {
  margin: 0;
  padding-inline-start: 1.25rem;
  color: var(--muted);
}

.registrants-list li {
  margin-bottom: 0.5rem;
}

.registrants-list span {
  display: block;
}

.admin-slot-card.full {
  border-color: #d5aaaa;
  background: #fff1f1;
}

.admin-slot-card.available {
  border-color: #f0a050;
}

@media (max-width: 640px) {
  .calendar-header,
  .admin-calendar-controls,
  .admin-toolbar,
  .admin-slot-card {
    flex-direction: column;
    align-items: stretch;
  }

  .calendar-grid {
    gap: 0.3rem;
  }

  .calendar-day {
    min-height: 72px;
    padding: 0.35rem;
  }

  .slot-actions {
    flex-direction: column;
  }

  .training-btn,
  .admin-btn,
  .submit-btn,
  .danger-btn {
    width: 100%;
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem 2rem 2rem;
  text-align: center;
  max-width: 360px;
  width: 90%;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.modal-close:hover {
  background: #f0f0f0;
}

.modal-icon {
  font-size: 3rem;
  color: var(--success);
  margin-bottom: 0.5rem;
}

.modal-title {
  margin: 0 0 0.5rem;
  color: var(--success);
  font-size: 1.4rem;
}

.modal-text {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.modal-box-large {
  max-width: 540px;
  max-height: 88vh;
  overflow-y: auto;
  text-align: right;
  padding: 1.75rem 1.5rem 1.5rem;
}

.modal-appointment {
  background: #eef4ff;
  border: 1px solid #b8d0f0;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin: 0.5rem 0 1rem;
  font-size: 1rem;
  line-height: 1.7;
}

.modal-section-title {
  font-weight: bold;
  font-size: 0.95rem;
  margin: 1rem 0 0.4rem;
  color: var(--text);
}

.modal-list {
  margin: 0 0 0.5rem;
  padding-inline-start: 1.4rem;
  color: #333;
  font-size: 0.93rem;
}

.modal-list li {
  margin-bottom: 0.35rem;
}

.modal-alert {
  background: #fff3f3;
  border: 1px solid #e57373;
  border-radius: 8px;
  padding: 0.7rem 1rem;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

.modal-alert p,
.modal-warning p {
  margin: 0.3rem 0 0;
}

.modal-warning {
  background: #fff8e1;
  border: 1px solid #f9c74f;
  border-radius: 8px;
  padding: 0.7rem 1rem;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

.modal-confirm-btn {
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.85rem;
  font-size: 1rem;
  background: var(--success);
}
