@use "../../../styles/abstracts/variables" as *;
@use "../../../styles/abstracts/mixins" as *;

$border-light: rgba(0, 0, 0, 0.06);
$text-muted: #6b6b6b;
$primary-light: rgba(122, 75, 32, 0.08);

/* ================= PAGE ================= */
.appointments {
  @include dashPageComponent;
  overflow-x: hidden !important;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;

  background: $bg-soft;
  border: 1px solid $border-light;

  padding: 0;

  @media (max-width: 1000px) {
    margin-top: 5rem;
  }

  .actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
  }
}

/* ================= CONTENT ================= */
.content {
  padding: 1rem 2rem 2.5rem;

  display: flex;
  flex-direction: column;
  // gap: 1.4rem;

  @media (max-width: 1000px) {
    padding: 1.2rem;
  }
}


/* ================= CALENDAR ================= */
.calendar {
  width: 100%;
  background: #fff;

  border-radius: 16px;
  border: 1px solid $border;

  padding: 1rem;

  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.04),
    0 24px 60px rgba(0, 0, 0, 0.06);

  display: flex;
  flex-direction: column;
  gap: 0.8rem;

  transition: all 0.25s ease;
}

/* ================= CALENDAR HEADER ================= */
.calendarHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;

  h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: $text-dark;
    letter-spacing: -0.2px;
  }

  button {
    width: 34px;
    height: 34px;

    border-radius: 10px;
    border: none;

    background: $primary-soft;
    color: $primary;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    transition: all 0.2s ease;

    &:hover:not(:disabled) {
      background: $primary-soft-strong;
      transform: translateY(-1px);
    }

    &:active:not(:disabled) {
      transform: scale(0.9);
    }

    &:disabled {
      opacity: 0.35;
      cursor: not-allowed;
      transform: none;
    }
  }
}

/* ================= CALENDAR GRID ================= */
.calendarGrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.3rem;

  span {
    font-size: 0.65rem;
    text-align: center;
    color: $text-light;
    font-weight: 500;
  }

  button {
    height: 36px;
    border-radius: 10px;
    border: none;

    font-size: 0.78rem;
    font-weight: 500;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    background: transparent;

    transition: all 0.2s ease;

    /* 🔥 ACTIVE (clickable) */
    &:hover:not(:disabled) {
      background: $primary-soft;
      color: $primary;
    }

    &:active:not(:disabled) {
      transform: scale(0.92);
    }

    /* 🔥 EMPTY CELLS */
    &:disabled:empty {
      opacity: 0;
      pointer-events: none;
    }
  }
}

/* ================= PAST (DISABLED) DAYS ================= */
.disabledDay {
  opacity: 0.4;
  cursor: not-allowed !important;

  background: #f7f5f3 !important;
  color: $text-light !important;

  &:hover {
    background: #f7f5f3 !important;
    transform: none;
  }
}

/* ================= TODAY ================= */
.today {
  border: 1px solid rgba(94, 56, 23, 0.3);
  font-weight: 600;
}

/* ================= SELECTED ================= */
.activeDay {
  background: linear-gradient(135deg, $primary, $primary-2);
  color: #fff !important;

  box-shadow:
    0 6px 14px rgba(122, 75, 32, 0.25);

  &:hover {
    background: linear-gradient(135deg, $primary, $primary-2);
  }
}

/* ================= DATE PICKER ================= */
.datePicker {
  position: relative;
  width: 100%;
}

/* DISPLAY FIELD */
.dateDisplay {
  padding: 10px 12px;
  border-radius: 12px;

  border: 1px solid #e6dcd2;
  background: #faf8f6;

  font-size: 0.85rem;
  color: $text-dark;

  cursor: pointer;

  transition: all 0.2s ease;

  &:hover {
    border-color: #d6c2aa;
    background: #fff;
  }

  &:focus-within {
    border-color: rgba(122, 75, 32, 0.4);
    box-shadow: 0 0 0 2px rgba(122, 75, 32, 0.08);
  }
}

