/* ===========================================
 * FishPartner Calendar Stylesheet
 * =========================================== */

/* ===== Typography and Layout ===== */
.fp-calendar-header {
  margin-bottom: 0.5em;
  text-align: left;
}

.fp-calendar-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5em;
  flex-wrap: wrap;
  gap: 0.5em;
}

.fp-calendar-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0;
}

.fp-calendar {
  margin-bottom: 1em;
  font-family: system-ui, sans-serif;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

/* ===== Calendar Table ===== */
.fp-calendar table {
  min-width: max-content;
  min-width: 700px;
  border-collapse: collapse;
  text-align: center;
  margin-bottom: 0;
}

.fp-calendar th,
.fp-calendar td {
  min-width: 60px;
  padding: 1em 0.8em;
}

.fp-calendar th {
  background-color: #f8f8f8;
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 1px solid #d3d3d3;
  position: sticky;
  top: 0;
  z-index: 3;
}

.fp-calendar td {
  font-size: 0.9rem;
  padding: 1em 0.7em;
  border: 1px solid #ebebeb !important;
  border-bottom: 1px solid #eee;
  transition: background-color 0.2s ease;
}

.fp-calendar td.today,
.fp-calendar th.today {
  background-color: #e6f7ff !important;
  font-weight: bold;
}

.fp-calendar td.available a {
  text-decoration: none;
  color: #5b5b5b;
  display: block;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.fp-calendar td.empty {
  background-color: #fff;
  color: #ccc;
}

.fp-calendar td:first-child,
.fp-calendar th:first-child {
  font-weight: 500;
  text-align: left;
  background-color: #fff;
  position: sticky;
  left: 0;
  z-index: 2;
}

/* ===== Navigation Buttons ===== */
.fp-calendar-nav {
  margin-bottom: 1em;
  text-align: right;
}

.fp-calendar-nav a.fp-nav-button {
  background-color: #f0f0f0;
  color: #333;
  padding: 8px 14px;
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  transition: background 0.2s ease;
  width: 40px;
  height: 40px;
  text-decoration: none;
  margin: 0 0.25em;
}

.fp-calendar-nav a.fp-nav-button:hover {
  background-color: #ddd;
}

/* ===== Modal (Quick View) ===== */
.fp-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: none;
  z-index: 9999;
}

.fp-modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 1;
}

.fp-modal-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 90%;
  max-width: 700px;
}

.fp-modal-content {
  background: #fff;
  border-radius: 5px;
  padding: 2em;
  position: relative;
  z-index: 99999;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  
  max-height: 80vh;        /* limits height relative to viewport */
  overflow-y: auto;        /* allows vertical scroll if content overflows */
}

.fp-close {
  position: absolute;
  top: 0.5em;
  right: 0.7em;
  background: none;
  color: #5b5b5b;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 10px;
}

.fp-close:hover {
  color: #000;
  background-color: #fff;
  border-color: #fff;
}

/* ===== Cart Form ===== */
.fp-add-to-cart-form {
  margin-top: 1em;
  display: flex;
  gap: 0.5em;
  align-items: center;
}

.fp-add-to-cart-form input[type="number"] {
  width: 60px;
  padding: 0.3em;
}

/* ===== Loading Indicator ===== */
.fp-calendar-loading {
  opacity: 0.5;
  pointer-events: none;
  position: relative;
}

.fp-calendar-loading::after {
  content: "Sæki gögn…";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 0.5em 1em;
  border: 1px solid #ccc;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

/* ===== Trip Slot Styling ===== */
.fp-calendar td.available {
  position: relative;
}

.fp-calendar td.available .fp-slot {
  padding-top: 1.5em;
  background-color: #d6fdd6;
  text-align: center;
  font-weight: 500;
  z-index: 1;
  display: block;
  font-size: 0.85rem;
  line-height: 1.2;
}

.fp-slot-start,
.fp-slot-end {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  text-align: center;
  padding: 0.3em;
}

.fp-slot-end {
  left: 0;
  border-right: 1.5px solid #fff;
  border-radius: 0 8px 8px 0;
}

.fp-slot-start {
  right: 0;
  border-left: 1.5px solid #fff;
  border-radius: 8px 0 0 8px;
}

.fp-slot-middle,
.fp-slot-single,
.fp-slot-full-start,
.fp-slot-full-end {
  position: absolute !important;
  top: 0;
  left: 0 !important;
  width: 100% !important;
  height: 100%;
  transform: none !important;
  margin: 0;
  border-radius: 0 !important;
  border-left: none !important;
  border-right: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 2;
}

.fp-slot:hover,
.fp-slot.hovered {
  background-color: #d6f7d6 !important;
  box-shadow: inset 0 0 0 1px #6abf69;
}

/* ===== Location Links ===== */
.fp-calendar td:first-child a {
  color: #2f7d32;
  text-decoration: none;
  font-weight: 600;
}

.fp-calendar td:first-child a:hover {
  text-decoration: underline;
  color: #1b5e20;
}

/* ===== Scroll and Fade Effects ===== */
.fp-calendar-scrollable::before,
.fp-calendar-scrollable::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30px;
  pointer-events: none;
  z-index: 5;
}

.fp-calendar-scrollable {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  position: relative;
}

.fp-calendar-scrollable-wrapper {
  position: relative;
  max-width: 100%;
}

.fp-fade-left,
.fp-fade-right {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30px;
  pointer-events: none;
  z-index: 10;
}

.fp-fade-right {
  right: 0;
  background: linear-gradient(to left, rgba(255,255,255,1), rgba(255,255,255,0));
}

/* ===== Mobile ===== */
@media (max-width: 480px) {
  .fp-modal-dialog {
    width: 100%;
    max-width: none;
    padding: 1em;
  }

  .fp-modal-content {
    max-height: 90vh;
    padding: 1em;
  }

  .fp-calendar td.available a {
    font-size: 1.1rem;
    padding: 0.8em;
  }

  .fp-calendar-nav {
    font-size: 0.95rem;
    text-align: center;
  }

  .fp-calendar-nav a {
    display: inline-block;
    padding: 0.5em 1em;
  }

  .fp-calendar th:first-child,
  .fp-calendar td:first-child {
    background-color: #fff;
    border-right: 1px solid #e0e0e0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
    text-align: center;
  }

  .fp-calendar td.available:hover {
    box-shadow: none;
  }
}
