/* ===== base variables ===== */
$size-card : 150px; // ( ≥1280px จะขยายเป็น 170 )
$col-hero : 280px; // ความกว้างคอลัมน์ซ้าย
$gap-main : 2.5rem;
$radius-main : 28px;
$radius-sub : 20px;
$dur : .35s;
$easing : cubic-bezier(.4, 0, .2, 1);
$shadow-base : 0 14px 30px -12px rgba(0, 0, 0, .18);
$shadow-deep : 0 20px 42px -16px rgba(0, 0, 0, .24);

/* ===== wrapper ===== */
.wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 3rem 1.25rem;
  margin-top: 5rem;
}

/* ===== GRID ชั้นแรก ===== */
.page-grid {
  display: grid;
  gap: $gap-main;
  grid-template-columns: $col-hero 1fr;

  @media (max-width: 1023px) {
    /* < lg : 1 คอลัมน์ */
    grid-template-columns: 1fr;
  }
}

/* ===== HERO CARD (คงเดิม – ตัด flex ออก) ===== */
.hero-card {
  width: 100%;
  max-width: 280px; // ไม่เกินจอ desktop
  box-sizing: border-box;
  padding-inline: clamp(1rem, 4vw, 1.75rem);
  padding-block: 2rem 3rem;
  position: relative;
  border-radius: $radius-main;
  padding: 2rem 1.75rem 3rem;
  background: #fff;
  box-shadow: $shadow-base;
  text-align: center;
  display: grid;
  place-items: center;
  gap: 1.3rem;
  transition: transform $dur $easing, box-shadow $dur $easing;

  &:hover {
    transform: translateY(-6px);
    box-shadow: $shadow-deep;
  }

  /* glow */
  &.bp-glow::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    background: linear-gradient(135deg, #4f46e5, #ec4899 60%, #f59e0b);
    filter: blur(34px);
    opacity: .17;
    z-index: -1;
    transition: opacity $dur;
  }

  &:hover.bp-glow::before {
    opacity: .27;
  }
}

@media (max-width: 639px) {
  .hero-img {
    max-width: 68%;
  }
}

.hero-img {
  width: 10rem;
}

.hero-label {
  font: 600 .95rem/1.2 'Inter', sans-serif;
  color: #3b82f6;
}

.hero-title {
  font: 700 1.5rem/1.3 'Inter', sans-serif;
  color: #1e3a8a;
}

.hero-btn {
  @apply bg-blue-600 hover:bg-blue-700 text-white font-semibold rounded-full px-10 py-2 transition;
}

.back-link {
  position: absolute;
  left: 1.75rem;
  bottom: 1rem;
  font-size: .9rem;
  color: #64748b;
  transition: color .25s;

  &:hover {
    color: #3b82f6;
  }
}

/* ===== GRID ชั้นสอง – เมนูย่อย 2 แถวพอดี ===== */
.sub-grid {
  display: grid;
  grid-auto-flow: column;
  /* เติมแนวนอนก่อน */
  grid-template-rows: repeat(2, $size-card);
  grid-auto-columns: $size-card;
  gap: 1.5rem;
  place-content: start;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));

  /* ≥1280px ขยายการ์ด */
  @media (min-width: 1280px) {
    grid-template-rows: repeat(2, 170px);
    grid-auto-columns: 170px;
  }

  /* มือถือ: 2 คอลัมน์เสมอ */
  @media (max-width: 639px) {
    grid-template-rows: repeat(2, 46vw);
    grid-auto-columns: 46vw;
  }
}

/* ===== SUB-CARD + เอฟเฟกต์ ===== */
.sub-card {
  // aspect-ratio: 1 / 1;
  position: relative;
  border-radius: $radius-sub;
  background: rgba(255, 255, 255, .5);
  /* glass */
  backdrop-filter: blur(9px) saturate(170%);
  box-shadow: 0 8px 18px -10px rgba(71, 85, 105, .25);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  cursor: pointer;
  user-select: none;
  transition: transform .45s $easing, box-shadow .45s $easing, background .45s;

  /* gradient rim */
  &::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    // background: linear-gradient(160deg,#60a5fa,#818cf8 50%,#a855f7);
    background: linear-gradient(135deg, #4f46e5, #ec4899 60%, #f59e0b);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: .45;
    transition: opacity .4s;
  }

  &:hover {
    background: #ffffff;
    transform: translateY(-7px) rotateX(5deg) rotateY(-3deg);
    box-shadow: $shadow-deep;

    &::before {
      opacity: .9;
    }
  }
}

