/* ==========================================================================
   Document Verification & Feedback Dashboard System
   Theme: Clean White & Emerald Green (ขาว-เขียวคลีน สบายตา)
   ========================================================================== */

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

:root {
  /* Color Palette - Clean White & Emerald Green */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  
  /* Primary Green Shades */
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-dark: #047857;
  --primary-light: #d1fae5;
  --primary-glow: rgba(16, 185, 129, 0.15);

  /* Neutral Text & Borders */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border-color: #e2e8f0;
  --border-focus: #10b981;

  /* Status Colors */
  --status-approved-bg: #d1fae5;
  --status-approved-text: #065f46;
  --status-pending-bg: #fef3c7;
  --status-pending-text: #92400e;
  --status-assigned-bg: #e0f2fe;
  --status-assigned-text: #075985;
  --status-resolved-bg: #ecfdf5;
  --status-resolved-text: #047857;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-green: 0 10px 25px -5px rgba(16, 185, 129, 0.25);

  /* Layout */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: all 0.25s ease-in-out;
}

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

body {
  font-family: 'Prompt', 'Inter', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Navbar */
.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-green);
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-text p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.nav-tabs {
  display: flex;
  background: var(--bg-main);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 4px;
}

.tab-btn {
  font-family: inherit;
  border: none;
  background: transparent;
  padding: 0.55rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--primary-dark);
  background: rgba(16, 185, 129, 0.05);
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--primary-dark);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.tab-badge {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Main Content Area */
.main-content {
  max-width: 1280px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  width: 100%;
  flex: 1;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease-out forwards;
}

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Card Styling */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  transition: var(--transition);
}

.card-header {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--bg-main);
  padding-bottom: 1rem;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card-title i {
  color: var(--primary);
}

.card-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Form Styles */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.form-label .required {
  color: #ef4444;
}

.form-control {
  font-family: inherit;
  width: 100%;
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-main);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

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

/* Verification Radio & Checkbox Cards */
.checklist-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
}

.check-item-card {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
}

.check-item-card:hover {
  border-color: #cbd5e1;
}

.check-item-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-main);
}

.radio-group {
  display: flex;
  gap: 0.5rem;
}

.radio-option {
  position: relative;
}

.radio-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.radio-option input[type="radio"]:checked + .radio-btn.yes {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.radio-option input[type="radio"]:checked + .radio-btn.no {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.radio-option input[type="radio"]:checked + .radio-btn.na {
  background: #64748b;
  color: white;
  border-color: #64748b;
}

/* Edit Required Toggle Section */
.edit-flag-section {
  background: #fffbebf5;
  border: 1px solid #fef3c7;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1.25rem;
}

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

.edit-toggle-title {
  font-weight: 600;
  color: #b45309;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toggle-switch {
  display: flex;
  background: #fef3c7;
  padding: 3px;
  border-radius: 20px;
  gap: 4px;
}

.toggle-btn {
  padding: 0.35rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 16px;
  border: none;
  background: transparent;
  color: #78350f;
  cursor: pointer;
  transition: var(--transition);
}

.toggle-btn.active.no-edit {
  background: var(--primary);
  color: white;
}

.toggle-btn.active.has-edit {
  background: #f59e0b;
  color: white;
}

.edit-details-box {
  margin-top: 1rem;
  display: none;
  animation: slideDown 0.25s ease-out forwards;
}

.edit-details-box.show {
  display: block;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Buttons */
.btn {
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  box-shadow: var(--shadow-green);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover), var(--primary-dark));
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-main);
  border-color: #cbd5e1;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.btn-icon:hover {
  background: var(--bg-main);
  color: var(--text-main);
}

/* Passcode Pin Input */
.passcode-input {
  letter-spacing: 0.4rem;
  font-size: 1.5rem;
  text-align: center;
  font-weight: 700;
  color: var(--primary-dark);
}

/* Dashboard KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.kpi-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.kpi-icon.total { background: #e0f2fe; color: #0284c7; }
.kpi-icon.approved { background: var(--primary-light); color: var(--primary-dark); }
.kpi-icon.pending { background: #fef3c7; color: #d97706; }
.kpi-icon.resolved { background: #dcfce7; color: #15803d; }

.kpi-info h3 {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-main);
}

.kpi-info p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Editor Workload Summary Bar */
.editors-workload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.editor-workload-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.editor-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.editor-count {
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--bg-main);
  padding: 2px 10px;
  border-radius: 12px;
  color: var(--primary-dark);
}

/* Controls Bar (Filter/Search) */
.table-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.search-box {
  position: relative;
  min-width: 260px;
  flex: 1;
}

.search-box input {
  padding-left: 2.3rem;
}

.search-box i {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
}

.filter-group {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* Data Table */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  background: #f1f5f9;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tbody tr:hover td {
  background: var(--bg-main);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-approved {
  background: var(--status-approved-bg);
  color: var(--status-approved-text);
}

.badge-pending {
  background: var(--status-pending-bg);
  color: var(--status-pending-text);
}

.badge-assigned {
  background: var(--status-assigned-bg);
  color: var(--status-assigned-text);
}

.badge-resolved {
  background: var(--status-resolved-bg);
  color: var(--status-resolved-text);
}

/* Action Dropdown / Button group */
.table-actions {
  display: flex;
  gap: 0.4rem;
}

/* Modal Overlay & Card */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-card);
  width: 90%;
  max-width: 520px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  padding: 1.75rem;
  transform: scale(0.95);
  transition: var(--transition);
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.editor-selector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.editor-option-btn {
  font-family: inherit;
  padding: 0.85rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.editor-option-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}

.editor-option-btn.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

/* Notification Toast */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-card);
  color: var(--text-main);
  border-left: 4px solid var(--primary);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  animation: slideInRight 0.3s forwards;
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 2.5rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

/* Printable Sheet */
@media print {
  body {
    background: white !important;
    color: black !important;
  }

  .app-header, .nav-tabs, .btn, .table-controls, .no-print {
    display: none !important;
  }

  .main-content {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .print-only {
    display: block !important;
  }
}

.print-only {
  display: none;
}
