/* ===== ADMIN CSS ===== */
:root {
  --primary: #1a2744;
  --primary-dark: #0f1929;
  --gold: #c9a227;
  --gold-light: #e6b93d;
  --white: #ffffff;
  --light: #f4f6fb;
  --border: #e2e8f0;
  --gray-400: #94a3b8;
  --gray-600: #64748b;
  --gray-800: #1e293b;
  --red: #ef4444;
  --green: #22c55e;
  --blue: #3b82f6;
  --yellow: #f59e0b;
  --sidebar-w: 260px;
  --header-h: 64px;
  --font: 'Sarabun', sans-serif;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --transition: all 0.25s ease;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font); background: var(--light); color: var(--gray-800); }

/* ===== LOGIN ===== */
.login-screen {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--white); border-radius: 20px;
  padding: 48px 44px; text-align: center;
  width: 100%; max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.3);
}
.login-logo {
  width: 80px; height: 80px; margin: 0 auto 24px;
  background: linear-gradient(135deg, var(--gold), #a88318);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; color: var(--primary-dark);
  box-shadow: 0 8px 24px rgba(201,162,39,0.4);
}
.login-card h2 { font-size: 26px; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.login-card > p { font-size: 14px; color: var(--gray-400); margin-bottom: 32px; }
.login-field {
  position: relative; margin-bottom: 16px;
}
.login-field i {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--gray-400); font-size: 16px;
}
.login-field input {
  width: 100%; padding: 14px 16px 14px 44px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font); font-size: 15px;
  outline: none; transition: var(--transition);
}
.login-field input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,39,0.15); }
.login-error {
  background: #fef2f2; border: 1px solid #fecaca; color: var(--red);
  padding: 10px 16px; border-radius: 8px; font-size: 14px;
  margin-bottom: 12px;
}
.btn-login {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, var(--gold), #a88318);
  color: var(--primary-dark); border: none; border-radius: var(--radius);
  font-family: var(--font); font-size: 16px; font-weight: 700;
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(201,162,39,0.4); }
.back-link { display: block; margin-top: 20px; color: var(--gray-400); font-size: 14px; text-decoration: none; }
.back-link:hover { color: var(--primary); }
.login-hint { margin-top: 16px; font-size: 13px; color: var(--gray-400); }
.login-hint code { background: var(--light); padding: 2px 6px; border-radius: 4px; font-size: 13px; }

/* ===== ADMIN LAYOUT ===== */
.admin-app { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w); background: var(--primary-dark);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100; transition: var(--transition);
  overflow: hidden;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo {
  width: 44px; height: 44px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold), #a88318);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: var(--primary-dark);
}
.sidebar-title { display: block; font-size: 13px; font-weight: 800; color: var(--white); letter-spacing: 0.5px; }
.sidebar-sub { display: block; font-size: 11px; color: rgba(255,255,255,0.4); }
.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 10px;
  color: rgba(255,255,255,0.6); text-decoration: none;
  font-size: 15px; font-weight: 500;
  transition: var(--transition); position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.nav-item.active { background: rgba(201,162,39,0.15); color: var(--gold-light); }
.nav-item i { font-size: 18px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: white; font-size: 12px; font-weight: 700;
  padding: 2px 8px; border-radius: 50px;
  display: none;
}
.nav-badge.show { display: inline-block; }
.sidebar-footer {
  padding: 12px; border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; flex-direction: column; gap: 4px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 8px;
  color: rgba(255,255,255,0.5); font-size: 14px;
  text-decoration: none; background: none; border: none;
  cursor: pointer; font-family: var(--font);
  transition: var(--transition); width: 100%;
}
.sidebar-link:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.logout-btn:hover { color: #f87171 !important; }
.sidebar-toggle { display: none; }

/* ===== MAIN ===== */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column;
  min-height: 100vh;
}
.admin-header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; position: sticky; top: 0; z-index: 50;
}
.mobile-menu-btn {
  display: none; background: none; border: none;
  font-size: 20px; color: var(--gray-600); cursor: pointer;
}
.header-title { font-size: 20px; font-weight: 700; color: var(--primary); flex: 1; }
.header-time { font-size: 13px; color: var(--gray-400); }
.header-avatar {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-light); font-size: 16px;
}

/* ===== PAGES ===== */
.page { display: none; padding: 28px; }
.page.active { display: block; }

/* ===== DASHBOARD ===== */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 20px; margin-bottom: 28px;
}
.stat-card {
  background: var(--white); border-radius: var(--radius);
  padding: 24px; display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow); transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
