/* ============================================
   M18 Check Stock — Premium Dark Theme Design System
   ============================================ */

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

/* ── 1. CSS Custom Properties ── */
:root {
  /* Background */
  --bg-primary: #0a0f1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.8);
  --bg-card-hover: rgba(30, 41, 59, 0.9);
  --bg-surface: #1e293b;
  --bg-input: #0f172a;

  /* Borders */
  --border-color: rgba(148, 163, 184, 0.12);
  --border-focus: #3b82f6;

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Brand */
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6);

  /* Semantic */
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --info: #06b6d4;
  --info-bg: rgba(6, 182, 212, 0.1);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 24px rgba(59, 130, 246, 0.15);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Typography Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;

  /* Spacing */
  --gap-sm: 8px;
  --gap-md: 16px;
  --gap-lg: 24px;
}


/* ── 2. Reset & Base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Noto Sans Thai', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

img {
  max-width: 100%;
  display: block;
}

ul, ol {
  list-style: none;
}


/* ── 3. Container ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--gap-md);
}

.container-sm {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 var(--gap-md);
}

.container-lg {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--gap-md);
}


/* ── 4. Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }

.text-gradient {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }


/* ── 5. Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
  background: var(--bg-card-hover);
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45);
  filter: brightness(1.1);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
  border: none;
}

.btn-success:hover {
  background: #0ea472;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
  border: none;
}

.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(59, 130, 246, 0.05);
}

.btn-sm {
  padding: 6px 14px;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 28px;
  font-size: var(--text-lg);
  border-radius: var(--radius-lg);
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: var(--text-lg);
  background: transparent;
  border: none;
  color: var(--text-secondary);
}

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

.btn-block {
  display: flex;
  width: 100%;
}


/* ── 6. Cards ── */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--gap-lg);
  transition: all 0.3s ease;
}

.card:hover {
  border-color: rgba(59, 130, 246, 0.2);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--gap-md);
  margin-bottom: var(--gap-md);
  border-bottom: 1px solid var(--border-color);
}

.card-body {
  padding: 0;
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 4px;
}

.card-flat {
  border: none;
  box-shadow: none;
  background: var(--bg-secondary);
}

.card-flat:hover {
  box-shadow: none;
}


/* ── 7. Forms ── */
.form-group {
  margin-bottom: var(--gap-md);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
.form-select {
  width: 100%;
  padding: 12px 16px;
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: all 0.2s ease;
}

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

.form-input:focus,
.form-select:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-glow);
}

.form-input.input-error {
  border-color: var(--danger);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.15);
}

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

/* Date Picker Calendar Icon Custom Styling */
input[type="date"] {
  color-scheme: dark;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(53%) sepia(93%) saturate(1637%) hue-rotate(198deg) brightness(101%) contrast(93%); /* Matches primary color #3b82f6 */
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  transform: scale(1.15);
}

.form-input-icon {
  position: relative;
}

.form-input-icon .form-input {
  padding-left: 44px;
}

.form-input-icon .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--text-lg);
  color: var(--text-muted);
  pointer-events: none;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 4px;
}


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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

th {
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: var(--bg-card-hover);
}


/* ── 9. Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9999px;
  white-space: nowrap;
  background: var(--bg-surface);
  color: var(--text-secondary);
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
}

.badge-primary {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary);
}


/* ── 10. Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: var(--gap-md);
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--gap-md) var(--gap-lg);
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: var(--text-lg);
  font-weight: 600;
}

.modal-body {
  padding: var(--gap-lg);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--gap-sm);
  padding: var(--gap-md) var(--gap-lg);
  border-top: 1px solid var(--border-color);
}

.modal-close {
  color: var(--text-muted);
  font-size: var(--text-xl);
}


/* ── 11. Toast / Notification ── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-size: var(--text-sm);
  animation: slideInRight 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  backdrop-filter: blur(20px);
}

.toast-success {
  border-left: 3px solid var(--success);
}

.toast-error {
  border-left: 3px solid var(--danger);
}

.toast-warning {
  border-left: 3px solid var(--warning);
}

.toast-info {
  border-left: 3px solid var(--info);
}

.toast-icon {
  font-size: var(--text-lg);
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
}

.toast-exit {
  animation: slideOutRight 0.3s ease forwards;
}


/* ── 12. Loading States ── */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.skeleton {
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-card-hover) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
  height: 20px;
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 80%;
}