/* CALENDAR DROPDOWN */
.calendarDropdown {
  position: absolute;
  top: 110%;
  left: 0;
  width: 100%;
  z-index: 20;

  animation: fadeIn 0.18s ease;
}

/* ================= ANIMATION ================= */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ================= MOBILE ================= */
@media (max-width: 480px) {
  .calendar {
    padding: 0.85rem;
  }

  .calendarHeader h4 {
    font-size: 0.85rem;
  }

  .calendarGrid button {
    height: 32px;
    font-size: 0.72rem;
  }
}



/* ================= FILTER BAR ================= */
.filterBar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  border-radius: 14px;
  // border: 1px solid #f0e9e4;

  // box-shadow:
  //   0 1px 2px rgba(0, 0, 0, 0.04),
  //   0 4px 12px rgba(94, 56, 23, 0.04);

  transition: all 0.2s ease;

  // &:hover {
  //   box-shadow:
  //     0 2px 6px rgba(0, 0, 0, 0.05),
  //     0 8px 20px rgba(94, 56, 23, 0.06);
  // }

  @media (max-width: 768px){
    border: 1px solid #f0e9e4;
    margin-bottom: 2rem;
    box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 4px 12px rgba(94, 56, 23, 0.04);
    padding: 16px;
    margin-bottom: .7rem;
  }

  select {
    appearance: none;

    padding: 10px 14px;
    border-radius: 10px;

    border: 1px solid #e6dcd2;
    background: #faf8f6;

    font-size: 14px;
    color: #1a1a1a;

    min-width: 150px;

    transition: all 0.2s ease;

    &:hover {
      border-color: #d6c2aa;
      background: #fff;
    }

    &:focus {
      outline: none;
      border-color: #7a4b20;
      background: #fff;
      box-shadow: 0 0 0 3px rgba(122, 75, 32, 0.08);
    }
  }
}

/* ================= FILTER CHIPS ================= */
.filterChips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;

  margin-top: 1px;
  margin-bottom: 2rem;

  span {
    display: inline-flex;
    align-items: center;

    padding: 6px 12px;
    border-radius: 999px;

    font-size: 0.75rem;
    font-weight: 500;

    background: $primary-light;
    color: $primary;

    border: 1px solid rgba(122, 75, 32, 0.12);

    transition: all 0.2s ease;

    &:hover {
      background: rgba(122, 75, 32, 0.12);
    }
  }
}

/* ================= CLEAR BUTTON ================= */
.clearBtn {
  background: #faf8f6;
  border: 1px solid #e6dcd2;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;

  color: #5e3817;

  cursor: pointer;
  transition: all 0.2s ease;

  &:hover {
    background: #f3ebe5;
    border-color: #d6c2aa;
  }

  &:active {
    transform: scale(0.97);
  }

  &:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
}

/* ================= TABLE ================= */
.tableSection {
  margin-top: 2.5rem;
  border: 1px solid $border-light;
  background: #fff;
  padding: .5rem 1.6rem;

  border-radius: 16px;
  border: 1px solid $border-light;

  box-shadow: 0 12px 30px rgba(122, 75, 32, 0.08);
}

.tableHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;

  // margin-bottom: 1.5rem;

  @media (max-width: 1000px) {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  h2 {
    font-weight: 600;
    font-size: 0.95rem;
    color: $text-dark;
  }

  p {
    font-size: 0.85rem;
    color: $text-muted;
  }
}

/* ================= TABLE WRAPPER ================= */
.tableWrapper {
  position: relative;
  min-height: 250px;
}

