@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);

.permissions {
  @include dashPageComponent;

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

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

  padding: 0;
  min-height: 100vh;

  opacity: 1;
  transform: translateY(0);
  transition: all 0.25s ease;

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

.content {
  padding: 1rem 2.5rem;

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

/* SEARCH */
.filterBar {
  margin-bottom: 1rem;

  input {
    width: 100%;
    padding: 13px 14px;
    border-radius: 14px;
    border: 1px solid #e6dcd2;
    background: #faf8f6;
    font-size: 0.9rem;
    transition: 0.2s;

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

/* TABLE */
.tableSection {
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  padding: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

/* USER CELL */
.userCell {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* AVATAR */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5e3817, #7a4b20);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* USER INFO */
.userInfo {
  display: flex;
  flex-direction: column;
  gap: 2px;

  strong {
    font-size: 0.9rem;
  }

  small {
    color: #6b6b6b;
    font-size: 0.75rem;
  }
}

/* INLINE BADGES */
.inlineBadges {
  display: flex;
  gap: 6px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.65rem;
  background: #fff0e6;
  border: 1px solid #e6d3b3;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
}

/* TYPE */
.type {
  font-size: 0.85rem;
  color: #444;
  font-weight: 500;
}

/* STATUS */
.status {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.active {
  background: #e6f4ea;
  color: #2e7d32;
}

.inactive {
  background: #fdecea;
  color: #c62828;
}

/* BUTTON */
.manageBtn {
  background: linear-gradient(135deg, #5e3817, #7a4b20);
  color: #fff;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.75rem;
  font-weight: 500;
  transition: 0.2s;

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

/* LOGS */
.logsSection {
  margin-top: 1.5rem;
  background: #fff;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.logItem {
  font-size: 0.8rem;
  margin-bottom: 10px;

  small {
    display: block;
    color: #999;
  }
}

.empty {
  text-align: center;
  color: #999;
  padding: 1rem;
}

/* MOBILE */
@media (max-width: 768px) {
  .userCell {
    flex-direction: row;
  }

  .manageBtn {
    width: 100%;
  }
}


//The table 
/* ================= TABLE WRAPPER ================= */
.tableWrapper {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;

  /* 🔥 SMOOTH SCROLL */
  -webkit-overflow-scrolling: touch;

  /* 🔥 HIDE SCROLLBAR (ALL BROWSERS) */
  scrollbar-width: none; // Firefox
}

.tableWrapper::-webkit-scrollbar {
  display: none; // Chrome, Safari
}

/* ================= TABLE ================= */
.table {
  min-width: 700px; // 🔥 forces horizontal scroll on small screens
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* HEADER */
.tableHeader {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  padding: 14px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b6b6b;
  background: #faf8f6;
  border-bottom: 1px solid #eee;
}

/* ROW */
.row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #f3f3f3;
  transition: 0.2s;

  &:hover {
    background: #faf5f0;
  }
}

/* USER CELL */
.userCell {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* GENERIC CELL */
.cell {
  font-size: 0.85rem;
}

/* AVATAR */
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5e3817, #7a4b20);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* USER INFO */
.userInfo {
  display: flex;
  flex-direction: column;
  gap: 2px;

  strong {
    font-size: 0.9rem;
  }

  small {
    color: #6b6b6b;
    font-size: 0.75rem;
  }
}

/* BADGES */
.inlineBadges {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.65rem;
  background: #fff0e6;
  border: 1px solid #e6d3b3;
  padding: 2px 8px;
  border-radius: 999px;
}

/* STATUS */
.status {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.active {
  background: #e6f4ea;
  color: #2e7d32;
}

.inactive {
  background: #fdecea;
  color: #c62828;
}

/* BUTTON */
.manageBtn {
  background: linear-gradient(135deg, #5e3817, #7a4b20);
  color: #fff;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.75rem;
  transition: 0.2s;
  cursor: pointer !important;

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

/* EMPTY */
.empty {
  padding: 2rem;
  text-align: center;
  color: #999;
}

/* ================= TABLET ================= */
@media (max-width: 1024px) {
  .table {
    min-width: 650px;
  }
}

/* ================= MOBILE ================= */
@media (max-width: 768px) {
  .table {
    min-width: 600px;
  }
}