.skeleton-title {
  height: 24px;
  margin-bottom: 12px;
  width: 60%;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}


/* ── 13. Progress Bar ── */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-surface);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 9999px;
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  animation: shimmer 2s ease-in-out infinite;
  background-size: 200% 100%;
}

.progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}


/* ── 14. Layout Utilities ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-start { display: flex; align-items: center; justify-content: flex-start; }
.flex-end { display: flex; align-items: center; justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }

.gap-xs { gap: 4px; }
.gap-sm { gap: var(--gap-sm); }
.gap-md { gap: var(--gap-md); }
.gap-lg { gap: var(--gap-lg); }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-sm { margin-top: var(--gap-sm); }
.mt-md { margin-top: var(--gap-md); }
.mt-lg { margin-top: var(--gap-lg); }
.mb-sm { margin-bottom: var(--gap-sm); }
.mb-md { margin-bottom: var(--gap-md); }
.mb-lg { margin-bottom: var(--gap-lg); }
.mx-auto { margin-left: auto; margin-right: auto; }
.p-sm { padding: var(--gap-sm); }
.p-md { padding: var(--gap-md); }
.p-lg { padding: var(--gap-lg); }

.hidden { display: none !important; }
.visible { display: block; }
.overflow-hidden { overflow: hidden; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }


/* ── 15. Status Indicators ── */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.status-filled {
  background: var(--success);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

.status-pending {
  background: var(--warning);
  animation: pulse 2s ease-in-out infinite;
}

.status-danger {
  background: var(--danger);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}


/* ── 16. Sidebar Layout (Admin) ── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar .logo {
  padding: 24px 20px;
  font-size: var(--text-2xl);
  font-weight: 700;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  border-bottom: 1px solid var(--border-color);
}

.sidebar .logo-subtitle {
  font-size: var(--text-xs);
  color: var(--text-muted);
  -webkit-text-fill-color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.sidebar .nav-section {
  padding: 8px 20px 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  margin: 2px 0;
}

.sidebar .nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.sidebar .nav-item.active {
  background: rgba(59, 130, 246, 0.08);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 500;
}

.sidebar .nav-item .nav-icon {
  font-size: var(--text-lg);
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
}

.main-content {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
  padding: var(--gap-lg);
}

.page-section {
  display: none;
}

.page-section.active {
  display: block;
}

.sidebar-overlay {
  display: none;
}


/* ── 17. Animations ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

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

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

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes floatUp {
  0% { transform: translateY(0) scale(1); opacity: 0.3; }
  50% { opacity: 0.15; }
  100% { transform: translateY(-100vh) scale(0.5); opacity: 0; }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.animate-fadeIn { animation: fadeIn 0.3s ease; }
.animate-slideUp { animation: slideUp 0.4s ease; }


/* ── 18. Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px var(--gap-lg);
  text-align: center;
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: var(--gap-md);
  opacity: 0.6;
}

.empty-state p {
  color: var(--text-muted);
  font-size: var(--text-lg);
}

.empty-state .empty-hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 8px;
}


/* ── 19. Login Page ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gap-lg);
  position: relative;
  overflow: hidden;
}

/* Animated background */
.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(135deg, #0a0f1a 0%, #111827 40%, #0f172a 60%, #0a0f1a 100%);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
}

.login-bg::before,
.login-bg::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
}

.login-bg::before {
  width: 500px;
  height: 500px;
  background: #3b82f6;
  top: -150px;
  right: -100px;
  animation: floatUp 20s ease-in-out infinite reverse;
}

.login-bg::after {
  width: 400px;
  height: 400px;
  background: #8b5cf6;
  bottom: -100px;
  left: -100px;
  animation: floatUp 25s ease-in-out infinite reverse;
}

/* Floating particles */
.particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(59, 130, 246, 0.3);
  border-radius: 50%;
  bottom: -10px;
  animation: floatUp var(--duration, 15s) linear infinite;
}

