/* ============================================
   Kristie's Calendars
   ============================================ */

:root {
  --sun: #ff8080;
  --mon: #ffcc99;
  --tue: #ffff99;
  --wed: #ccffcc;
  --thu: #99ccff;
  --fri: #ccccff;
  --sat: #cc99ff;
  --holiday: #cc0000;
  --muted: #969696;
  --border: #000000;
  --bg: #f5f5f5;
  --panel-bg: #ffffff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: #333;
}

.hidden {
  display: none !important;
}

/* ============================================
   SETUP PANEL
   ============================================ */

#setup-panel {
  max-width: 640px;
  margin: 40px auto;
  background: var(--panel-bg);
  border-radius: 12px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.08);
  padding: 40px;
}

.setup-header {
  text-align: center;
  margin-bottom: 32px;
}

.setup-logo {
  max-height: 80px;
  margin-bottom: 12px;
}

.setup-header h1 {
  font-size: 36px;
  color: #7b2d8e;
  margin-bottom: 4px;
}

.setup-subtitle {
  color: #666;
  font-size: 14px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: bold;
  font-size: 13px;
  margin-bottom: 4px;
  color: #444;
}

.form-group .hint {
  font-weight: normal;
  color: #999;
  font-size: 12px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #99ccff;
  box-shadow: 0 0 0 3px rgba(153, 204, 255, 0.3);
}

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

.form-actions button {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

#btn-generate {
  background: linear-gradient(135deg, #4a90d9, #667eea);
  color: white;
}

#btn-generate:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 144, 217, 0.4);
}

#btn-blank {
  background: #e8e8e8;
  color: #555;
}

#btn-blank:hover {
  background: #ddd;
}

/* ============================================
   TOOLBAR
   ============================================ */

#toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: white;
  border-bottom: 1px solid #ddd;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.toolbar-left,
.toolbar-right {
  display: flex;
  gap: 8px;
}

#toolbar button {
  padding: 8px 16px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: white;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

#toolbar button:hover {
  background: #f0f0f0;
}

#toolbar .btn-primary {
  background: linear-gradient(135deg, #4a90d9, #667eea);
  color: white;
  border: none;
  font-weight: bold;
}

#toolbar .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(74, 144, 217, 0.3);
}

/* ============================================
   LOADING OVERLAY
   ============================================ */

#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.92);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-content {
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e0e0e0;
  border-top-color: #4a90d9;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loading-text {
  font-size: 16px;
  color: #555;
}

/* ============================================
   CALENDAR PAGE (matches PDF layout)
   ============================================ */

#calendar-wrapper {
  padding: 20px;
  display: flex;
  justify-content: center;
}

#calendar-page {
  /* Landscape letter: 11in x 8.5in */
  width: 11in;
  height: 8.5in;
  background: white;
  box-shadow: 0 2px 20px rgba(0,0,0,0.1);
  padding: 0.15in 0.25in;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Header: logo upper-left, title centered, donate upper-right */
#cal-header {
  display: flex;
  align-items: center;
  height: 1.15in;
  flex-shrink: 0;
}

#cal-logo {
  flex-shrink: 0;
  width: 2.2in;
}

#cal-logo img {
  max-height: 0.95in;
  max-width: 2.2in;
  object-fit: contain;
}

#cal-title-bar {
  flex: 1;
  text-align: center;
}

#cal-title-text {
  font-family: Arial, sans-serif;
  font-weight: bold;
  font-size: 20px;
  color: #000;
}

#cal-donate {
  flex-shrink: 0;
  width: 2.2in;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.donate-above {
  font-size: 9px;
  font-weight: bold;
  color: #333;
  margin-bottom: 1px;
}

#cal-donate img {
  max-height: 0.65in;
  max-width: 2.2in;
  object-fit: contain;
}

.donate-below {
  font-size: 9px;
  font-weight: bold;
  color: #333;
  margin-top: 1px;
}

/* Calendar grid */
#cal-grid {
  flex: 1;
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

#cal-grid thead th {
  font-family: Arial, sans-serif;
  font-weight: bold;
  font-size: 13px;
  padding: 3px 0;
  text-align: center;
  border: 1px solid var(--border);
}

.day-sun { background: var(--sun); }
.day-mon { background: var(--mon); }
.day-tue { background: var(--tue); }
.day-wed { background: var(--wed); }
.day-thu { background: var(--thu); }
.day-fri { background: var(--fri); }
.day-sat { background: var(--sat); }

#cal-grid tbody td {
  border: 1px solid var(--border);
  vertical-align: top;
  padding: 2px 4px;
  height: 1.04in;
  position: relative;
  font-size: 9.5px;
  line-height: 1.25;
}

#cal-grid tbody td:hover {
  outline: 2px solid #4a90d9;
  outline-offset: -2px;
  cursor: text;
}

.day-number {
  font-weight: bold;
  font-size: 11px;
  margin-bottom: 1px;
  display: block;
  line-height: 1.2;
}

.day-number.outside {
  color: var(--muted);
}

.day-number.holiday-date {
  color: var(--holiday);
}

.holiday-label {
  font-weight: bold;
  color: var(--holiday);
  font-size: 9.5px;
  display: block;
  margin-bottom: 1px;
}

.day-content {
  font-size: 11px;
  line-height: 1.25;
  color: #000;
  outline: none;
  min-height: 12px;
}

.day-content:focus {
  background: #fffde7;
}

/* Footer */
#cal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 8px 4px;
  flex-shrink: 0;
  font-size: 9.5px;
}

#cal-footer-website {
  font-weight: bold;
  color: #0000ff;
}

#cal-footer-tagline {
  font-weight: bold;
  color: #000;
  font-style: italic;
}

/* ============================================
   CONTEXT MENU (right-click on cell)
   ============================================ */

#context-menu {
  position: fixed;
  z-index: 500;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 4px 0;
  min-width: 180px;
  display: none;
}

#context-menu .menu-item {
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  display: block;
  width: 100%;
  border: none;
  background: none;
  text-align: left;
  font-family: inherit;
}

#context-menu .menu-item:hover {
  background: #f0f4ff;
}

/* ============================================
   EMAIL MODAL
   ============================================ */

#email-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 12px;
  padding: 32px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-content h2 {
  font-size: 22px;
  color: #7b2d8e;
  margin-bottom: 8px;
}

.modal-content p {
  font-size: 14px;
  color: #666;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions button {
  flex: 1;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s;
}

.modal-actions .btn-primary {
  background: linear-gradient(135deg, #7b2d8e, #9b59b6);
  color: white;
  border: none;
}

.modal-actions .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(123,45,142,0.4);
}

.modal-actions .btn-secondary {
  background: #e8e8e8;
  color: #555;
  border: none;
}

.modal-actions .btn-secondary:hover {
  background: #ddd;
}

/* Disable hover highlight during export */
#calendar-page.exporting td:hover {
  outline: none;
}

#calendar-page.exporting .day-content {
  cursor: default;
}

/* ============================================
   PRINT / PDF STYLES
   ============================================ */

@media print {
  body * {
    visibility: hidden;
  }
  #calendar-page, #calendar-page * {
    visibility: visible;
  }
  #calendar-page {
    position: absolute;
    left: 0;
    top: 0;
    box-shadow: none;
  }
  #toolbar {
    display: none !important;
  }
}
