/* admin.css
    Primary color: #01224D
    Prefix used for classes: admin-  (ลดความเสี่ยงชนกับ Bootstrap)
*/

/* --- Reset / base --- */
/* นำเข้า Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Sarabun:wght@400;700&display=swap');

:root {
  --admin-primary: #01224d;
  --admin-accent: #0a517d;
  --admin-muted: #6c7a89;
  --admin-bg: #f7f9fb;
  --admin-card-bg: #ffffff;
  --admin-radius: 10px;
  --admin-shadow: 0 6px 18px rgba(1, 34, 77, 0.08);
  --admin-border: 1px solid rgba(1, 34, 77, 0.08);
}

.admin-body {
  font-family: 'Sarabun', 'Lato', sans-serif;
  color: var(--admin-primary);
  background: var(--admin-bg);
  line-height: 1.45;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Navbar / header --- */
.admin-navbar {
  background: linear-gradient(90deg, var(--admin-primary), var(--admin-accent));
  color: #fff;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 2px 6px rgba(1, 34, 77, 0.12);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.admin-navbar .admin-brand {
  font-weight: 700;
  letter-spacing: 0.2px;
  font-size: 1.05rem;
}
.admin-navbar .admin-user {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 1rem;
}
.admin-navbar .admin-user .admin-username {
  background: rgba(255, 255, 255, 0.06);
  padding: 6px 10px;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
}

/* --- Container / layout --- */
.admin-container {
  max-width: 1200px;
  margin: 22px auto;
  padding: 18px;
}

/* Card */
.admin-card {
  background: var(--admin-card-bg);
  border-radius: var(--admin-radius);
  box-shadow: var(--admin-shadow);
  border: var(--admin-border);
  padding: 16px;
  margin-bottom: 16px;
}

/* Heading inside card */
.admin-card h3 {
  margin-top: 0;
  margin-bottom: 12px;
  color: var(--admin-primary);
  font-size: 1.05rem;
}

/* --- Buttons --- */
.admin-btn {
  display: flex;
  align-items: center;
  padding: 8px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  transition: transform 0.06s ease, box-shadow 0.12s ease;
}

.admin-btn:active {
  transform: translateY(1px);
}

.admin-btn--primary {
  background: var(--admin-primary);
  color: #fff;
  box-shadow: 0 6px 14px rgba(1, 34, 77, 0.12);
}
.admin-btn--primary:hover {
  filter: brightness(1.03);
}

.admin-btn--outline {
  background: transparent;
  color: var(--admin-primary);
  border: 1px solid rgba(1, 34, 77, 0.12);
}
.admin-btn--danger {
  background: #d9534f;
  color: #fff;
}
.admin-btn--green {
  background: #3f995a;
  color: #fff;
}

/* small button */
.admin-btn--sm {
  padding: 6px 8px;
  font-size: 0.88rem;
  border-radius: 6px;
}

/* --- Forms --- */
.admin-form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 760px) {
  .admin-form-row {
    grid-template-columns: 1fr;
  }
}

.admin-input,
.admin-select,
.admin-textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 2px solid rgba(1, 34, 77, 0.12);
  background: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
}
.admin-input:focus,
.admin-select:focus,
.admin-textarea:focus {
  box-shadow: 0 6px 18px rgba(1, 34, 77, 0.06);
  border-color: var(--admin-primary);
}
.admin-textarea {
  max-height: 50px;
  resize: vertical;
}

/* file input wrapper */
.admin-file {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* form row label */
.admin-label {
  display: block;
  font-size: 0.9rem;
  color: var(--admin-muted);
  margin-bottom: 6px;
}

/* form actions aligned */
.admin-form-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}

/* --- Table --- */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(1, 34, 77, 0.04);
}
.admin-table thead {
  background: linear-gradient(
    90deg,
    rgba(1, 34, 77, 0.98),
    rgba(11, 102, 160, 0.98)
  );
  color: #fff;
  font-weight: 700;
}
.admin-table thead th {
  padding: 12px 10px;
  text-align: left;
  font-size: 0.95rem;
  /* ให้หัวตารางอยู่บรรทัดเดียว ไม่ขึ้นบรรทัดใหม่ */

    white-space: nowrap;      /* ไม่ขึ้นบรรทัดใหม่ */
    overflow: hidden;         /* ซ่อนข้อความเกิน */
    text-overflow: ellipsis;  /* แสดง ... ถ้ายาวเกิน */
    padding: 12px 10px;
    text-align: left;
    font-size: .95rem;
    max-width: 150px;         /* ปรับขนาดตามต้องการ */

}
.admin-table tbody td {
  padding: 10px;
  border-bottom: 1px solid rgba(1, 34, 77, 0.06);
  vertical-align: middle;
  font-size: 0.95rem;
}
.admin-table tbody tr:last-child td {
  border-bottom: none;
}

/* responsive table wrapper */
.admin-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
}

/* small muted text */
.admin-muted {
  color: var(--admin-muted);
  font-size: 0.88rem;
}

/* thumbnail for cover */
.admin-thumb {
  display: inline-block;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(1, 34, 77, 0.06);
  box-shadow: 0 4px 10px rgba(1, 34, 77, 0.04);
}

/* action cell styling */
.admin-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* badge */
.admin-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
}
.admin-badge--admin {
  background: #257cff;
}
.admin-badge--power {
  background: #ff7a00;
}

/* --- Utilities --- */
.admin-clearfix::after {
  content: "";
  display: block;
  clear: both;
}

/* small helper spacing */
.admin-gap {
  height: 12px;
  display: block;
}

/* subtle link */
.admin-link {
  color: var(--admin-primary);
  text-decoration: none;
  font-weight: 600;
}
.admin-link:hover {
  text-decoration: underline;
}

/* --- Modal (simple) --- */
.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 10, 20, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.admin-modal {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  width: 540px;
  max-width: calc(100% - 40px);
  box-shadow: 0 22px 60px rgba(1, 34, 77, 0.25);
}
.admin-modal .admin-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.admin-modal .admin-modal-title {
  font-weight: 700;
  color: var(--admin-primary);
}

/* show helper (JS toggles) */
.admin-modal-backdrop.show {
  display: flex;
}

/* --- Tiny responsive tweaks --- */
@media (max-width: 520px) {
  .admin-navbar .admin-brand {
    font-size: 0.98rem;
  }
  .admin-navbar .admin-user {
    font-size: 0.88rem;
  }
  .admin-thumb {
    width: 48px;
    height: 48px;
  }
}
/* Container ของปุ่ม pagination */
.admin-pagination {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

/* ปรับปุ่มที่เป็น <span> ของหน้าปัจจุบัน */
.admin-pagination .admin-btn--primary {
    cursor: default;
    pointer-events: none; /* ป้องกันคลิก */
}