.particle:nth-child(1) { left: 10%; --duration: 18s; animation-delay: 0s; width: 3px; height: 3px; }
.particle:nth-child(2) { left: 25%; --duration: 22s; animation-delay: 2s; width: 5px; height: 5px; }
.particle:nth-child(3) { left: 40%; --duration: 16s; animation-delay: 4s; width: 2px; height: 2px; }
.particle:nth-child(4) { left: 55%; --duration: 20s; animation-delay: 1s; width: 4px; height: 4px; }
.particle:nth-child(5) { left: 70%; --duration: 24s; animation-delay: 3s; width: 3px; height: 3px; }
.particle:nth-child(6) { left: 85%; --duration: 19s; animation-delay: 5s; width: 6px; height: 6px; opacity: 0.2; }
.particle:nth-child(7) { left: 15%; --duration: 21s; animation-delay: 6s; width: 3px; height: 3px; }
.particle:nth-child(8) { left: 60%; --duration: 17s; animation-delay: 7s; width: 4px; height: 4px; }

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  animation: slideUp 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.login-card {
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(59, 130, 246, 0.06);
  padding: 48px 36px;
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo-text {
  font-size: var(--text-4xl);
  font-weight: 700;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.login-logo-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 8px;
  font-weight: 400;
}

.login-form .form-group {
  margin-bottom: 20px;
}

.login-form .form-input {
  padding: 14px 16px;
  font-size: var(--text-base);
  border-radius: var(--radius-md);
}

.login-form .form-input-icon .form-input {
  padding-left: 48px;
}

.login-form .form-input-icon .icon {
  left: 16px;
  font-size: 1.2rem;
}

.login-error {
  display: none;
  padding: 12px 16px;
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: var(--text-sm);
  margin-bottom: 16px;
  text-align: center;
  animation: slideUp 0.3s ease;
}

.login-error.visible {
  display: block;
}

.login-btn {
  width: 100%;
  padding: 14px;
  font-size: var(--text-base);
  border-radius: var(--radius-md);
  margin-top: 8px;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: var(--text-xs);
  color: var(--text-muted);
}


/* ── 20. Employee Page ── */

/* Fixed header */
.emp-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(17, 24, 39, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 12px var(--gap-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.emp-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.emp-header-center {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.emp-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.branch-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--primary-gradient);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 700;
}

.emp-user-name {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emp-logout {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 12px;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.emp-logout:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* Content below fixed header */
.emp-content {
  padding-top: 76px;
  padding-bottom: 100px;
  max-width: 600px;
  margin: 0 auto;
  padding-left: var(--gap-md);
  padding-right: var(--gap-md);
}

/* Date info section */
.emp-date-info {
  padding: var(--gap-md) 0;
  margin-bottom: var(--gap-sm);
}

.emp-date-text {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.emp-date-day {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 2px;
}

/* Progress section */
.emp-progress {
  padding: var(--gap-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: var(--gap-lg);
  backdrop-filter: blur(20px);
}

.emp-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.emp-progress-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.emp-progress-value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--primary);
}

/* Stock list */
.stock-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stock-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--border-color);
  transition: all 0.2s ease;
  backdrop-filter: blur(12px);
  animation: slideUp 0.3s ease backwards;
}

.stock-item:nth-child(1) { animation-delay: 0.02s; }
.stock-item:nth-child(2) { animation-delay: 0.04s; }
.stock-item:nth-child(3) { animation-delay: 0.06s; }
.stock-item:nth-child(4) { animation-delay: 0.08s; }
.stock-item:nth-child(5) { animation-delay: 0.10s; }
.stock-item:nth-child(6) { animation-delay: 0.12s; }
.stock-item:nth-child(7) { animation-delay: 0.14s; }
.stock-item:nth-child(8) { animation-delay: 0.16s; }
.stock-item:nth-child(9) { animation-delay: 0.18s; }
.stock-item:nth-child(10) { animation-delay: 0.20s; }

.stock-item.filled {
  border-left-color: var(--success);
  background: rgba(16, 185, 129, 0.04);
}

.stock-item.pending {
  border-left-color: var(--border-color);
}

.stock-item-info {
  flex: 1;
  min-width: 0;
}

.stock-item-name {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.stock-item-unit {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.stock-item-input {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.stock-input {
  width: 90px;
  padding: 10px 12px;
  text-align: center;
  font-size: var(--text-base);
  font-weight: 600;
  font-family: inherit;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  outline: none;
  transition: all 0.2s ease;
}

.stock-input:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-glow);
}

.stock-input.input-error {
  border-color: var(--danger);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.15);
}

.stock-item-value {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--success);
  min-width: 50px;
  text-align: center;
}

.stock-item-status {
  font-size: var(--text-lg);
}

/* Submit section — sticky bottom */
.emp-submit {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  padding: 16px;
}

.emp-submit-inner {
  max-width: 600px;
  margin: 0 auto;
}

.emp-submit .btn {
  width: 100%;
  padding: 14px;
  font-size: var(--text-base);
}

/* All done message */
.all-done-card {
  text-align: center;
  padding: 32px var(--gap-lg);
  background: var(--success-bg);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-lg);
  margin-top: var(--gap-md);
  animation: slideUp 0.4s ease;
}

