@use "../../../styles/abstracts/variables" as *;
@use "../../../styles/abstracts/mixins" as *;
@import url('https://fonts.googleapis.com/css2?family=Figtree:ital,wght@0,300..900;1,300..900&display=swap');

$text-muted: #6b6b6b;

.modalBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;

  /* ✅ FIX: always center vertically */
  align-items: center;

  z-index: 9999;
  padding: 1rem;
  overflow-y: auto;

  /* smooth scroll */
  -webkit-overflow-scrolling: touch;

  @media (max-width: 600px) {
    /* ❌ removed flex-start */
    align-items: center;

    padding: 1.5rem 1rem;
  }
}

.modalContent {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  padding: 1.8rem;
  position: relative;
  font-family: "Figtree" !important;
  animation: fadeIn 0.25s ease;

  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.08),
    0 20px 40px rgba(94, 56, 23, 0.08);

  max-height: calc(100vh - 4rem);
  overflow-y: auto;

  /* ✅ ensure it stays centered */
  margin: auto;

  @media (max-width: 600px) {
    max-height: calc(100vh - 2rem);
    margin: auto;
  }
}

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

.modalHeader {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  position: relative;

  h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: $text-dark;
  }

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

.closeBtn {
  position: absolute;
  top: 0;
  right: 0;

  width: 32px;
  height: 32px;

  border-radius: 50%;
  border: 1px solid $border;

  background: #ffffff;
  color: $text-light;

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

  cursor: pointer;

  transition: all 0.2s ease;

  &:hover {
    background: $primary-soft;
    color: $primary;
    transform: rotate(90deg);
  }
}

.modalForm {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.formGroup {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;

  label {
    font-size: 0.8rem;
    font-weight: 600;
    color: $text-dark;
  }

  input,
  select,
  textarea {
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    font-size: 0.9rem;
    background: #fafafa;
    color: $text-dark;

    transition: all 0.2s ease;

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

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

  textarea {
    height: 6rem;
  }
}

.error {
  color: #dc2626;
  font-size: 0.75rem;
}

.submitBtn {
  margin-top: 0.5rem;
  background: $green;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.75rem;
  font-weight: 600;
  cursor: pointer;

  transition: all 0.2s ease;

  &:hover {
    background: $text-dark;
  }

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

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

/* MOBILE */
@media (max-width: 768px) {
  .modalContent {
    padding: 1.5rem;
  }
}

/* TOGGLE */
.toggleGroup {
  background: #faf8f6;
  border: 1px solid #f0ece7;
  padding: 14px;
  border-radius: 12px;
}

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

.toggleTitle {
  font-weight: 600;
  font-size: 0.9rem;
}

.toggleDesc {
  font-size: 0.75rem;
  color: $text-muted;
}

/* SWITCH */
.switch {
  position: relative;
  width: 42px;
  height: 22px;

  input {
    opacity: 0;
    width: 0;
    height: 0;
  }
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #d1d5db;
  border-radius: 20px;
  transition: 0.3s;

  &:before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
  }
}

input:checked + .slider {
  background: #7a4b20;
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* INFO BOX */
.infoBox {
  margin-top: 10px;
  font-size: 0.75rem;
  color: $text-muted;
}

/* BUTTON */
.submitBtn {
  margin-top: 0.7rem;

  background: linear-gradient(
    135deg,
    #7a4b20,
    #5e3817
  );

  color: #ffffff;

  border: none;
  border-radius: 12px;

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

  cursor: pointer;

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

  transition: all 0.25s ease;

  /* depth */
  box-shadow:
    0 4px 12px rgba(122, 75, 32, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);

  /* 🔥 HOVER */
  &:hover:not(:disabled) {
    background: linear-gradient(
      135deg,
      #5e3817,
      #4a2c15
    );

    transform: translateY(-1px);

    box-shadow:
      0 8px 20px rgba(122, 75, 32, 0.25),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }

  /* 🔥 ACTIVE (CLICK FEEL) */
  &:active:not(:disabled) {
    transform: scale(0.97);

    box-shadow:
      0 3px 8px rgba(122, 75, 32, 0.2),
      inset 0 2px 4px rgba(0, 0, 0, 0.15);
  }

  /* DISABLED */
  &:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
  }
}


.infoBox {
  margin-top: 12px;

  padding: 0.8rem 0.9rem;

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

  font-size: 0.78rem;
  line-height: 1.4;

  color: $text-dark;

  display: flex;
  align-items: flex-start;
  gap: 0.5rem;

  position: relative;

  /* subtle left accent */
  &::before {
    content: "";
    width: 3px;
    height: 100%;
    border-radius: 0px;

    background: #7a4b20;

    position: absolute;
    left: 0;
    top: 0;
  }

  /* better spacing for text */
  span {
    color: $text-muted;
  }
}


/* ================= BOOKING INFO (UPGRADE) ================= */
.bookingInfo {
  margin-top: 6px;

  padding: 0.9rem 0.9rem 0.9rem 1rem;

  background: linear-gradient(
    135deg,
    rgba(122, 75, 32, 0.05),
    rgba(94, 56, 23, 0.03)
  );

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

  display: flex;
  flex-direction: column;
  gap: 10px;

  position: relative;

  /* subtle accent */
  &::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10%;
    height: 80%;
    width: 3px;
    border-radius: 2px;
    background: linear-gradient(#7a4b20, #5e3817);
  }
}

/* ================= INFO ITEM ================= */
.infoItem {
  display: flex;
  align-items: flex-start;
  gap: 10px;

  font-size: 0.78rem;
  color: $text-muted;
  line-height: 1;

  strong {
    color: $text-dark;
    font-weight: 600;
  }
}

/* ================= DOT ================= */
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 6px;

  background: $primary;

  flex-shrink: 0;
}

/* ================= STATUS WRAPPER ================= */
.statusWrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 1rem;
}

