/* ============================================
   ระบบแสดงความคิดเห็น เสนอแนะ ติ ชม แจ้งปัญหา
   วิทยาลัยอาชีวศึกษาขอนแก่น ตามแนวทาง ITA
   Design System & Stylesheet
   ============================================ */

/* ===== FONT IMPORTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

/* ===== CSS VARIABLES ===== */
:root {
  /* Primary Colors - Blue */
  --primary: #1565C0;
  --primary-light: #42A5F5;
  --primary-lighter: #90CAF9;
  --primary-dark: #0D47A1;
  --primary-darker: #0A3A7E;
  --primary-gradient: linear-gradient(135deg, #1E88E5 0%, #0D47A1 100%);
  --primary-gradient-hover: linear-gradient(135deg, #42A5F5 0%, #1565C0 100%);

  /* Accent Colors - Yellow */
  --accent: #FFC107;
  --accent-light: #FFD54F;
  --accent-dark: #FFA000;
  --accent-gradient: linear-gradient(135deg, #FFD54F 0%, #FFA000 100%);

  /* Background Colors */
  --bg-main: #F0F4F8;
  --bg-card: #FFFFFF;
  --bg-glass: rgba(255, 255, 255, 0.82);
  --bg-glass-strong: rgba(255, 255, 255, 0.92);
  --bg-overlay: rgba(13, 71, 161, 0.6);
  --bg-dark: #0D1B2A;

  /* Text Colors */
  --text-primary: #1A1A2E;
  --text-secondary: #4A5568;
  --text-muted: #94A3B8;
  --text-white: #FFFFFF;
  --text-link: #1E88E5;

  /* Border */
  --border-light: rgba(0, 0, 0, 0.08);
  --border-medium: rgba(0, 0, 0, 0.15);
  --border-glass: rgba(255, 255, 255, 0.25);

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 50px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-blue: 0 4px 20px rgba(21, 101, 192, 0.3);
  --shadow-yellow: 0 4px 20px rgba(255, 193, 7, 0.3);

  /* Radius */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* Font */
  --font-thai: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-en: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Status Colors */
  --status-pending: #F59E0B;
  --status-pending-bg: #FEF3C7;
  --status-pending-border: #FCD34D;
  --status-progress: #3B82F6;
  --status-progress-bg: #DBEAFE;
  --status-progress-border: #93C5FD;
  --status-done: #10B981;
  --status-done-bg: #D1FAE5;
  --status-done-border: #6EE7B7;

  /* Category Colors */
  --cat-complaint: #EF4444;
  --cat-complaint-bg: #FEE2E2;
  --cat-suggestion: #3B82F6;
  --cat-suggestion-bg: #DBEAFE;
  --cat-opinion: #8B5CF6;
  --cat-opinion-bg: #EDE9FE;
  --cat-other: #6B7280;
  --cat-other-bg: #F3F4F6;

  /* Danger */
  --danger: #EF4444;
  --danger-bg: #FEE2E2;
  --success: #10B981;
  --success-bg: #D1FAE5;
  --warning: #F59E0B;
  --warning-bg: #FEF3C7;
  --info: #3B82F6;
  --info-bg: #DBEAFE;
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-thai);
  color: var(--text-primary);
  background-color: var(--bg-main);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--text-link);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  color: var(--primary-dark);
}

img {
  max-width: 100%;
  height: auto;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-lighter);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}

/* ===== CONTAINER ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-sm {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== HEADER ===== */
.header {
  background: var(--primary-gradient);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

.header-top {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-section img {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  border: 2px solid var(--accent);
  object-fit: cover;
  background: white;
  box-shadow: var(--shadow-yellow);
}

.logo-text h1 {
  color: var(--text-white);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.3px;
}

.logo-text p {
  color: var(--accent-light);
  font-size: 0.78rem;
  font-weight: 400;
  opacity: 0.95;
}

.header-nav {
  padding: 0;
  background: rgba(0, 0, 0, 0.1);
}

.nav-tabs {
  display: flex;
  gap: 0;
  list-style: none;
}

.nav-tab {
  padding: 14px 28px;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  border: none;
  background: none;
  font-family: var(--font-thai);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-tab:hover {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.1);
}

.nav-tab.active {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.15);
}

.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  border-radius: var(--radius-full) var(--radius-full) 0 0;
}