/* ================= SKELETON ================= */
.skeletonGrid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeletonRow {
  height: 52px;
  border-radius: 10px;

  background: linear-gradient(
    90deg,
    #f3f3f3 25%,
    #e8e8e8 37%,
    #f3f3f3 63%
  );

  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

/* ================= STATUS BADGE ================= */
.statusBadge {
  display: inline-block;

  padding: 0.25rem 0.7rem;
  border-radius: 999px;

  font-weight: 600;
  font-size: 0.75rem;

  text-transform: uppercase;

  background: $primary-light;
  color: $primary;
}

/* ================= PAGINATION ================= */
.paginate {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
}

/* ================= MOBILE ================= */
@media (max-width: 768px) {
  .content {
    padding: 1rem;
  }

  .tableSection {
    padding: 1.3rem;
  }

  .filterBar {
    flex-direction: column;
    align-items: stretch;
  }

  .toggleRow {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}


/* ================= BULK ACTIONS ================= */
.bulkActions {
  display: flex;
  justify-content: flex-end;

  margin-top: 1rem;
  margin-bottom: 1rem;

  button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 6px;

    padding: 8px 14px;
    border-radius: 10px;

    font-size: 0.8rem;
    font-weight: 600;

    border: 1px solid transparent;

    background: linear-gradient(135deg, $primary, $primary-2);
    color: #fff;

    cursor: pointer;

    box-shadow: 0 6px 16px rgba(94, 56, 23, 0.15);

    transition: all 0.2s ease;

    &:hover {
      transform: translateY(-1px);
      box-shadow: 0 10px 22px rgba(94, 56, 23, 0.2);
    }

    &:active {
      transform: scale(0.96);
    }

    &:disabled {
      background: #e5e5e5;
      color: #999;
      cursor: not-allowed;
      box-shadow: none;
    }
  }

  @media (max-width: 768px) {
    justify-content: stretch;

    button {
      width: 100%;
      padding: 14px;
    }
  }
}


/* ================= ASSIGN MODAL ================= */
.assignModal {
  position: fixed;
  inset: 0;

  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(3px);

  display: flex;
  align-items: center;
  justify-content: center;

  z-index: 1000;
}

.modalCard {
  width: 420px;
  max-width: 95%;

  background: #fff;
  border-radius: 18px;

  padding: 1.5rem;

  display: flex;
  flex-direction: column;
  // gap: 1.2rem;

  border: 1px solid $border-light;

  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.15),
    0 10px 20px rgba(94, 56, 23, 0.08);

  h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: $text-dark;
  } 

  p{
    padding-bottom: 2rem;
    @include sectionDescription;
    font-size: .85rem;
  }

  input[type="time"] {
    width: 100%;

    padding: 10px 12px;
    border-radius: 10px;

    border: 1px solid #e6dcd2;
    background: #faf8f6;

    font-size: 0.85rem;

    transition: all 0.2s ease;

    &:focus {
      outline: none;
      border-color: $primary;
      background: #fff;
      box-shadow: 0 0 0 3px rgba(122, 75, 32, 0.08);
    }
  }
}


/* ================= CHECKBOX ================= */
.checkbox {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 20px;
  height: 20px;

  cursor: pointer;

  input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }
}

/* ================= BOX ================= */
.checkmark {
  width: 18px;
  height: 18px;

  border-radius: 6px;

  background: linear-gradient(180deg, #ffffff, #faf8f6);

  border: 1px solid rgba(0, 0, 0, 0.08);

  display: flex;
  align-items: center;
  justify-content: center;

  transition: all 0.2s ease;

  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.6),
    0 2px 6px rgba(0, 0, 0, 0.06);
}

/* ================= HOVER ================= */
.checkbox:hover .checkmark {
  border-color: rgba(122, 75, 32, 0.4);
  background: #fff;
}

/* ================= CHECKED ================= */
.checkbox input:checked + .checkmark {
  background: linear-gradient(135deg, #5e3817, #7a4b20);
  border-color: #5e3817;

  box-shadow:
    0 4px 12px rgba(122, 75, 32, 0.3),
    inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

/* ================= TICK ================= */
.checkmark::after {
  content: "";
  width: 5px;
  height: 9px;

  border: solid white;
  border-width: 0 2px 2px 0;

  transform: rotate(45deg) scale(0);
  transition: transform 0.2s ease;
}

/* show tick */
.checkbox input:checked + .checkmark::after {
  transform: rotate(45deg) scale(1);
}

/* ================= ACTIVE PRESS ================= */
.checkbox:active .checkmark {
  transform: scale(0.92);
}

/* ================= DISABLED ================= */
.checkbox input:disabled + .checkmark {
  opacity: 0.5;
  cursor: not-allowed;
}