/* ================= AVAILABILITY ================= */
.availability {
  display: flex;
  align-items: center;
  gap: 8px;

  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: 999px;

  width: fit-content;
}

.available {
  background: #e8f7ec;
  color: #1e8e3e;
}

.unavailable {
  background: #fdecea;
  color: #d93025;
}

/* indicator dot */
.indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ================= BLOCKED STATE ================= */
.blockedState {
  font-size: 0.75rem;

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

  background: rgba(122, 75, 32, 0.06);
  border: 1px solid rgba(122, 75, 32, 0.15);

  color: $text-dark;
}

/* ================= DISABLED FORM ================= */
fieldset:disabled {
  opacity: 0.6;
  pointer-events: none;
}


/* ================= HEADER ================= */
.header {
  position: relative;

  display: flex;
  justify-content: space-between;
  align-items: flex-start;

  margin-bottom: 1.6rem;
  padding-right: 40px; /* space for close button */

  h2 {
    font-size: 1.35rem; /* 🔥 bigger */
    font-weight: 700;
    letter-spacing: -0.3px;
    color: $text-dark;
  }
}

/* ================= CLOSE BUTTON (FIXED) ================= */
.closeBtn {
  position: absolute;
  top: -6px;
  right: -6px;

  width: 36px;
  height: 36px;

  border-radius: 50%;
  border: 1px solid $border;

  background: #ffffff;
  color: $text-light;

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

  cursor: pointer;

  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.08);

  transition: all 0.25s ease;

  &:hover {
    background: $primary-soft;
    color: $primary;
    transform: rotate(90deg) scale(1.05);
  }
}

