/**
 * assets/css/clay-core.css
 * สไตล์ชีตระบบ High-Fidelity Claymorphic
 * ควบคุมแสงและเงาดินน้ำมัน 4 ชั้น พร้อมรองรับ responsive หน้าจอมือถือ
 */

:root {
  --clay-bg: #f4f1fa;
  --clay-text-primary: #332f3a;
  --clay-text-muted: #635f69;
  --clay-accent: #7c3aed;
  --clay-accent-light: #a78bfa;
  --clay-accent-very-light: #f3eeff;
  --clay-pink: #db2777;
  --clay-blue: #0ea5e9;
  --clay-green: #10b981;
  --clay-amber: #f59e0b;

  /* High-Fidelity Claymorphic Shadows */
  --shadow-clay-card:
    16px 16px 32px rgba(160, 150, 180, 0.25),
    -10px -10px 24px rgba(255, 255, 255, 0.95),
    inset 6px 6px 12px rgba(139, 92, 246, 0.04),
    inset -6px -6px 12px rgba(255, 255, 255, 1);

  --shadow-clay-button:
    12px 12px 24px rgba(139, 92, 246, 0.3),
    -8px -8px 16px rgba(255, 255, 255, 0.4),
    inset 4px 4px 8px rgba(255, 255, 255, 0.4),
    inset -4px -4px 8px rgba(0, 0, 0, 0.1);

  --shadow-clay-button-hover:
    16px 16px 32px rgba(139, 92, 246, 0.4),
    -8px -8px 16px rgba(255, 255, 255, 0.5),
    inset 6px 6px 10px rgba(255, 255, 255, 0.5),
    inset -6px -6px 10px rgba(0, 0, 0, 0.08);

  --shadow-clay-pressed:
    inset 8px 8px 16px #d5cfdf, inset -8px -8px 16px #ffffff;
}

.w-100 {
  width: 100% !important;
}

.mt035 {
  margin-top: 0.35rem !important;
}