.sub-title {
  font-weight: 600;
  font-size: .9rem;
  line-height: 1.25rem;
  color: #2563eb;
  pointer-events: none;
  word-break: break-word;
}

.sub-title2 {
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 2.25rem;
  color: #2563eb;
  pointer-events: none;
  word-break: break-word;
}

// div {
//   border: black 1px solid;
//   min-height: 20px;
// }

.row {
  display: flex;
  flex-wrap: wrap;
}

.col {
  flex: 1;
}

@for $i from 1 through 12 {
  $width: (
    $i / 12) * 100%;

  .col-#{$i} {
    flex: 0 0 $width;
    max-width: $width;
  }
}

.col-start {
  display: flex;
  justify-content: start;
}

.col-center {
  display: flex;
  justify-content: center;
}

.row-top {
  display: flex;
  align-items: start;
  align-content: start;
}

.row-center {
  display: flex;
  align-items: center;
}

.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.dashboard-link {
  font-size: .9rem;
  color: #64748b;
  transition: color .25s;

  &:hover {
    color: #3b82f6;
  }
}


.dashboard-box {
  box-shadow: 0 0 10px 3px rgba(0, 0, 0, 0.2
  );
border: 1px solid transparent;
border-radius: 30px;
background-image: linear-gradient(white, white),
  linear-gradient(135deg, #4f46e5, #ec4899 60%, #f59e0b);
background-origin: border-box;
background-clip: content-box,
  border-box;
transition: transform $dur $easing,
  box-shadow $dur $easing;

&:hover {
  transform: translateY(-6px);
  box-shadow: $shadow-deep;
}

&:hover::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  background: linear-gradient(135deg, #4f46e5, #ec4899 60%, #f59e0b);
  filter: blur(34px);
  opacity: .17;
  z-index: -1;
  transition: opacity $dur;
  opacity: .27;
  border: 1px solid;
}

.sub-box {
  padding: 15px;
}
}


.menu-box {
  box-shadow: 0 0 10px 3px rgba(0, 0, 0, 0.2);
  border: 1px solid transparent;
  border-radius: 30px;
  background-image: linear-gradient(white, white),
    linear-gradient(135deg, #4f46e5, #ec4899 60%, #f59e0b);
  background-origin: border-box;
  background-clip: content-box,
    border-box;
  transition: transform $dur $easing,
    box-shadow $dur $easing;

  &:hover {
    transform: translateY(-6px);
    box-shadow: $shadow-deep;
  }

  &:hover::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    // background: linear-gradient(135deg, #4f46e5, #ec4899 60%, #f59e0b);
    filter: blur(34px);
    opacity: .17;
    z-index: -1;
    transition: opacity $dur;
    opacity: .27;
    border: 1px solid;
  }

  .sub-box {
    padding: 15px;
  }
}

.text-blue {
  color: #3b82f6;
}

.text-title {
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 2.25rem;
  pointer-events: none;
  word-break: break-word;
}

.text-menu {
  font-weight: 500;
  font-size: 1rem;
  transition: color .25s;
}

.table-link {
  transition: color 0.25s;

  &[data-disable-hover="false"]:hover .text-menu a {
    color: #3b82f6;
    cursor: pointer;

    &.table-link-link {
      text-decoration: underline;
    }
  }

  &[data-disable-hover="true"] {
    opacity: 0.5;
    cursor: default;
  }
}

.sub-box-menu {
  border: #3b82f6 1px solid;
  border-radius: 15px;
  min-height: 50px;

  &:hover {
    cursor: pointer;
    background: rgba(59, 130, 246, 0.2);
  }

  &[data-disable-hover="true"] {
    --tw-bg-opacity: 1;
    background-color: rgb(226 232 240 / var(--tw-bg-opacity));

    &:hover {
      background-color: rgb(226 232 240 / var(--tw-bg-opacity));
      cursor: default;
    }
  }
}


.text-no {
  font-weight: 600;
  font-size: 1.5rem;
}