/* =========================
   IMPORTS
============================= */
@import "components/share-menu.css";

/* =========================
   BASE STYLES
============================= */
body {
  font-family: Arial, sans-serif;
  padding: 20px;
  background: #fff;
  color: #222;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =========================
   MODALS (overlay popups)
============================= */
.modal {
  position: fixed;
  inset: 0; /* top:0;right:0;bottom:0;left:0 */
  background: rgba(0, 0, 0, 0.45);
  display: none; /* toggled to flex in JS */
  align-items: center;
  justify-content: center;
  z-index: 1200; /* above theme summary (900) and calendar */
  padding: 16px;
  box-sizing: border-box;
}
.modal .modal-content {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.2);
  max-width: 720px;
  width: 100%;
  padding: 20px;
  position: relative;
}
.modal .close {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 20px;
  cursor: pointer;
}

/* Shared button look for header/footer buttons */
.header-btn,
.footer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px; /* base spacing */
  line-height: 1.2;
  border-radius: 6px;
  box-sizing: border-box; /* consistent sizing */
}

h1 {
  font-size: 24px;
  margin-bottom: 10px;
}

/* =========================
   THEME SUMMARY TABLE
   Clean & Responsive UI
============================= */
.theme-summary {
  position: fixed;
  top: 10px;
  right: 20px;
  width: 280px;
  max-height: 420px;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  padding: 16px 18px;
  z-index: 900;
  font-family: 'Helvetica Neue', sans-serif;
}

#themeSummaryTable {
  transition: max-height 0.3s ease;
  overflow: hidden;
}

.theme-summary h2 {
  font-size: 1.05rem;
  margin: 0 0 12px;
  color: #111;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.theme-summary table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.theme-summary th,
.theme-summary td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

.theme-summary th {
  background: #2563eb;
  color: #ffffff;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.04em;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

.theme-summary tr:nth-child(even) td {
  background-color: #f6f9ff;
}

.theme-summary tr:hover td {
  background-color: #e9f1ff;
}

/* =========================
   TOP ACTIONS BUTTONS
============================= */
.top-actions {
  margin-bottom: 25px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
}

.top-actions .button-link,
.top-actions button {
  padding: 10px 16px;
  background: #3a86ff;
  color: white;
  border: none;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.2s ease;
  user-select: none;
}

.top-actions .button-link:hover,
.top-actions button:hover {
  background: #265cbf;
}

#deleteAllBtn {
  background: #d64545;
}

#deleteAllBtn:hover {
  background: #a82b2b;
  color: white;
}

/* =========================
   CALENDAR NAVIGATION
============================= */
.calendar-nav {
  margin-bottom: 15px;
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  justify-content: center;
  gap: 20px;
}

.calendar-nav a {
  color: #3a86ff;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
  cursor: pointer;
}

.calendar-nav a:hover {
  color: #265cbf;
}

.calendar-nav strong {
  font-weight: 700;
  color: #333;
}

/* =========================
   CALENDAR TABLE
============================= */
.calendar-wrap { width: 100%; max-width: 960px; margin: 0 auto; }
.calendar { width: 100%; table-layout: fixed; }
.calendar th, .calendar td { width: calc(100% / 7); }

.calendar-vars,
:root {
  /* Defaults (can be overridden by theme on body) */
  --calendar-badge-bg: #2ea44f;
  --calendar-badge-fg: #ffffff;
  --calendar-today-outline: #3a86ff;
  --calendar-today-bg: #f0f6ff;
  --calendar-today-link: #444444;
  --calendar-today-link-hover: #000000;
  --day-col: 160px;            /* width of a day column */
  --calendar-cell-h: 120px;    /* uniform cell height to fit two lines */
}

/* Theme overrides: Gents */
body.theme-gents {
  --calendar-badge-bg: #004696;           /* theme primary */
  --calendar-badge-fg: #ffffff;
  --calendar-today-outline: #004696;
  --calendar-today-bg: rgba(0, 70, 150, 0.08);
  --calendar-today-link: #004696;
  --calendar-today-link-hover: #002c5a;
}

.calendar {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  border-radius: 8px;
  overflow: hidden;
}

