/* ═══════════════════════════════════════════════
   Sao Viet Pipeline — Dark Theme Premium Design
   ═══════════════════════════════════════════════ */

:root {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-card: #1e2130;
  --bg-hover: #262a3a;
  --bg-input: #161822;
  --border: #2a2e3f;
  --border-focus: #6366f1;
  --text-primary: #e4e6ef;
  --text-secondary: #9ca0b0;
  --text-muted: #6b7084;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.2);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-width: 240px;
  --header-height: 60px;
  --transition: 0.2s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

/* ═══════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════ */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-primary);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

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

.login-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 13px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

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

.form-group input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
}

/* ═══ Buttons ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  outline: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius);
  font-size: 18px;
  transition: all var(--transition);
}

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

/* Spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

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

/* ═══════════════════════════════════
   DASHBOARD LAYOUT
   ═══════════════════════════════════ */

.dashboard-page {
  display: flex;
  min-height: 100vh;
}

/* ═══ Sidebar ═══ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
}

.brand-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 400;
  transition: all var(--transition);
  cursor: pointer;
}

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

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 500;
}

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 14px;
}

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

.version-tag {
  font-size: 11px;
  color: var(--text-muted);
}

/* ═══ Main Content ═══ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ═══ Header ═══ */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

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

.sidebar-toggle {
  display: none;
}

.page-title {
  font-size: 18px;
  font-weight: 600;
}

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

/* ═══ User Menu ═══ */
.user-menu {
  position: relative;
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition);
}

.user-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.user-avatar {
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.user-name {
  font-size: 13px;
  font-weight: 500;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 200;
}

.dropdown-item {
  display: block;
  padding: 10px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  transition: all var(--transition);
}

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

/* ═══ Page Content ═══ */
.page-content {
  flex: 1;
  padding: 24px;
}

.content-section {
  animation: fadeIn 0.2s ease;
}

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

/* ═══ Stats Grid ═══ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.stat-card-accent { border-left: 3px solid var(--accent); }
.stat-card-success { border-left: 3px solid var(--success); }
.stat-card-warning { border-left: 3px solid var(--warning); }
.stat-card-info { border-left: 3px solid #3b82f6; }
.stat-card-danger { border-left: 3px solid var(--danger); }

/* ═══ Empty State ═══ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 15px;
}

/* ═══════════════════════════════════
   UPLOAD PAGE
   ═══════════════════════════════════ */

.upload-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  background: var(--bg-card);
}

.upload-dropzone:hover,
.upload-dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.05);
}

.dropzone-content {
  position: relative;
}

.dropzone-icon {
  font-size: 36px;
  color: var(--accent);
  margin-bottom: 12px;
}

.dropzone-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.dropzone-sub {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 8px;
}

.dropzone-hint {
  color: var(--text-muted);
  font-size: 12px;
}

.dropzone-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-selected {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-hover);
  padding: 10px 16px;
  border-radius: var(--radius);
}

.file-icon {
  font-size: 20px;
}

.file-name {
  font-weight: 500;
  color: var(--text-primary);
}

.btn-remove {
  font-size: 20px;
  color: var(--text-muted);
  padding: 2px 6px;
}

.btn-remove:hover {
  color: var(--danger);
}

.form-input {
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  width: 100%;
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Upload Result */
.upload-result {
  animation: fadeIn 0.3s ease;
}

.result-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.result-batch {
  color: var(--text-secondary);
  font-size: 13px;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-sm:hover {
  border-color: var(--accent);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.badge-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.badge-info {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
}

/* Error list */
.error-list {
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius);
  padding: 12px 16px;
}

.error-row {
  font-size: 13px;
  color: #fca5a5;
  padding: 4px 0;
}

.error-row-num {
  font-weight: 600;
  margin-right: 6px;
}

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

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

.data-table th {
  background: var(--bg-secondary);
  padding: 10px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}

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

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ═══ Responsive ═══ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

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

  .sidebar-toggle {
    display: block;
  }

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

/* ═══ Batch Page ═══ */
.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.btn-warning {
  background: var(--warning);
  color: #000;
}
.btn-warning:hover {
  background: #d97706;
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover {
  background: #16a34a;
}

.link-primary {
  color: var(--accent);
  text-decoration: none;
}
.link-primary:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.btn-sm {
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 6px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}
.btn-sm:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}
.btn-sm.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-sm.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-sm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ═══ Cards ═══ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
