/* styles.css
   Shared styles for index.html and admin.html. Previously each page
   carried its own near-identical <style> block; this consolidates them
   so a visual change only needs to happen in one place. */

:root {
  --color-bg: #f8f9fa;
  --color-card: #ffffff;
  --color-border: #eaeaea;
  --color-heading: #1a252f;
  --color-primary: #34495e;
  --color-primary-hover: #2c3e50;
  --legend-bg: #fffde7;
  --legend-border: #fbc02d;
  --legend-text: #5d4037;
  --first-friday: #e74c3c;
  --other-month-bg: #d0d7dc;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 20px;
  background-color: var(--color-bg);
  color: #333;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  background: var(--color-card);
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 15px;
}

h1, h2 { margin: 0; color: var(--color-heading); }
h1 { font-size: 24px; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  text-decoration: none;
}
.admin-btn { background-color: var(--color-primary); color: white; transition: background 0.2s; }
.admin-btn:hover { background-color: var(--color-primary-hover); }
.btn-secondary { background-color: #ddd; color: #333; margin-right: 10px; }
.btn-danger { background-color: #e74c3c; color: white; }

/* Login card */
.auth-card {
  max-width: 400px;
  margin: 100px auto;
  background: var(--color-card);
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
.auth-card input {
  width: 100%;
  padding: 10px;
  margin: 10px 0;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.auth-card button {
  width: 100%;
  background: #27ae60;
  color: white;
  border: none;
  padding: 12px;
  font-size: 16px;
  border-radius: 4px;
  cursor: pointer;
}

.hidden { display: none !important; }

.instructions {
  background: #e8f4fd;
  color: #1d6fa5;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
}

/* FullCalendar event styling */
.fc-event {
  cursor: pointer;
  padding: 4px 6px;
  font-size: 13px;
  border-radius: 4px;
  font-weight: bold !important;
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
}
.fc-event-title { white-space: normal !important; overflow-wrap: break-word; }

.fc-daygrid-day.fc-day-other { background-color: var(--other-month-bg) !important; }
.fc .fc-daygrid-day.fc-day-other a.fc-daygrid-day-number { color: #0b3d3b !important; }
#calendar .fc-daygrid-day.fc-day-other .fc-event { opacity: 0.9; }
#calendar .fc-daygrid-day.fc-day-other:hover { background-color: #c9d1d6 !important; }

.first-friday-marker {
  color: var(--first-friday);
  font-size: 10px;
  font-weight: bold;
  padding: 2px 5px 0;
  float: left;
}
.fc-daygrid-day-top--with-marker {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

/* Static weekday legend row beneath the calendar */
.legend-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 20px;
}
.legend-cell {
  background-color: var(--legend-bg);
  border: 1px solid var(--legend-border);
  padding: 12px 8px;
  font-weight: bold;
  font-size: 12px;
  color: var(--legend-text);
  line-height: 1.5;
  border-radius: 6px;
  min-height: 80px;
}
.legend-cell-first-fri {
  color: var(--first-friday);
  font-size: 10px;
  display: block;
  margin-top: 4px;
}

/* ============================
   REQUEST PILL & BANNER
   ============================ */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.request-pill-btn {
  background: #27ae60;
  color: white;
  transition: background 0.2s;
}
.request-pill-btn:hover { background: #219a52; }

.request-banner {
  background: #e8f4fd;
  border: 1px solid #b3d7f0;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 18px !important;
  color: #1d5c85;
  gap: 10px;
}
.request-banner span { font-size: 18px !important; }
.request-banner.hidden { display: none; }
.request-banner button {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #1d5c85;
  padding: 0 4px;
  flex-shrink: 0;
}

/* ============================
   REQUEST MODAL
   ============================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-overlay.hidden { display: none; }

.modal-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.modal-card h3 {
  margin: 0 0 4px;
  color: var(--color-heading);
  font-size: 18px;
}

.modal-shift-info {
  background: #f0f4f8;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 10px 0 18px;
  font-size: 14px;
  color: #444;
  font-weight: bold;
}

.modal-card label {
  display: block;
  font-size: 13px;
  font-weight: bold;
  color: #555;
  margin-bottom: 14px;
}

.modal-card input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  margin-top: 5px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 15px;
}

.modal-card input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(52, 73, 94, 0.15);
}

.modal-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

/* ============================
   PENDING REQUESTS (admin)
   ============================ */
.pending-section {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--color-border);
}

.pending-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.pending-section-header h3 { margin: 0; color: var(--color-heading); }

.badge {
  background: #e74c3c;
  color: white;
  font-size: 11px;
  font-weight: bold;
  border-radius: 12px;
  padding: 2px 8px;
}

.request-card {
  border: 1px solid var(--color-border);
  border-left: 4px solid #fbc02d;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: #fffde7;
}

.request-meta {
  font-size: 14px;
  margin-bottom: 10px;
  line-height: 1.8;
}
.request-meta strong { color: var(--color-heading); }

.request-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.reject-expand {
  display: none;
  width: 100%;
  margin-top: 10px;
}

.reject-expand textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 13px;
  resize: vertical;
  min-height: 70px;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.no-pending {
  color: #888;
  font-style: italic;
  font-size: 14px;
}

/* ============================
   Print title
   ============================ */
/* Print title — hidden on screen, shown only when printing */
.print-title {
  display: none;
}

/* Scroll hint — only visible on mobile, fades once user scrolls */
.scroll-hint {
  display: none;
}

/* ============================
   MOBILE STYLES
   ============================ */
@media (max-width: 767px) {
  body { padding: 10px; }

  .container { padding: 15px; }

  /* Legend is only meaningful as column labels under the month grid */
  .legend-row { display: none; }

  /* Make list-view events easier to tap */
  .fc-list-event-title { font-size: 15px; }
  .fc-list-event td { padding: 10px 8px; }

  h1 { font-size: 18px; }

  /* Scroll hint — fixed arrow at bottom of screen */
  .scroll-hint {
    display: block;
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(52, 73, 94, 0.85);
    color: white;
    font-size: 14px;
    padding: 8px 18px;
    border-radius: 20px;
    pointer-events: none;
    transition: opacity 0.5s ease;
    z-index: 999;
  }
  .scroll-hint.hidden { opacity: 0; }
}

/* ============================
   PRINT STYLES (both pages)
   ============================ */
@media print {
  @page { size: landscape; margin: 0.4in; }

  body { background: white !important; padding: 0; margin: 0; }

  .container {
    box-shadow: none !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Nothing on either page needs to be interactive on paper */
  .auth-card,
  .instructions,
  .btn,
  #logoutBtn,
  .header {
    display: none !important;
  }

  /* Hide Today button, prev/next arrows, and Month/Week view buttons */
  .fc-today-button,
  .fc-prev-button,
  .fc-next-button,
  .fc-dayGridMonth-button,
  .fc-timeGridWeek-button,
  .fc-toolbar-chunk:first-child,
  .fc-toolbar-chunk:last-child {
    display: none !important;
  }

  /* Print title above the month/year */
  .print-title {
    display: block !important;
    text-align: center;
    font-size: 20pt;
    font-weight: bold;
    color: #1a252f;
    margin-bottom: 4px;
  }

  #calendar, .legend-row { width: 100% !important; }

  /* Force FullCalendar's internal tables to fill the full page width */
  .fc-scrollgrid,
  .fc-scrollgrid table,
  .fc-daygrid-body,
  .fc-daygrid-body table {
    width: 100% !important;
  }

  /* Scale up calendar text to fill the page */
  .fc { font-size: 11pt !important; }
  .fc-col-header-cell { font-size: 11pt !important; }
  .fc-daygrid-day-number { font-size: 11pt !important; }
  .fc-event { font-size: 9pt !important; padding: 3px 5px !important; }
  .fc-toolbar-title { font-size: 16pt !important; }

  /* Align legend row to calendar's 7-column table layout */
  .legend-row {
    display: table !important;
    width: 100% !important;
    table-layout: fixed !important;
    border-collapse: separate !important;
    border-spacing: 4px 0 !important;
    margin-top: 6px !important;
  }
  .legend-cell {
    display: table-cell !important;
    font-size: 9pt !important;
  }

  /* Force background colors to print */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .fc-daygrid-day, .fc-event, .legend-cell {
    page-break-inside: avoid;
  }
}