.stat-icon {
  width: 56px; height: 56px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
}
.inquiries-icon { background: rgba(59,130,246,0.1); color: var(--blue); }
.new-icon { background: rgba(245,158,11,0.1); color: var(--yellow); }
.progress-icon { background: rgba(201,162,39,0.1); color: var(--gold); }
.news-icon { background: rgba(34,197,94,0.1); color: var(--green); }
.stat-value { display: block; font-size: 32px; font-weight: 800; color: var(--primary); line-height: 1; }
.stat-label { font-size: 13px; color: var(--gray-400); margin-top: 4px; }

.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dash-section { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.dash-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.dash-header h3 { font-size: 16px; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.dash-header h3 i { color: var(--gold); }
.view-all { font-size: 13px; color: var(--gold); text-decoration: none; font-weight: 600; cursor: pointer; }
.view-all:hover { text-decoration: underline; }

/* ===== INQUIRY MINI LIST ===== */
.inquiry-mini { padding: 12px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.inquiry-mini:last-child { border-bottom: none; }
.inq-name { font-size: 14px; font-weight: 600; color: var(--primary); flex: 1; }
.inq-phone { font-size: 13px; color: var(--gray-400); }
.inq-date { font-size: 12px; color: var(--gray-400); }

/* ===== STATUS BADGES ===== */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 50px;
  font-size: 12px; font-weight: 600;
}
.badge-new { background: rgba(245,158,11,0.1); color: var(--yellow); }
.badge-contacted { background: rgba(59,130,246,0.1); color: var(--blue); }
.badge-in-progress { background: rgba(201,162,39,0.1); color: var(--gold); }
.badge-completed { background: rgba(34,197,94,0.1); color: var(--green); }
/* Career status badges */
.badge-career-new { background: rgba(245,158,11,0.1); color: var(--yellow); }
.badge-career-reviewing { background: rgba(99,102,241,0.12); color: #818cf8; }
.badge-career-interview { background: rgba(59,130,246,0.1); color: var(--blue); }
.badge-career-hired { background: rgba(34,197,94,0.1); color: var(--green); }
.badge-career-rejected { background: rgba(239,68,68,0.1); color: #f87171; }

/* ===== TABLE ===== */
.page-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.filter-select {
  padding: 8px 14px; border: 2px solid var(--border); border-radius: 8px;
  font-family: var(--font); font-size: 14px; outline: none;
  cursor: pointer; background: var(--white);
}
.filter-select:focus { border-color: var(--gold); }
.btn-icon {
  width: 36px; height: 36px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--gray-600);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.btn-icon:hover { background: var(--light); }
.btn-add {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px; background: linear-gradient(135deg, var(--gold), #a88318);
  color: var(--primary-dark); border: none; border-radius: 10px;
  font-family: var(--font); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: var(--transition);
}
.btn-add:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(201,162,39,0.35); }

.table-container { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: var(--primary); color: rgba(255,255,255,0.85);
  padding: 14px 16px; text-align: left; font-size: 13px; font-weight: 600;
  white-space: nowrap;
}
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(201,162,39,0.04); }
.table-actions { display: flex; gap: 6px; }
.tbl-btn {
  padding: 5px 10px; border-radius: 6px; border: none;
  font-size: 12px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: 4px;
  font-family: var(--font); transition: var(--transition);
}
.tbl-btn-view { background: rgba(59,130,246,0.1); color: var(--blue); }
.tbl-btn-view:hover { background: var(--blue); color: white; }
.tbl-btn-delete { background: rgba(239,68,68,0.1); color: var(--red); }
.tbl-btn-delete:hover { background: var(--red); color: white; }
.empty-row { text-align: center; padding: 48px; color: var(--gray-400); font-size: 15px; }

/* ===== NEWS ADMIN ===== */
.news-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.news-admin-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  transition: var(--transition);
}
.news-admin-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.news-card-img { height: 180px; background: var(--light); overflow: hidden; position: relative; }
.news-card-img img { width: 100%; height: 100%; object-fit: cover; }
.news-status-badge {
  position: absolute; top: 12px; right: 12px;
  padding: 4px 10px; border-radius: 50px; font-size: 12px; font-weight: 700;
}
.status-published { background: rgba(34,197,94,0.9); color: white; }
.status-draft { background: rgba(100,116,139,0.9); color: white; }
.news-admin-content { padding: 16px; }
.news-admin-content h4 { font-size: 15px; font-weight: 700; color: var(--primary); margin-bottom: 8px; line-height: 1.4; }
.news-admin-content p { font-size: 13px; color: var(--gray-600); line-height: 1.6; margin-bottom: 12px; }
.news-date { font-size: 12px; color: var(--gray-400); margin-bottom: 12px; display: flex; align-items: center; gap: 4px; }
.news-admin-actions { display: flex; gap: 8px; }
.btn-edit {
  flex: 1; padding: 8px; background: rgba(201,162,39,0.1); color: var(--gold);
  border: none; border-radius: 8px; font-family: var(--font); font-size: 13px;
  font-weight: 600; cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.btn-edit:hover { background: var(--gold); color: var(--primary-dark); }
.btn-del {
  flex: 1; padding: 8px; background: rgba(239,68,68,0.1); color: var(--red);
  border: none; border-radius: 8px; font-family: var(--font); font-size: 13px;
  font-weight: 600; cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.btn-del:hover { background: var(--red); color: white; }

/* ===== SETTINGS ===== */
.settings-container { max-width: 800px; }
.settings-form { display: flex; flex-direction: column; gap: 32px; }
.settings-section {
  background: var(--white); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow);
}
.settings-section h3 {
  font-size: 17px; font-weight: 700; color: var(--primary);
  margin-bottom: 20px; display: flex; align-items: center; gap: 8px;
  padding-bottom: 14px; border-bottom: 2px solid var(--border);
}
.settings-section h3 i { color: var(--gold); }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.form-group input, .form-group textarea {
  padding: 10px 14px; border: 2px solid var(--border); border-radius: 8px;
  font-family: var(--font); font-size: 14px; outline: none; transition: var(--transition);
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,39,0.1); }
.form-group textarea { resize: vertical; }
.req { color: var(--red); }
.form-actions { display: flex; }
.btn-save {
  padding: 12px 32px; background: linear-gradient(135deg, var(--gold), #a88318);
  color: var(--primary-dark); border: none; border-radius: 10px;
  font-family: var(--font); font-size: 15px; font-weight: 700;
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; gap: 8px;
}
.btn-save:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(201,162,39,0.4); }
#settingsFeedback { margin-top: 16px; }
.feedback-ok { color: var(--green); font-size: 14px; font-weight: 600; }
.feedback-err { color: var(--red); font-size: 14px; font-weight: 600; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 15px; font-weight: 500; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal {
  background: var(--white); border-radius: 20px;
  width: 100%; max-width: 560px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.3);
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 28px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 20px; font-weight: 700; color: var(--primary); }
.modal-close {
  width: 36px; height: 36px; background: var(--light); border: none;
  border-radius: 8px; cursor: pointer; font-size: 16px; color: var(--gray-600);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--red); color: white; }
#newsForm { padding: 24px 28px; display: flex; flex-direction: column; gap: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-cancel {
  padding: 10px 24px; background: var(--light); border: none; border-radius: 8px;
  font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer;
  color: var(--gray-600); transition: var(--transition);
}
.btn-cancel:hover { background: var(--border); }