.nav-tab .icon {
  font-size: 1.1rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-link {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-link:hover {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
}

/* ===== HERO SECTION ===== */
.hero-section {
  background: var(--primary-gradient);
  padding: 48px 0 56px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: rgba(255, 193, 7, 0.08);
  pointer-events: none;
}

.hero-section::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.hero-title {
  color: var(--text-white);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.hero-subtitle {
  color: var(--accent-light);
  font-size: 1.05rem;
  font-weight: 400;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  opacity: 0.95;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  padding: 8px 20px;
  border-radius: var(--radius-full);
  color: var(--text-white);
  font-size: 0.85rem;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ===== TAB CONTENT ===== */
.tab-content {
  display: none;
  animation: fadeInUp 0.4s ease;
}

.tab-content.active {
  display: block;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  padding: 40px 0;
  min-height: 60vh;
}

/* ===== FORM STYLES ===== */
.form-section {
  max-width: 780px;
  margin: 0 auto;
}

.form-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
}

.form-header {
  text-align: center;
  margin-bottom: 36px;
}

.form-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.form-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.form-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 32px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.form-divider .icon {
  font-size: 1.2rem;
}

.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-label .required {
  color: var(--danger);
  margin-left: 4px;
}

.form-label .optional {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.82rem;
  margin-left: 6px;
}

.form-control {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  font-family: var(--font-thai);
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.1);
}

.form-control:hover {
  border-color: var(--primary-lighter);
}

.form-control::placeholder {
  color: var(--text-muted);
}

textarea.form-control {
  resize: vertical;
  min-height: 140px;
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%234A5568' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 44px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-error {
  color: var(--danger);
  font-size: 0.82rem;
  margin-top: 6px;
  display: none;
}

.form-control.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* ===== FILE UPLOAD ===== */
.file-upload-area {
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: rgba(33, 150, 243, 0.02);
  position: relative;
}

.file-upload-area:hover {
  border-color: var(--primary-light);
  background: rgba(33, 150, 243, 0.05);
}

.file-upload-area.dragover {
  border-color: var(--primary);
  background: rgba(33, 150, 243, 0.08);
  transform: scale(1.01);
}

.file-upload-area .upload-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  color: var(--primary-light);
}

.file-upload-area .upload-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

.file-upload-area .upload-text strong {
  color: var(--primary);
}

.file-upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.image-preview {
  margin-top: 16px;
  display: none;
  position: relative;
}

.image-preview img {
  max-height: 200px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.image-preview .remove-image {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: white;
  border: 2px solid white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.image-preview .remove-image:hover {
  transform: scale(1.1);
  background: #DC2626;
}

/* ===== PDPA SECTION ===== */
.pdpa-section {
  background: linear-gradient(135deg, #EFF6FF 0%, #F0F4FF 100%);
  border: 1px solid var(--primary-lighter);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.pdpa-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdpa-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.pdpa-details {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 20px;
  padding-left: 4px;
}

.pdpa-details li {
  margin-bottom: 6px;
  list-style: none;
  position: relative;
  padding-left: 22px;
}

.pdpa-details li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 700;
}

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
  margin-top: 2px;
  flex-shrink: 0;
}

.checkbox-group label {
  font-size: 0.9rem;
  color: var(--text-primary);
  cursor: pointer;
  font-weight: 500;
  line-height: 1.5;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: var(--radius-md);
  font-family: var(--font-thai);
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: var(--transition);
}

.btn:hover::after {
  opacity: 1;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--primary-gradient);
  color: var(--text-white);
  box-shadow: var(--shadow-blue);
}

.btn-primary:hover {
  background: var(--primary-gradient-hover);
  box-shadow: 0 6px 25px rgba(21, 101, 192, 0.4);
  transform: translateY(-2px);
}

.btn-accent {
  background: var(--accent-gradient);
  color: var(--text-primary);
  box-shadow: var(--shadow-yellow);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(255, 193, 7, 0.4);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: var(--text-white);
}

.btn-danger {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: var(--text-white);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(239, 68, 68, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #10B981, #059669);
  color: var(--text-white);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(16, 185, 129, 0.4);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 16px 40px;
  font-size: 1.05rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  font-size: 1rem;
}

/* ===== COMPLAINT CARDS ===== */
.complaints-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 24px;
}

.complaint-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.complaint-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.complaint-card-header {
  padding: 20px 24px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.complaint-card-body {
  padding: 0 24px 20px;
  flex: 1;
}

.complaint-card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.01);
}

.complaint-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.complaint-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.complaint-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.complaint-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

/* ===== BADGES / TAGS ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-category {
  padding: 5px 14px;
}

.badge-complaint {
  background: var(--cat-complaint-bg);
  color: var(--cat-complaint);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-suggestion {
  background: var(--cat-suggestion-bg);
  color: var(--cat-suggestion);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-opinion {
  background: var(--cat-opinion-bg);
  color: var(--cat-opinion);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.badge-other {
  background: var(--cat-other-bg);
  color: var(--cat-other);
  border: 1px solid rgba(107, 114, 128, 0.2);
}

.badge-status {
  padding: 5px 14px;
}

.badge-pending {
  background: var(--status-pending-bg);
  color: var(--status-pending);
  border: 1px solid var(--status-pending-border);
}

.badge-progress {
  background: var(--status-progress-bg);
  color: var(--status-progress);
  border: 1px solid var(--status-progress-border);
}

.badge-done {
  background: var(--status-done-bg);
  color: var(--status-done);
  border: 1px solid var(--status-done-border);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.show {
  display: flex;
  opacity: 1;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.show .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 24px 28px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--bg-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-secondary);
  transition: var(--transition);
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.modal-body {
  padding: 24px 28px;
}

.modal-footer {
  padding: 16px 28px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--border-light);
}

.detail-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.detail-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.detail-label {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.88rem;
  min-width: 120px;
  flex-shrink: 0;
}

.detail-value {
  color: var(--text-primary);
  font-size: 0.92rem;
  line-height: 1.6;
  word-break: break-word;
}

.detail-value img {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius-md);
  margin-top: 8px;
  box-shadow: var(--shadow-md);
}

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 20px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  border: 2px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-thai);
}

.filter-btn:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

.filter-btn.active {
  background: var(--primary);
  color: var(--text-white);
  border-color: var(--primary);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 0.9rem;
}

/* ===== TOAST / NOTIFICATION ===== */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  padding: 16px 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 300px;
  max-width: 420px;
  animation: slideInRight 0.4s ease, fadeOutRight 0.4s ease forwards;
  animation-delay: 0s, 3.5s;
}

