/* portal/assets/css/portal.css
   Theme: ขาว-น้ำเงิน-ทอง (สะอาด อ่านง่าย สำหรับผู้ใช้ทั่วไป)
*/

:root {
  --p-navy: #0d2b5e;
  --p-blue: #1a56b0;
  --p-blue2: #2e6fd4;
  --p-gold: #c4840a;
  --p-gold2: #e6a91a;
  --p-bg: #f4f6fb;
  --p-card: #ffffff;
  --p-border: #dde3f0;
  --p-text: #1e2a3b;
  --p-muted: #6b7897;
  --p-sidebar: 240px;
  --p-header: 58px;
  --p-radius: 10px;
}

* {
  box-sizing: border-box;
}
body {
  font-family: "Sarabun", sans-serif;
  background: var(--p-bg);
  color: var(--p-text);
  font-size: 15px;
}

/* ===================== SIGNIN ===================== */
.portal-signin-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0d2b5e 0%, #1a56b0 60%, #0d2b5e 100%);
}
.portal-signin-bg {
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse at 30% 40%,
    rgba(230, 169, 26, 0.15),
    transparent 60%
  );
  pointer-events: none;
}
.portal-signin-container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 420px;
  padding: 1rem;
}
.portal-signin-card {
  background: #fff;
  border-radius: 18px;
  padding: 2.5rem 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.portal-signin-icon {
  width: 70px;
  height: 70px;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, var(--p-navy), var(--p-blue2));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #fff;
}
.portal-signin-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--p-navy);
  text-align: center;
  margin-bottom: 0.25rem;
}

.btn-portal-google {
  background: #fff;
  border: 1.5px solid #dadce0;
  color: #3c4043;
  font-weight: 600;
  border-radius: 8px;
  padding: 0.65rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-portal-google:hover {
  background: #f8f9fa;
  border-color: #a0a4b8;
  color: #1a1a1a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.portal-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--p-muted);
  font-size: 0.8rem;
  margin: 1.25rem 0;
}
.portal-divider::before,
.portal-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--p-border);
}

.btn-portal-primary {
  background: linear-gradient(135deg, var(--p-navy), var(--p-blue2));
  border: none;
  color: #fff;
  font-weight: 700;
  border-radius: 8px;
  padding: 0.75rem;
  transition: all 0.2s;
}
.btn-portal-primary:hover {
  background: linear-gradient(135deg, var(--p-blue), var(--p-blue2));
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26, 86, 176, 0.35);
}

/* ===================== LAYOUT ===================== */
.portal-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--p-sidebar);
  background: var(--p-navy);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width 0.3s;
  overflow: hidden;
}
.portal-wrapper {
  margin-left: var(--p-sidebar);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s;
}

/* Sidebar brand */
.ps-brand {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--p-header);
}
.ps-brand-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: var(--p-gold);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
}
.ps-brand-text h6 {
  color: var(--p-gold2);
  font-size: 0.8rem;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
}
.ps-brand-text small {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.68rem;
}

/* Sidebar nav */
.ps-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0;
}
.ps-section {
  padding: 0.4rem 1.1rem 0.15rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
}
.ps-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.55rem 1.1rem;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.ps-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.ps-link.active {
  background: rgba(230, 169, 26, 0.15);
  color: var(--p-gold2);
  border-left-color: var(--p-gold2);
}
.ps-link .ps-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* Sidebar user info */
.ps-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.ps-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0.75rem;
}
.ps-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(230, 169, 26, 0.4);
  object-fit: cover;
  flex-shrink: 0;
}
.ps-avatar-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--p-gold2);
  font-size: 0.9rem;
  flex-shrink: 0;
}
.ps-user-name {
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ps-user-role {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.68rem;
}
.ps-badge-dept {
  display: inline-block;
  background: rgba(230, 169, 26, 0.2);
  color: var(--p-gold2);
  border: 1px solid rgba(230, 169, 26, 0.35);
  border-radius: 20px;
  font-size: 0.68rem;
  padding: 1px 8px;
  margin-top: 2px;
}

.btn-portal-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.25);
  color: #f08090;
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  text-decoration: none;
  transition: all 0.2s;
  width: 100%;
  justify-content: center;
}
.btn-portal-logout:hover {
  background: rgba(220, 53, 69, 0.2);
  color: #ff8090;
}

