/* assets/css/admin.css - สไตล์แผงควบคุมระบบหลังบ้าน (Admin CMS) */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&family=Prompt:wght@300;400;500;600;700&display=swap');

:root {
  --admin-primary: #1e3a8a;
  --admin-accent: #2563eb;
  --admin-sidebar: #0f172a;
  --admin-sidebar-hover: #1e293b;
  --admin-bg: #f1f5f9;
  --admin-card: #ffffff;
  --admin-text: #1e293b;
  --admin-muted: #64748b;
  --admin-border: #e2e8f0;
  --admin-radius: 12px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Prompt', sans-serif;
  background-color: var(--admin-bg);
  color: var(--admin-text);
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Kanit', sans-serif;
  font-weight: 600;
  color: #0f172a;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Admin Layout */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 270px;
  background-color: var(--admin-sidebar);
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: all 0.3s ease;
  z-index: 100;
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: white;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.sidebar-brand h3 {
  color: white;
  font-size: 1.05rem;
  line-height: 1.2;
}

.sidebar-brand span {
  font-size: 0.75rem;
  color: #64748b;
}

.sidebar-nav {
  padding: 1.25rem 0.75rem;
  flex-grow: 1;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #475569;
  letter-spacing: 0.5px;
  padding: 0.75rem 0.75rem 0.25rem 0.75rem;
  font-weight: 600;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.925rem;
  font-weight: 500;
  color: #94a3b8;
  transition: all 0.2s ease;
}

.sidebar-nav li a:hover {
  background-color: var(--admin-sidebar-hover);
  color: white;
}

.sidebar-nav li a.active {
  background: linear-gradient(90deg, #1e3a8a, #2563eb);
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-user-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.75rem;
  border-radius: 8px;
}

.admin-avatar-mini {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #3b82f6;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.admin-user-info h5 {
  color: white;
  font-size: 0.85rem;
  margin-bottom: 0.1rem;
}

.admin-user-info span {
  font-size: 0.75rem;
  color: #64748b;
}

/* Main Content Area */
.admin-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-topbar {
  background: white;
  border-bottom: 1px solid var(--admin-border);
  padding: 0 2rem;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.toggle-sidebar-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--admin-muted);
  cursor: pointer;
}

.topbar-title h2 {
  font-size: 1.35rem;
  color: #0f172a;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-content {
  padding: 2rem;
  flex-grow: 1;
}

/* Dashboard Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border-radius: var(--admin-radius);
  padding: 1.5rem;
  border: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  transition: transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.05);
}

.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.blue { background: #eff6ff; color: #2563eb; }
.stat-icon.green { background: #ecfdf5; color: #059669; }
.stat-icon.amber { background: #fffbeb; color: #d97706; }
.stat-icon.purple { background: #f5f3ff; color: #7c3aed; }

.stat-data h3 {
  font-size: 1.75rem;
  color: #0f172a;
  line-height: 1.2;
}

.stat-data p {
  color: var(--admin-muted);
  font-size: 0.85rem;
}

/* Admin Cards & Panels */
.admin-card {
  background: white;
  border-radius: var(--admin-radius);
  border: 1px solid var(--admin-border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  margin-bottom: 2rem;
  overflow: hidden;
}

.admin-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafafa;
}

.admin-card-header h3 {
  font-size: 1.15rem;
  color: #0f172a;
}

.admin-card-body {
  padding: 1.5rem;
}

/* Admin Tables */
.table-responsive {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.admin-table th {
  background: #f8fafc;
  padding: 0.85rem 1rem;
  font-family: 'Kanit', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: #475569;
  border-bottom: 1px solid var(--admin-border);
}

.admin-table td {
  padding: 1rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--admin-border);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background-color: #f8fafc;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-primary { background: #dbeafe; color: #1e40af; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #e0f2fe; color: #0369a1; }

.action-btns {
  display: flex;
  gap: 0.4rem;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--admin-border);
  background: white;
  color: var(--admin-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: #f1f5f9;
  color: var(--admin-text);
}

.btn-icon.delete:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fecaca;
}

/* Buttons */
.btn-sm {
  padding: 0.4rem 0.85rem !important;
  font-size: 0.85rem !important;
}

.btn-danger {
  background: #dc2626;
  color: white;
}
.btn-danger:hover {
  background: #b91c1c;
}

/* Forms */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.25rem;
}

/* Login Page Styling */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  padding: 2.5rem;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: white;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin-bottom: 1rem;
  box-shadow: 0 6px 15px rgba(37, 99, 235, 0.3);
}

/* Responsive */
@media (max-width: 992px) {
  .admin-sidebar {
    position: fixed;
    left: -270px;
    top: 0;
    bottom: 0;
  }

  .admin-sidebar.open {
    left: 0;
  }

  .toggle-sidebar-btn {
    display: block;
  }

  .form-grid-2, .form-grid-3 {
    grid-template-columns: 1fr;
  }
}