.toast-success {
  background: #065F46;
  color: white;
  border-left: 4px solid var(--success);
}

.toast-error {
  background: #991B1B;
  color: white;
  border-left: 4px solid var(--danger);
}

.toast-warning {
  background: #92400E;
  color: white;
  border-left: 4px solid var(--warning);
}

.toast-info {
  background: #1E40AF;
  color: white;
  border-left: 4px solid var(--info);
}

/* ===== LOADING ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

.loading-overlay.show {
  display: flex;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--primary-lighter);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 3px;
}

.loading-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===== FOOTER ===== */
.footer {
  background: var(--bg-dark);
  color: rgba(255, 255, 255, 0.7);
  padding: 32px 0;
  text-align: center;
  margin-top: auto;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.footer-logo img {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 2px solid var(--accent);
  background: white;
}

.footer-text {
  font-size: 0.88rem;
  line-height: 1.6;
}

.footer-text strong {
  color: var(--accent-light);
}

.footer-divider {
  width: 60px;
  height: 3px;
  background: var(--accent);
  border-radius: var(--radius-full);
  margin: 4px 0;
}

.footer-copy {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.4);
}

/* ═══════════════════════════════════════
   ADMIN STYLES
   ═══════════════════════════════════════ */

/* ===== ADMIN LOGIN ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-gradient);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -20%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: rgba(255, 193, 7, 0.06);
}

.login-page::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -15%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
}

.login-card {
  background: var(--bg-glass-strong);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-2xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-glass);
  position: relative;
  z-index: 1;
  text-align: center;
}

.login-logo {
  margin-bottom: 28px;
}

.login-logo img {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  border: 3px solid var(--accent);
  box-shadow: var(--shadow-yellow);
  background: white;
}

.login-logo h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-top: 16px;
  line-height: 1.4;
}

.login-logo p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.login-form .form-group {
  text-align: left;
}

.login-form .form-control {
  background: rgba(255, 255, 255, 0.8);
}

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 12px;
  display: none;
}

/* ===== ADMIN DASHBOARD ===== */
.admin-page {
  display: none;
  min-height: 100vh;
  background: var(--bg-main);
}