.calendar th,
.calendar td {
  border: 1px solid #ccc;
  text-align: center;
  padding: 6px 8px; /* smaller */
  width: calc(100% / 7); /* 7 days */
  cursor: pointer;
  transition: background-color 0.2s ease;
  user-select: none; /* prevent text selection on click */
  font-size: 14px; /* smaller text */
}

.calendar td:hover {
  background-color: #eef4ff;
}

.calendar-day.scheduled {
  background-color: #cfe9d6;
  font-weight: bold;
  color: #246b29;
}

/* Badge and day number inside cells */
.calendar td { position: relative; height: var(--calendar-cell-h); vertical-align: top; overflow: hidden; }
.calendar .day-num { display: block; font-weight: 600; }
.calendar .day-num {
  position: absolute;
  top: 6px;
  left: 6px;
  font-weight: 600;
}

.calendar .day-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--calendar-badge-bg);
  color: var(--calendar-badge-fg);
  font-size: 11px;
  line-height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.calendar .events { margin-top: 24px; display: block; }
.calendar .event {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  line-height: 1.2;
  color: #444;
}
.calendar .more { margin-top: 2px; font-size: 12px; color: #666; }

/* Today and weekend highlights */
.calendar-day.today { outline: 2px solid var(--calendar-today-outline); outline-offset: -2px; background: var(--calendar-today-bg); }
.calendar-day.weekend:not(.scheduled) { background-color: #fafafa; }

/* Legend under calendar */
.calendar-legend {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin: 8px 0 16px;
  font-size: 0.9rem;
}
.calendar-legend .legend-item { display: inline-flex; align-items: center; color: #444; }
.calendar-legend .legend-item .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.calendar-legend .legend-item .dot.scheduled { background: var(--calendar-badge-bg); }
.calendar-legend .legend-item .dot.today { background: var(--calendar-today-outline); }

/* Style the Today link in nav */
.calendar-nav .today-link { color: var(--calendar-today-link); text-decoration: underline; }
.calendar-nav .today-link:hover { color: var(--calendar-today-link-hover); }

/* Responsive shrinking for calendar cells */
@media screen and (max-width: 600px) {
  .calendar td { padding: 4px 6px; height: 44px; font-size: 12px; }
  .calendar .day-num { font-size: 12px; }
  .calendar .day-badge { min-width: 16px; height: 16px; font-size: 10px; line-height: 16px; }
  .calendar .events { margin-top: 18px; }
}

/* Make dashboard page width equal to one calendar month width */
body.dashboard-page { max-width: 960px; width: 100%; margin: 0 auto; }

@media screen and (max-width: 480px) {
  .calendar th,
  .calendar td {
    padding: 6px 8px;
    height: var(--calendar-cell-h);
    font-size: 14px;
    vertical-align: top;
    position: relative;
    overflow: hidden; /* prevent cell growth */
  }

  h1 {
    font-size: 20px;
  }

  /* Quote table smaller font for mobile */
  .quote-table {
    font-size: 13px;
  }

  /* Modal content max width smaller on mobile */
  .modal-content {
    max-width: 90%;
    padding: 15px;
  }
}
.theme-color {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.scheduled-quote {
  background-color: #e6ffe6 !important;
}

/* Quote list outline and pagination */
.quote-list-wrap.outlined {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.quote-list-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.quote-list-controls .per-page {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.quote-list-controls select {
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #cfd6e4;
  border-radius: 6px;
  background: #fff;
}

.pagination { display: flex; gap: 6px; justify-content: center; margin: 12px 0; }
.pagination button {
  padding: 8px 12px;
  border: none;
  background: #3a86ff;
  color: #fff;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}
.pagination button:hover { background: #265cbf; }
.pagination button[disabled] { opacity: 0.55; cursor: not-allowed; }
.pagination button.active { background: #265cbf; }

/* Quote table inner dividers */
.quote-table {
  width: 100%;
  border-collapse: separate; /* allow inner borders without collapsing radius */
  border-spacing: 0;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.quote-table thead th {
  background: #f7f9fc;
  font-weight: 600;
  border-bottom: 1px solid #e3e7ee;
}
.quote-table th, .quote-table td {
  padding: 10px 12px;
}
.quote-table tbody td {
  border-top: 1px solid #eee; /* row dividers */
}
.quote-table th + th, .quote-table td + td {
  border-left: 1px solid #f0f0f0; /* column dividers */
}
.quote-table tbody tr:hover td {
  background: #fafcff;
}

/* Optional subtle striping */
.quote-table tbody tr:nth-child(even) td { background: #fcfdff; }

/* Filters bar aligns with controls */
#filterForm {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
#filterForm select,
#filterForm input[type="text"],
#filterForm button {
  padding: 8px 10px;
  font-size: 14px;
  border-radius: 6px;
}
#filterForm select,
#filterForm input[type="text"] { border: 1px solid #cfd6e4; background: #fff; }
#filterForm button { background: #3a86ff; color: #fff; border: none; font-weight: 600; cursor: pointer; }
#filterForm button:hover { background: #265cbf; }

/* Modal form controls */
.modal .modal-content label { display: inline-block; margin: 6px 6px 4px 0; font-weight: 600; }
.modal .modal-content input[type="text"],
.modal .modal-content textarea,
.modal .modal-content select {
  width: 100%;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid #cfd6e4;
  border-radius: 6px;
  box-sizing: border-box;
  margin-bottom: 10px;
}
.modal .modal-content button {
  padding: 10px 14px;
  background: #3a86ff;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}
.modal .modal-content button:hover { background: #265cbf; }

/* =========================
   FOOTER RESPONSIVENESS
============================= */
.bottom-bar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 12px 20px;
  font-size: 16px;
  border-top: 1px solid #ccc;
  margin-top: auto;
  max-width: 960px; /* do not exceed specified width */
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
}

.bottom-bar .left,
.bottom-bar .right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Mobile tweaks */
@media screen and (max-width: 600px) {
  .bottom-bar {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px 12px; /* tighter container padding */
  }

  .bottom-bar .left,
  .bottom-bar .right {
    width: 100%;
    justify-content: center;
    margin-bottom: 4px; /* tighter and consistent across header/footer */
    gap: 4px; /* tighter */
  }

  .footer-btn {
    flex: 1 0 40%;
    min-width: 110px;
    margin: 0; /* rely on gap for spacing */
    padding: 6px 8px; /* smaller padding on mobile */
    min-height: 34px; /* consistent button height */
  }

  /* remove trailing bottom space on last row */
  .bottom-bar .right:last-child { margin-bottom: 0; }
}

/* =========================
   TOP MENU RESPONSIVENESS
============================= */
.top-bar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 12px 20px;
  font-size: 16px;
  border-bottom: 1px solid #ccc;
  max-width: 960px; /* do not exceed specified width */
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
}

.top-bar .left,
.top-bar .right {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Mobile tweaks */
@media screen and (max-width: 600px) {
  .top-bar {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px 12px; /* tighter container padding */
  }

  .top-bar .left,
  .top-bar .right {
    width: 100%;
    justify-content: center;
    margin-bottom: 4px; /* tighter and consistent across header/footer */
    gap: 4px; /* tighter */
  }

  .header-btn {
    flex: 1 0 40%;
    min-width: 110px;
    margin: 0; /* rely on gap for spacing */
    padding: 6px 8px; /* smaller padding on mobile */
    min-height: 34px; /* consistent button height */
  }

  /* remove trailing bottom space on last row */
  .top-bar .right:last-child { margin-bottom: 0; }
}

/* Extra-tight spacing for very small devices (<=480px) */
@media screen and (max-width: 480px) {
  .top-bar .left,
  .top-bar .right,
  .bottom-bar .left,
  .bottom-bar .right {
    margin-bottom: 2px; /* identical tighter spacing */
    gap: 2px; /* even tighter gaps on very small screens */
  }

  .header-btn,
  .footer-btn {
    margin: 0; /* rely on gap */
    padding: 4px 8px; /* extra-tight padding */
    line-height: 1.15; /* compact but readable */
    min-height: 32px; /* uniform height */
  }

  .top-bar,
  .bottom-bar {
    padding: 4px 8px; /* extra-tight container padding */
  }

  /* slightly smaller font for buttons to avoid wrap and keep height tight */
  .header-btn,
  .footer-btn { font-size: 13px; }
}

/* Ultra-compact preset for very small devices (<=360px) */
@media screen and (max-width: 360px) {
  .top-bar .left,
  .top-bar .right,
  .bottom-bar .left,
  .bottom-bar .right {
    margin-bottom: 1px;
    gap: 1px;
  }

  .header-btn,
  .footer-btn {
    font-size: 12.5px;
    padding: 3px 7px;
    min-height: 30px;
  }

  .top-bar,
  .bottom-bar {
    padding: 3px 6px;
  }

  /* ensure no trailing space on last row in ultra-compact */
  .top-bar .right:last-child,
  .bottom-bar .right:last-child { margin-bottom: 0; }
}

/* =========================
   QUOTE DISPLAY - Info Icon & Explanation
============================= */
.quote-container {
  position: relative;
  width: 100%;
}

.info-icon {
  position: absolute;
  top: -10px;
  right: -4px;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.6;
  padding: 2px;
  transition: opacity 0.2s ease;
}

.info-icon:hover {
  opacity: 1;
}

.explanation-bubble {
  position: absolute;
  top: 20px;
  right: 0;
  background: #fff;
  color: #111;
  padding: 10px;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  max-width: 300px;
  font-size: 0.9rem;
  line-height: 1.4;
  z-index: 10;
  display: none;
}

/* =========================
   FADE-IN ANIMATION
============================= */
.fade-in {
  opacity: 0;
  animation: fadeIn 0.6s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Additional layout sections remain unchanged
   and are preserved in your current stylesheet. */
   
.share-container {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
  min-width: 180px;
  position: absolute;
  z-index: 999;
}

.dropdown-menu.hidden {
  display: none;
}

.dropdown-menu li {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #1f2d3d;
  white-space: nowrap;
}

.dropdown-menu li:hover {
  background-color: #f0f0f0;
}
/* Arrow rotation */
.arrow {
  display: inline-block;
  transition: transform 0.3s ease;
}

/* Rotated state when open */
.share-container[aria-expanded="true"] .arrow {
  transform: rotate(180deg);
}

/* Dropdown animation */
.dropdown-menu {
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.dropdown-menu.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* =========================
   Scheduled Quote Preview Card
   (in Schedule modal)
============================= */
.scheduled-preview {
  border: 2px solid #3a86ff; /* primary accent border */
  border-radius: 10px;
  padding: 14px 16px;
  background: #f7fbff; /* subtle background to lift card */
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 10px;
}
.scheduled-preview .sp-text {
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 8px;
}
.scheduled-preview .sp-meta {
  font-size: 0.9rem;
  color: #444;
  margin-bottom: 10px;
}
.scheduled-preview .sp-actions {
  display: flex;
  gap: 8px;
}
.scheduled-preview .sp-actions .deleteScheduledBtn {
  background: #d64545;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
}
.scheduled-preview .sp-actions .deleteScheduledBtn:hover {
  background: #a82b2b;
}

/* Helper states for preview area */
#schedulePreview .preview-empty,
#schedulePreview .preview-none,
#schedulePreview .preview-error,
#schedulePreview .preview-loading {
  padding: 10px 12px;
  border: 1px solid #e3e7ee;
  border-radius: 8px;
  background: #fafcff;
  color: #333;
}
/* =========================
   CUSTOM QUOTE DISPLAY FIXES
   Mobile-friendly quote layout + 2-column buttons
============================= */

/* Keep on-screen quote layout capped at 960px on wide screens */
@media screen and (min-width: 961px) {
  .quote-wrapper,
  .quote-container,
  blockquote#quoteContainer {
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }
}

/* Force quote block to full width on mobile */
@media screen and (max-width: 600px) {
  .quote-wrapper {
    width: 100%;
    padding: 0 12px;
    box-sizing: border-box;
  }

  .quote-container {
    width: 100%;
    max-width: 100%;
  }

  blockquote {
    text-align: center;
    width: 100%;
    padding: 0 10px;
  }
}