.all-done-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.all-done-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--success);
  margin-bottom: 4px;
}

.all-done-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
}


/* ── 21. Scrollbar Styling ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}


/* ── 22. Schedule Matrix (Admin) ── */
.schedule-matrix {
  width: 100%;
  border-collapse: collapse;
}

.schedule-matrix th,
.schedule-matrix td {
  padding: 10px 8px;
  text-align: center;
}

.schedule-matrix th {
  font-size: var(--text-xs);
}

.schedule-matrix td:first-child {
  text-align: left;
  font-size: var(--text-sm);
}

.custom-checkbox {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 24px;
  cursor: pointer;
}

.custom-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 1;
  margin: 0;
}

.custom-checkbox .checkmark {
  position: absolute;
  inset: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.custom-checkbox input:checked + .checkmark {
  background: var(--primary-gradient);
  border-color: transparent;
}

.custom-checkbox input:checked + .checkmark::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 4px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.custom-checkbox:hover .checkmark {
  border-color: var(--primary);
}


/* ── 23. Alert Cards ── */
.alert-card {
  padding: var(--gap-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--text-muted);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
}

.alert-card-danger {
  border-left-color: var(--danger);
  background: var(--danger-bg);
}

.alert-card-warning {
  border-left-color: var(--warning);
  background: var(--warning-bg);
}

.alert-card-success {
  border-left-color: var(--success);
  background: var(--success-bg);
}

.alert-card-info {
  border-left-color: var(--info);
  background: var(--info-bg);
}

.alert-card-title {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: 4px;
}

.alert-card-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}


/* ── 24. Page Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--gap-md);
  margin-bottom: var(--gap-lg);
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: 700;
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 4px;
}


/* ── 25. Grid ── */
.grid {
  display: grid;
  gap: var(--gap-md);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Stat card */
.stat-card {
  padding: var(--gap-md);
}

.stat-value {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 6px;
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  margin-top: 8px;
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }


/* ── 26. Divider ── */
.divider {
  height: 1px;
  background: var(--border-color);
  border: none;
  margin: var(--gap-md) 0;
}


/* ── 27. Avatar ── */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: #fff;
  font-weight: 600;
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: var(--text-xs);
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: var(--text-xl);
}


/* ── 28. Tabs ── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  gap: 4px;
  overflow-x: auto;
}

.tab {
  padding: 10px 20px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}


/* ── 29. Mobile Responsive ── */
@media (max-width: 768px) {
  /* Sidebar */
  .sidebar {
    transform: translateX(-100%);
    z-index: 2000;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .main-content {
    margin-left: 0;
    padding: var(--gap-md);
  }

  /* Grid */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  /* Tables */
  table {
    font-size: var(--text-xs);
  }

  th, td {
    padding: 8px 10px;
  }

  /* Cards */
  .card {
    padding: var(--gap-md);
  }

  /* Login */
  .login-card {
    padding: 36px 24px;
  }

  /* Page Header */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Toast */
  .toast-container {
    left: var(--gap-md);
    right: var(--gap-md);
    max-width: none;
  }

  /* Modal */
  .modal {
    margin: var(--gap-md);
    max-height: calc(100vh - 32px);
  }
}

@media (max-width: 480px) {
  :root {
    --text-4xl: 2rem;
    --text-3xl: 1.5rem;
  }

  .login-logo-text {
    font-size: 2rem;
  }

  .emp-header-center {
    font-size: var(--text-base);
  }

  .stock-input {
    width: 75px;
    padding: 8px;
  }

  .stock-item {
    padding: 12px;
  }

  .stock-item-name {
    font-size: var(--text-sm);
  }
}


/* ── 30. Print Styles ── */
@media print {
  .sidebar,
  .emp-header,
  .emp-submit,
  .toast-container,
  .modal-overlay,
  .btn {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .main-content {
    margin-left: 0;
  }
}
