/* Overpay Recon v2 — High-Contrast Light Theme with Left Sidebar Navigation (Optimized for 40+) */

:root {
  /* Light Theme Color Palette (WCAG AAA Contrast >= 7:1) */
  --bg-dark: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --bg-header: #ffffff;
  --border-color: #cbd5e1;
  --border-glow: #0284c7;

  --accent-primary: #0284c7;
  --accent-gradient: linear-gradient(135deg, #0284c7 0%, #1d4ed8 100%);
  --accent-gradient-hover: linear-gradient(135deg, #0369a1 0%, #1e40af 100%);

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --success: #15803d;
  --success-bg: #dcfce7;
  --success-border: #86efac;

  --warning: #b45309;
  --warning-bg: #fef3c7;
  --warning-border: #fde047;

  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --danger-border: #fca5a5;

  --info: #0369a1;
  --info-bg: #e0f2fe;

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-main: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 15px rgba(2, 132, 199, 0.2);
}

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

body {
  font-family: 'Sarabun', 'Prompt', 'Noto Sans Thai', 'TH Sarabun New', 'Leelawadee UI', 'Tahoma', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
}

/* App Layout & Sidebar Structure */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  width: 270px;
  min-width: 270px;
  background: #ffffff;
  border-right: 2px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.03);
}

.sidebar-header {
  padding: 1.25rem 1.25rem 1rem 1.25rem;
  border-bottom: 2px solid #f1f5f9;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-badge {
  background: var(--accent-primary);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.4rem;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.3);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
}

.brand-version {
  font-size: 0.78rem;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  width: fit-content;
  margin-top: 2px;
  border: 1px solid #bae6fd;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.85rem;
  overflow-y: auto;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.nav-item {
  width: 100%;
}

.nav-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  min-height: 48px;
  border: 1.5px solid transparent;
  transition: all 0.15s ease;
}

.nav-link:hover {
  color: var(--accent-primary);
  background: #f1f5f9;
}

.nav-link.active {
  color: #0369a1;
  background: #e0f2fe;
  font-weight: 700;
  border-color: #bae6fd;
}

.nav-icon {
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
}

.sidebar-divider {
  height: 2px;
  background: #f1f5f9;
  margin: 1.25rem 0.5rem;
}

.nav-footer-list {
  margin-top: auto;
}

.logout-form {
  width: 100%;
}

.btn-logout {
  background: none;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.btn-logout:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

/* Main Content & Wrapper */
.main-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  max-width: 1360px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 2rem;
}

/* Page Banner */
.page-banner {
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.banner-title {
  font-size: 2rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 0.35rem;
}

.banner-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

/* Cards & Panels */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-main);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  margin-bottom: 1.5rem;
}

.glass-card:hover {
  border-color: #94a3b8;
  box-shadow: var(--shadow-hover);
}

.card-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Grid Layouts */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* Stat Widgets */
.stat-widget {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: #e0f2fe;
  color: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  border: 1px solid #bae6fd;
}

.stat-val {
  font-size: 1.85rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
}

.stat-lbl {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Inline Form Alignment Helpers */
.inline-form {
  display: flex;
  gap: 1.25rem;
  align-items: flex-end;
  flex-wrap: wrap;
  width: 100%;
}

.inline-form .form-group {
  margin-bottom: 0;
}

.flex-1 {
  flex: 1;
  min-width: 220px;
}

.form-action {
  display: flex;
  align-items: flex-end;
}

/* Forms & Input Controls (Large & Clear for 40+) */
.form-group {
  margin-bottom: 1.35rem;
}

.form-label, label {
  display: block;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #0f172a;
}

.form-input, .form-select, input[type="text"], input[type="password"], input[type="email"], input[type="date"], input[type="number"], select {
  width: 100%;
  min-height: 46px;
  height: 46px;
  padding: 0.75rem 1rem;
  background: #ffffff;
  border: 1.5px solid #94a3b8;
  border-radius: var(--radius-sm);
  color: #0f172a;
  font-size: 16px;
  font-family: inherit;
  color-scheme: light;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus, .form-select:focus, input:focus, select:focus {
  outline: none;
  border-color: #0284c7;
  box-shadow: 0 0 0 3.5px rgba(2, 132, 199, 0.25);
}

/* Dropzone File Upload */
.dropzone {
  border: 2px dashed #0284c7;
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: #f0f9ff;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dropzone:hover, .dropzone.dragover {
  border-color: #0369a1;
  background: #e0f2fe;
}

.dropzone-icon {
  font-size: 2.75rem;
  color: #0284c7;
  margin-bottom: 0.75rem;
}

.dropzone-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.35rem;
}

.dropzone-hint {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Buttons (Touch Friendly min-height 44px) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 46px;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: #0284c7;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.3);
}

.btn-primary:hover {
  background: #0369a1;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(2, 132, 199, 0.4);
}

.btn-secondary {
  background: #f1f5f9;
  color: #0f172a;
  border: 1.5px solid #94a3b8;
}

.btn-secondary:hover {
  background: #e2e8f0;
  border-color: #64748b;
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
}

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

.btn-success {
  background: #16a34a;
  color: #ffffff;
}

.btn-success:hover {
  background: #15803d;
}

.btn-full {
  width: 100%;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.85rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
}

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

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

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

/* Alerts */
.alert {
  padding: 1.1rem 1.35rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  font-size: 1rem;
}

.alert-success {
  background: var(--success-bg);
  border: 1.5px solid var(--success-border);
  color: #14532d;
}

.alert-warning {
  background: var(--warning-bg);
  border: 1.5px solid var(--warning-border);
  color: #78350f;
}

.alert-danger {
  background: var(--danger-bg);
  border: 1.5px solid var(--danger-border);
  color: #7f1d1d;
}

/* Tables (Crisp Borders & High Contrast for 40+) */
.data-table, table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.data-table th, table th {
  background: #f1f5f9;
  color: #0f172a;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 2px solid #cbd5e1;
  border-right: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table td, table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #f1f5f9;
  color: #1e293b;
}

.data-table tr:nth-child(even), table tr:nth-child(even) {
  background: #f8fafc;
}

.data-table tr:nth-child(odd), table tr:nth-child(odd) {
  background: #ffffff;
}

.data-table tr:hover, table tr:hover {
  background: #e0f2fe;
}

/* Number Formatting for Accounting */
.text-right, td.number, th.number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Checkbox group */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 0.5rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  color: #0f172a;
}

.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

/* Footer */
.footer {
  margin-top: auto;
  border-top: 2px solid #e2e8f0;
  background: #ffffff;
  padding: 1.5rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
}

/* Responsive Sidebar for smaller screens */
@media (max-width: 900px) {
  .app-layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 2px solid #e2e8f0;
  }
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0.75rem;
  }
  .nav-list {
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
  }
  .nav-item {
    width: auto;
  }
  .sidebar-divider {
    display: none;
  }
  .nav-footer-list {
    margin-top: 0;
  }
}