.admin-header {
  background: var(--primary-gradient);
  padding: 16px 0;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-header-left img {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  border: 2px solid var(--accent);
  background: white;
}

.admin-header-left h2 {
  color: var(--text-white);
  font-size: 1.1rem;
  font-weight: 600;
}

.admin-header-left p {
  color: var(--accent-light);
  font-size: 0.8rem;
}

.admin-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-user {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-logout {
  padding: 8px 20px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-white);
  border: 1px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  font-family: var(--font-thai);
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ===== STATS GRID ===== */
.stats-section {
  padding: 32px 0 8px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  border-radius: 0 0 0 80px;
  opacity: 0.1;
}

.stat-card.total::after { background: var(--primary); }
.stat-card.pending::after { background: var(--status-pending); }
.stat-card.progress::after { background: var(--status-progress); }
.stat-card.done::after { background: var(--status-done); }

.stat-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.stat-card.total .stat-icon { color: var(--primary); }
.stat-card.pending .stat-icon { color: var(--status-pending); }
.stat-card.progress .stat-icon { color: var(--status-progress); }
.stat-card.done .stat-icon { color: var(--status-done); }

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ===== ADMIN TABLE ===== */
.table-section {
  padding: 24px 0 48px;
}

.table-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.table-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.table-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.table-filters {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.search-input {
  padding: 10px 16px 10px 40px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-family: var(--font-thai);
  width: 260px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394A3B8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 14px center;
  transition: var(--transition);
  outline: none;
}

.search-input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.filter-select {
  padding: 10px 16px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-family: var(--font-thai);
  cursor: pointer;
  outline: none;
  background: white;
  transition: var(--transition);
}

.filter-select:focus {
  border-color: var(--primary-light);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead {
  background: rgba(21, 101, 192, 0.04);
}

.data-table th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border-light);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  font-size: 0.88rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: var(--transition-fast);
}

.data-table tbody tr:hover {
  background: rgba(33, 150, 243, 0.03);
}

.data-table .title-cell {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.table-actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

.table-actions .btn-icon {
  width: 32px;
  height: 32px;
  font-size: 0.85rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-actions .btn-icon:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.table-actions .btn-icon.danger:hover {
  background: var(--danger);
  border-color: var(--danger);
}

.table-actions .btn-icon.success:hover {
  background: var(--success);
  border-color: var(--success);
}

.table-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.table-responsive {
  overflow-x: auto;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #CBD5E1;
  border-radius: var(--radius-full);
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--success);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ===== ADMIN MODAL OVERRIDES ===== */
.admin-detail-section {
  margin-bottom: 20px;
}

.admin-detail-section h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-lighter);
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-actions-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100px);
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-fadeIn {
  animation: fadeIn 0.5s ease;
}

.animate-fadeInUp {
  animation: fadeInUp 0.5s ease;
}

.animate-scaleIn {
  animation: scaleIn 0.3s ease;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .complaints-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  .header-content {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }

  .logo-section {
    flex-direction: column;
    text-align: center;
  }

  .logo-text h1 {
    font-size: 0.95rem;
  }

  .nav-tabs {
    width: 100%;
  }

  .nav-tab {
    flex: 1;
    justify-content: center;
    padding: 12px 16px;
    font-size: 0.85rem;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
  }

  .form-card {
    padding: 24px 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .complaints-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-number {
    font-size: 1.5rem;
  }

  .table-header {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input {
    width: 100%;
  }

  .table-filters {
    flex-direction: column;
  }

  .filter-select {
    width: 100%;
  }

  .admin-header-content {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .admin-header-right {
    flex-direction: column;
    gap: 8px;
  }

  .login-card {
    padding: 32px 24px;
    margin: 16px;
  }

  .modal {
    margin: 16px;
    max-height: 90vh;
  }

  .modal-header {
    padding: 20px;
  }

  .modal-body {
    padding: 20px;
  }

  .detail-row {
    flex-direction: column;
    gap: 4px;
  }

  .detail-label {
    min-width: auto;
  }

  .toast {
    min-width: auto;
    max-width: calc(100vw - 48px);
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .btn-lg {
    padding: 14px 28px;
  }

  .hero-section {
    padding: 32px 0 40px;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-btn {
    text-align: center;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .header,
  .footer,
  .nav-tabs,
  .filter-bar,
  .table-actions,
  .btn {
    display: none !important;
  }

  .main-content {
    padding: 0;
  }

  .complaint-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* ===== UTILITY CLASSES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-primary { color: var(--primary) !important; }
.text-accent { color: var(--accent) !important; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-muted { color: var(--text-muted) !important; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.d-flex { display: flex; }
.d-none { display: none !important; }
.d-block { display: block; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.visible { display: block !important; }