/* ================= STATUS ================= */
.status {
  margin-top: 6px;

  font-size: 0.72rem;
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* ================= USER CARD ================= */
.userCard {
  display: flex;
  align-items: center;
  gap: 12px;

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

  background: linear-gradient(135deg, #faf8f6, #ffffff);
  border: 1px solid rgba(0,0,0,0.05);

  box-shadow:
    0 4px 12px rgba(0,0,0,0.03);

  margin-bottom: 1.2rem;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;

  background: linear-gradient(135deg, #7a4b20, #5e3817);

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

.userInfo h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.userInfo p {
  margin: 0;
  font-size: 0.78rem;
  color: $text-muted;
}

/* ================= CARD (SECTION) ================= */
.card {
  padding: 1.1rem;
  border-radius: 16px;

  background: linear-gradient(180deg, #ffffff, #faf8f6);
  border: 1px solid rgba(0,0,0,0.05);

  margin-bottom: 1.2rem;

  box-shadow:
    0 6px 16px rgba(0,0,0,0.04);

  h4 {
    font-size: 0.95rem; /* 🔥 bigger */
    font-weight: 600;
    margin-bottom: 0.8rem;
  }

  p {
    font-size: 0.82rem;
    color: $text-muted;
    line-height: 1.5;

    @media (max-width: 768px) {
      font-size: 1rem;
    }
  }
}

/* ================= ROW (REBUILT) ================= */
.row {
  display: flex;
  gap: 12px;
  align-items: flex-start;

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

  transition: all 0.2s ease;

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

/* ================= ICON ================= */
.icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;

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

  background: linear-gradient(
    135deg,
    rgba(122,75,32,0.15),
    rgba(122,75,32,0.05)
  );

  color: $primary;

  box-shadow:
    inset 0 1px 1px rgba(255,255,255,0.5),
    0 4px 10px rgba(122,75,32,0.15);
}

/* ================= TEXT STRUCTURE FIX ================= */
.row div {
  display: flex;
  flex-direction: column; /* 🔥 KEY FIX */
  gap: 2px;
}

/* label */
.row span {
  font-size: .9rem;
  color: $text-muted;
  @media (max-width: 768px) {
    font-size: 1rem !important;
  }
}

/* value */
.row strong {
  font-size: 0.88rem; /* 🔥 more readable */
  font-weight: 600;
  color: $text-dark;
}

/* ================= STATE BOX ================= */
.stateBox {
  padding: 14px;
  border-radius: 14px;

  background: linear-gradient(
    135deg,
    rgba(122,75,32,0.08),
    rgba(122,75,32,0.04)
  );

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

  font-size: 0.82rem;
  line-height: 1.5;

  color: $text-dark;

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.5);
}

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

  .header h2 {
    font-size: 1.2rem;
  }

  .card h4 {
    font-size: 0.95rem;
  }

  .row strong {
    font-size: 0.82rem;
  }

}


/* ================= STATUS ================= */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  margin-top: 6px;

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

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

  letter-spacing: 0.2px;

  position: relative;
}

/* dot indicator */
.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ================= STATES ================= */
.pending {
  color: #9f2a2a; 
  background: linear-gradient(
    180deg,
    rgba(159, 42, 42, 0.16),
    rgba(159, 42, 42, 0.08)
  );

  border-color: rgba(159, 42, 42, 0.3);
}

.assigned {
  color: #7a4b20;
  background: linear-gradient(
    180deg,
    rgba(122, 75, 32, 0.18),
    rgba(122, 75, 32, 0.08)
  );
  border-color: rgba(122, 75, 32, 0.32);
}

.completed {
  color: #2f7d4f;
  background: linear-gradient(
    180deg,
    rgba(47, 125, 79, 0.16),
    rgba(47, 125, 79, 0.08)
  );
  border-color: rgba(47, 125, 79, 0.28);
}

.cancelled {
  color: #7f1d1d;
  background: linear-gradient(
    180deg,
    rgba(220, 38, 38, 0.18),
    rgba(220, 38, 38, 0.08)
  );
  border-color: rgba(220, 38, 38, 0.32);
}

.rescheduled {
 color: #5b4bb7; 
  background: linear-gradient(
    180deg,
    rgba(91, 75, 183, 0.16),
    rgba(91, 75, 183, 0.08)
  );

  border-color: rgba(91, 75, 183, 0.28);
}