/* ==================== Global Styles ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #2563eb;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --info-color: #0ea5e9;
  --warning-color: #f59e0b;
  --dark-bg: #1f2937;
  --light-bg: #f3f4f6;
  --border-color: #e5e7eb;
  --text-dark: #111827;
  --text-light: #6b7280;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--light-bg);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
}

html {
  height: 100%;
}

/* ==================== Page Management ==================== */
.page {
  display: none;
}

.page.active {
  display: block;
}

/* ==================== Login Page ==================== */
#login-page {
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
  display: flex;
  justify-content: center;
}

.login-box {
  background: white;
  border-radius: 10px;
  padding: 40px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.login-box h1 {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 10px;
  font-size: 32px;
}

.login-box .subtitle {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 30px;
  font-size: 14px;
}

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

.test-info {
  text-align: center;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
}

.test-info a {
  color: var(--primary-color);
  text-decoration: none;
}

.test-info a:hover {
  text-decoration: underline;
}

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

.form-group label {
  font-weight: 600;
  color: var(--text-dark);
  font-size: 14px;
}

.form-group input {
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.error-message {
  padding: 12px;
  background-color: #fee2e2;
  color: #991b1b;
  border-radius: 6px;
  font-size: 14px;
}

/* ==================== Buttons ==================== */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
  transform: translateY(0);
}

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

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

.btn-primary:hover {
  background-color: #1d4ed8;
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: white;
}

.btn-secondary:hover {
  background-color: #475569;
}

.btn-success {
  background-color: var(--success-color);
  color: white;
}

.btn-success:hover {
  background-color: #059669;
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
}

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

.btn-info {
  background-color: var(--info-color);
  color: white;
}

.btn-info:hover {
  background-color: #0284c7;
}

.btn-full {
  width: 100%;
}

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

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

/* ==================== Dashboard Page ==================== */
#dashboard-page {
  min-height: 100vh;
  background-color: var(--light-bg);
  display: flex;
  flex-direction: column;
}

.dashboard-layout {
  display: flex;
  flex: 1;
}

.sidebar {
  width: 240px;
  background-color: var(--dark-bg);
  color: white;
  padding: 20px 0;
}

.sidebar nav ul {
  list-style: none;
}

.nav-link {
  display: block;
  padding: 12px 20px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s;
}

.nav-link:hover {
  background-color: #374151;
  color: white;
}

.nav-link.active {
  background-color: var(--primary-color);
  color: white;
}

.dashboard-content {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
}

.dash-section {
  display: none;
}

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

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.section-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.section-header h2 {
  font-size: 24px;
  color: var(--text-dark);
}

.section-subtitle {
  color: var(--text-light);
  font-size: 14px;
  margin-top: 5px;
}

.form-header {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

.form-header h3 {
  font-size: 18px;
  margin-bottom: 5px;
}

.form-header p {
  font-size: 13px;
  color: var(--text-light);
}

.settings-card {
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-width: 600px;
}

.help-text {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 5px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 20px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

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

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

.navbar {
  background-color: white;
  padding: 15px 25px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
}

.navbar-brand h1 {
  color: var(--primary-color);
  font-size: 24px;
}

.navbar-menu {
  display: flex;
  gap: 10px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px;
}

/* ==================== Status Grid ==================== */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.status-card {
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.status-label {
  color: var(--text-light);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  font-weight: 600;
}

.status-value {
  color: var(--text-dark);
  font-size: 24px;
  font-weight: 700;
}

/* ==================== Action Buttons ==================== */
.action-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

/* ==================== Table ==================== */
.table-container {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.table-container h2 {
  margin-bottom: 0;
  color: var(--text-dark);
  font-size: 18px;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

.table-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.form-input-sm,
.form-select-sm {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.3s;
}

.form-input-sm:focus,
.form-select-sm:focus {
  border-color: var(--primary-color);
}

.form-input-sm {
  min-width: 200px;
}

.product-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.product-link:hover {
  text-decoration: underline;
}

.job-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.job-table thead {
  background-color: var(--light-bg);
  border-bottom: 2px solid var(--border-color);
}

.job-table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-dark);
}

.job-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
}

.job-table tbody tr:hover {
  background-color: rgba(37, 99, 235, 0.05);
}

.job-table .no-data {
  text-align: center;
  color: var(--text-light);
  padding: 30px;
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.success {
  background-color: #d1fae5;
  color: #065f46;
}

.status-badge.seller_changed {
  background-color: #fecaca;
  color: #7c2d12;
}

.status-badge.failed {
  background-color: #fee2e2;
  color: #991b1b;
}

/* ==================== Modal ==================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 10px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

.modal-header h2 {
  color: var(--text-dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--text-light);
}

.modal-body {
  padding: 20px;
  color: var(--text-dark);
}

.modal-footer {
  padding: 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.info-message {
  padding: 15px;
  background-color: #dbeafe;
  color: #1e40af;
  border-radius: 6px;
  font-size: 14px;
  border-left: 4px solid #3b82f6;
}

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  .navbar-menu {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
  }

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

  .action-buttons {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .job-table {
    font-size: 12px;
  }

  .job-table th,
  .job-table td {
    padding: 8px;
  }
}

@media (max-width: 480px) {
  .login-box {
    padding: 30px 20px;
  }

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

  .navbar-brand h1 {
    font-size: 20px;
  }
}