/* ===================== HEADER ===================== */
.portal-header {
  height: var(--p-header);
  background: #fff;
  border-bottom: 1px solid var(--p-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}
.portal-content {
  flex: 1;
  padding: 1.5rem;
}
.portal-footer {
  border-top: 1px solid var(--p-border);
  padding: 0.75rem 1.5rem;
  color: var(--p-muted);
  font-size: 0.78rem;
  display: flex;
  justify-content: space-between;
}

/* ===================== PAGE ===================== */
.portal-page-title {
  color: var(--p-navy);
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
}
.portal-card {
  background: #fff;
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
}
.portal-card .card-header-p {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--p-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.portal-card .card-body-p {
  padding: 1.25rem;
}
.portal-card-title {
  font-weight: 700;
  color: var(--p-navy);
  font-size: 0.95rem;
}

/* Stat cards */
.p-stat {
  background: #fff;
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  padding: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  transition: all 0.25s;
}
.p-stat:hover {
  border-color: var(--p-blue);
  box-shadow: 0 2px 12px rgba(26, 86, 176, 0.12);
}
.p-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.p-stat-icon.blue {
  background: #e8f0fc;
  color: var(--p-blue2);
}
.p-stat-icon.gold {
  background: #fdf4e0;
  color: var(--p-gold);
}
.p-stat-icon.green {
  background: #e8f5e9;
  color: #2e7d32;
}
.p-stat-icon.red {
  background: #fce8e8;
  color: #c62828;
}
.p-stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--p-text);
  line-height: 1;
}
.p-stat-label {
  font-size: 0.8rem;
  color: var(--p-muted);
  margin-top: 2px;
}

/* Alert banner */
.p-alert-info {
  background: #e8f0fc;
  border: 1px solid #b3c8f5;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  color: var(--p-navy);
  font-size: 0.88rem;
}
.p-alert-warn {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  color: #7a5700;
  font-size: 0.88rem;
}
.p-alert-success {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  color: #1b5e20;
  font-size: 0.88rem;
}
.p-alert-danger {
  background: #fce8e8;
  border: 1px solid #ef9a9a;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  color: #7f1d1d;
  font-size: 0.88rem;
}

/* New google user — select dept panel */
.select-dept-panel {
  max-width: 500px;
  margin: 3rem auto;
  text-align: center;
}

/* Table */
.portal-table {
  color: var(--p-text);
  font-size: 0.875rem;
}
.portal-table thead th {
  background: #f4f6fb;
  color: var(--p-navy);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 2px solid var(--p-border);
}
.portal-table tbody tr:hover {
  background: #f8faff;
}

/* Form */
.portal-label {
  color: var(--p-navy);
  font-weight: 600;
  font-size: 0.85rem;
}
.portal-input {
  border: 1.5px solid var(--p-border);
  border-radius: 8px;
  color: var(--p-text);
  font-family: "Sarabun", sans-serif;
  transition: border 0.2s;
}
.portal-input:focus {
  border-color: var(--p-blue2);
  box-shadow: 0 0 0 3px rgba(46, 111, 212, 0.15);
  outline: none;
}

/* Vaccine grid */
.vaccine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}
.vaccine-item {
  background: #f4f6fb;
  border: 1.5px solid var(--p-border);
  border-radius: 8px;
  padding: 0.75rem;
}
.vaccine-item label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--p-muted);
  display: block;
  margin-bottom: 0.35rem;
}

/* Replace badge */
.badge-replaced {
  background: #fce8e8;
  color: #c62828;
  border: 1px solid #ef9a9a;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 20px;
}
.badge-replacer {
  background: #e8f0fc;
  color: var(--p-blue2);
  border: 1px solid #b3c8f5;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 20px;
}

/* Log */
.log-action {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
}
.log-create {
  background: #e8f5e9;
  color: #2e7d32;
}
.log-update {
  background: #e8f0fc;
  color: var(--p-blue2);
}
.log-delete {
  background: #fce8e8;
  color: #c62828;
}
.log-login {
  background: #fff8e1;
  color: #7a5700;
}
.log-replace {
  background: #fce4ec;
  color: #880e4f;
}
.log-upload {
  background: #f3e5f5;
  color: #4a148c;
}

/* Responsive */
@media (max-width: 768px) {
  .portal-sidebar {
    transform: translateX(-100%);
    width: var(--p-sidebar) !important;
  }
  .portal-sidebar.mobile-open {
    transform: translateX(0);
  }
  .portal-wrapper {
    margin-left: 0 !important;
  }
}