/* --- Base Body Settings --- */
body {
  background-color: var(--clay-bg);
  color: var(--clay-text-primary);
  font-family: "Sarabun", "DM Sans", sans-serif;
  font-size: 1.1rem;
  line-height: 1.625;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6,
.nunito {
  font-family: "Nunito", "Sarabun", sans-serif;
  font-weight: 800;
}

/* --- Background Blobs --- */
.clay-blobs-container {
  pointer-events: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: -10;
}

.clay-blob {
  position: absolute;
  width: 45vw;
  height: 45vw;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  animation: clay-float 12s ease-in-out infinite alternate;
}
.blob-violet {
  background-color: var(--clay-accent);
  top: -10%;
  left: -10%;
}
.blob-pink {
  background-color: var(--clay-pink);
  bottom: 10%;
  right: -10%;
  animation-delay: -3s;
}
.blob-blue {
  background-color: var(--clay-blue);
  top: 40%;
  left: 50%;
  width: 30vw;
  height: 30vw;
  animation-delay: -6s;
}

@keyframes clay-float {
  0% {
    transform: translateY(0px) rotate(0deg) scale(1);
  }
  50% {
    transform: translateY(-30px) rotate(5deg) scale(1.05);
  }
  100% {
    transform: translateY(15px) rotate(-3deg) scale(0.95);
  }
}

@keyframes toast-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.toast-icon-spin {
  animation: toast-spin 0.8s linear infinite;
}

.mw70 {
  max-width: 75% !important;
}

@media (max-width: 1900px) {
  .mw70 {
    max-width: 80% !important;
  }
}

@media (max-width: 1655px) {
  .mw70 {
    max-width: 90% !important;
  }
}

@media (max-width: 1475px) {
  .mw70 {
    max-width: none !important;
  }
}
/* @media (max-width: 768px) {
  .mw70 {
    max-width: none !important;
  }
} */

@media (max-width: 576px) {
  .clay-badge {
    width: 100% !important;
  }

  .petition-header {
    gap: 6px !important;
  }

  .petition-info {
    width: 100%;
  }

  .petition-status {
    width: 100%;
  }

  .petition-info .fs-5 {
    font-size: 1rem !important;
  }

  .petition-info small {
    font-size: 0.75rem !important;
    line-height: 1.5;
  }
  .clay-navbar {
    padding: 0.75rem 0.8rem !important;
    border-radius: 18px !important;
  }

  /* Brand ต้องยอมให้ตัวเองแคบลงได้ */
  .clay-navbar-brand {
    gap: 0.6rem !important;
    min-width: 0;
    max-width: calc(100% - 50px);
    overflow: hidden;
  }

  /* Logo */
  .clay-navbar-brand > div:first-child {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px;
    flex-shrink: 0;
  }

  .clay-navbar-brand > div:first-child i {
    font-size: 1.05rem !important;
  }

  /* กล่องข้อความของ Brand */
  .clay-navbar-brand > div:last-child {
    min-width: 0;
    overflow: hidden;
  }

  .clay-navbar-brand h5 {
    font-size: 0.64rem !important;
    margin-bottom: 0.2rem !important;
    line-height: 1.15 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .clay-navbar-brand h2 {
    font-size: 0.78rem !important;
    line-height: 1.25 !important;
    letter-spacing: -0.35px !important;

    /* สำคัญ */
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
  }

  /* Hamburger */
  .clay-navbar .navbar-toggler {
    width: 40px;
    height: 40px;
    padding: 0 !important;
    border-radius: 12px !important;
    flex-shrink: 0;
    margin-left: auto;
  }

  .clay-navbar-collapse {
    padding-top: 0.75rem;
    margin-top: 0.75rem !important;
  }

  .clay-navbar-collapse .nav-item .clay-btn,
  .clay-navbar-collapse .clay-btn-danger,
  .clay-navbar-collapse .clay-btn-primary {
    min-height: 42px;
    font-size: 0.82rem !important;
  }

  .logo-round {
    display: none !important;
  }

  nav.mb-4{
    margin-bottom: 0.5rem !important;
  }
}

@media (max-width: 767.98px) {
  .petition-history-header {
    padding: 1.25rem !important;
  }

  .petition-history-info {
    text-align: left !important;
  }

  .petition-history-info .clay-badge {
    margin-bottom: 0.75rem !important;
  }

  .petition-history-info h4 {
    font-size: 1.05rem;
    line-height: 1.45;
    margin-bottom: 0.5rem;
  }

  .petition-student-id {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.85rem;
    color: var(--clay-text-muted);
    font-weight: 700;
  }

  .petition-history-info p {
    font-size: 0.85rem !important;
    line-height: 1.5;
  }

  .petition-history-action {
    text-align: left !important;
    margin-top: 1rem !important;
  }

  .petition-history-action .clay-btn {
    width: 100% !important;
    min-height: 44px;
  }
}

/* =========================================================
   Clay Navbar - Responsive Mobile
   ========================================================= */

@media (max-width: 991.98px) {
  /* ตัว Navbar */
  .clay-navbar {
    padding: 0.9rem 1rem !important;
    border-radius: 20px !important;
  }

  /* Brand */
  .clay-navbar-brand {
    min-width: 0;
    flex: 1;
    gap: 0.75rem !important;
    margin-right: 0.5rem !important;
  }

  /* Logo */
  .clay-navbar-brand > div:first-child {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px;
  }

  .clay-navbar-brand > div:first-child i {
    font-size: 1.2rem !important;
  }

  /* ชื่อระบบ */
  .clay-navbar-brand h5 {
    font-size: 0.72rem !important;
    margin-bottom: 0.2rem !important;
    line-height: 1.15 !important;
  }

  .clay-navbar-brand h2 {
    font-size: 0.88rem !important;
    line-height: 1.25 !important;
    letter-spacing: -0.3px !important;
  }

  /* Hamburger */
  .clay-navbar .navbar-toggler {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* พื้นที่เมนูเมื่อเปิด */
  .clay-navbar-collapse {
    margin-top: 0.9rem !important;
    padding-top: 0.9rem;
    border-top: 1px solid rgba(124, 58, 237, 0.08);
  }

  /* เมนูหลัก */
  .clay-navbar-collapse .navbar-nav {
    padding-left: 0 !important;
    margin-bottom: 0.75rem !important;
    gap: 0.6rem !important;
  }

  .clay-navbar-collapse .nav-item {
    width: 100%;
  }

  /* ปุ่มเมนู */
  .clay-navbar-collapse .nav-item .clay-btn {
    min-height: 44px;
    border-radius: 16px;
    justify-content: flex-start;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* กลุ่มด้านขวา */
  .clay-navbar-collapse > .d-flex {
    width: 100%;
    gap: 0.6rem !important;
    margin-top: 0 !important;
  }

  /* Profile */
  .clay-navbar-collapse .d-flex > .bg-light {
    min-height: 50px;
    margin-bottom: 0 !important;
    border-radius: 16px !important;
  }

  /* Login / Logout */
  .clay-navbar-collapse .clay-btn-danger,
  .clay-navbar-collapse .clay-btn-primary {
    min-height: 44px;
    border-radius: 16px;
  }
}

/* --- Clay Elements --- */
.clay-card {
  background: rgba(255, 255, 255, 0.85);
  border-radius: 32px;
  padding: 2rem;
  box-shadow: var(--shadow-clay-card);
  border: 1px solid rgba(255, 255, 255, 0.8);
  transition:
    transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    box-shadow 0.4s ease;
}
.clay-card:hover {
  /* transform: translateY(-8px); */
  box-shadow:
    20px 24px 40px rgba(160, 150, 180, 0.3),
    -10px -10px 24px rgba(255, 255, 255, 0.95);
}

/* Recessed elements */
.clay-input-recessed {
  background: #efebf5;
  border: none;
  border-radius: 20px;
  padding: 0.9rem 1.4rem;
  font-size: 1.05rem;
  color: var(--clay-text-primary);
  box-shadow: var(--shadow-clay-pressed);
  transition: all 0.3s ease;
  width: 100%;
}
.clay-input-recessed:focus {
  outline: none;
  background: #ffffff;
  box-shadow:
    6px 6px 15px rgba(139, 92, 246, 0.1),
    -6px -6px 15px #ffffff;
}

/* Clay Button System */
.clay-btn {
  border-radius: 20px;
  padding: 0.85rem 1.75rem;
  font-weight: 800;
  font-family: "Nunito", sans-serif;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.clay-btn:hover {
  transform: translateY(-3px);
}
.clay-btn:active {
  transform: scale(0.92);
  box-shadow: var(--shadow-clay-pressed) !important;
}

.clay-btn-primary {
  background: linear-gradient(
    135deg,
    var(--clay-accent-light) 0%,
    var(--clay-accent) 100%
  );
  color: white;
  box-shadow: var(--shadow-clay-button);
}
.clay-btn-primary:hover {
  color: white;
  box-shadow: var(--shadow-clay-button-hover);
}
.clay-btn-secondary {
  border: 3px solid var(--clay-accent-light);
  background: white;
  color: var(--clay-text-primary);
  box-shadow:
    8px 8px 16px rgba(160, 150, 180, 0.15),
    -8px -8px 16px #ffffff;
}
.clay-btn-secondary:hover {
  background: #fcfbfe;
  box-shadow:
    12px 12px 20px rgba(160, 150, 180, 0.2),
    -8px -8px 16px #ffffff;
}
.clay-btn-danger {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  color: white;
  box-shadow:
    12px 12px 24px rgba(239, 68, 68, 0.3),
    -8px -8px 16px rgba(255, 255, 255, 0.4);
}

.clay-btn-pink {
  background: linear-gradient(135deg, #f472b6 0%, #ec4899 100%);
  color: white;
  box-shadow:
    12px 12px 24px rgba(236, 72, 153, 0.3),
    -8px -8px 16px rgba(255, 255, 255, 0.4);
}

/* Clay Pill Badges */
.clay-badge {
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  padding: 0.5rem 1.2rem;
  border-radius: 12px;
  display: inline-block;
}
.clay-badge-pending {
  background-color: #fef3c7;
  color: #d97706;
  box-shadow:
    inset 4px 4px 8px #fde68a,
    inset -4px -4px 8px #fffbeb;
}
.clay-badge-success {
  background-color: #d1fae5;
  color: #059669;
  box-shadow:
    inset 4px 4px 8px #a7f3d0,
    inset -4px -4px 8px #ecfdf5;
}
.clay-badge-secondary {
  background-color: #ede9fe;
  color: #7c3aed;
  box-shadow:
    inset 4px 4px 8px #c4b5fd,
    inset -4px -4px 8px #f3f0ff;
}
.clay-badge-danger {
  background-color: #fee2e2;
  color: #dc2626;
  box-shadow:
    inset 4px 4px 8px #fecaca,
    inset -4px -4px 8px #fff1f2;
}
.clay-badge-primary {
  background-color: #dbeafe;
  color: #2563eb;
  box-shadow:
    inset 4px 4px 8px #bfdbfe,
    inset -4px -4px 8px #eff6ff;
}

.clay-badge-info {
  background-color: #e0f2fe;
  color: #0284c7;
  box-shadow:
    inset 4px 4px 8px #bae6fd,
    inset -4px -4px 8px #f0f9ff;
}

.text-purple {
  color: #7c3aed;
  /* background-color: #7c3aed; */
}

/* Form checkboxes styled as clay pills */
.clay-pill-checkbox {
  display: none;
}
.clay-pill-label {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--clay-accent-very-light);
  border-radius: 20px;
  font-weight: 700;
  box-shadow:
    6px 6px 12px rgba(160, 150, 180, 0.1),
    -6px -6px 12px #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  border: 2px solid transparent;
  width: 100%;
}
.clay-pill-label:hover {
  transform: translateY(-2px);
  box-shadow: 8px 8px 16px rgba(160, 150, 180, 0.15);
}
.clay-pill-checkbox:checked + .clay-pill-label {
  background: #f5f3ff;
  border-color: var(--clay-accent-light);
  box-shadow: var(--shadow-clay-pressed);
  color: var(--clay-accent);
}

/* Clay Table design (Desktop) */
.clay-table-container {
  border-radius: 24px;
  overflow: hidden;
  background: white;
  box-shadow: var(--shadow-clay-pressed);
  padding: 1rem;
}
.clay-table {
  border-collapse: separate;
  border-spacing: 0 10px;
  width: 100%;
}
.clay-table th {
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  color: var(--clay-text-muted);
  border: none;
  padding: 1rem;
}
.clay-table tr {
  background: #fdfcff;
  border-radius: 16px;
  transition: all 0.2s ease;
}
.clay-table td {
  padding: 1rem;
  vertical-align: middle;
  border-top: 1px solid #f0edf5;
  border-bottom: 1px solid #f0edf5;
}
.clay-table td:first-child {
  border-left: 1px solid #f0edf5;
  border-top-left-radius: 16px;
  border-bottom-left-radius: 16px;
}
.clay-table td:last-child {
  border-right: 1px solid #f0edf5;
  border-top-right-radius: 16px;
  border-bottom-right-radius: 16px;
}
.clay-table tr:hover {
  transform: scale(1.01);
  background: white;
  box-shadow: 8px 8px 16px rgba(160, 150, 180, 0.08);
}

/* Responsive Mobile Cards for Table Replacement */
.clay-mobile-list-card {
  background: white;
  border-radius: 24px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-clay-card);
  border: 1px solid rgba(255, 255, 255, 0.8);
  transition: all 0.3s ease;
}
.clay-mobile-list-card:hover {
  transform: translateY(-4px);
}

/* Custom Toasts and Notifications */
.toast-clay {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  border-left: 6px solid var(--clay-accent);
  box-shadow: var(--shadow-clay-card);
  backdrop-filter: blur(10px);
}

/* Helper Sizes */
.fs-8 {
  font-size: 1rem !important;
}
.fs-9 {
  font-size: 0.9rem !important;
}