.image-upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius);
  cursor: pointer; transition: var(--transition);
}
.image-upload-area:hover { border-color: var(--gold); background: rgba(201,162,39,0.03); }
.image-preview {
  padding: 32px; text-align: center; display: flex;
  flex-direction: column; align-items: center; gap: 8px;
  color: var(--gray-400);
}
.image-preview i { font-size: 36px; color: var(--gold); }
.image-preview span { font-size: 14px; font-weight: 500; }
.image-hint { font-size: 12px !important; color: var(--gray-400) !important; font-weight: 400 !important; }
.image-preview img { max-height: 180px; border-radius: 8px; object-fit: contain; }

/* Inquiry detail */
#inquiryDetail { padding: 24px 28px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.detail-item label { font-size: 12px; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: 1px; }
.detail-item p { font-size: 15px; color: var(--primary); font-weight: 500; margin-top: 4px; }
.detail-full { grid-column: 1 / -1; }
.status-select { padding: 8px 14px; border: 2px solid var(--border); border-radius: 8px; font-family: var(--font); font-size: 14px; outline: none; cursor: pointer; }
.status-select:focus { border-color: var(--gold); }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 2000;
  padding: 14px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 600; color: white;
  transform: translateY(80px) scale(0.95); opacity: 0;
  transition: all 0.3s ease;
  display: flex; align-items: center; gap: 8px;
  max-width: 320px;
}
.toast.show { transform: translateY(0) scale(1); opacity: 1; }
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
.toast-info { background: var(--blue); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .mobile-menu-btn { display: block; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page { padding: 16px; }
  .settings-grid { grid-template-columns: 1fr; }
}
