/* Global Dark Mode Styles */
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #1a1a1a;
  color: #e0e0e0;
  min-height: 100vh;
}

/* Header and Navigation */
.header {
  background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
  color: #f7fafc;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.header h1 {
  font-size: 1.5rem; /* smaller heading across pages */
  color: #f7fafc;
}

.logout-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #f7fafc;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.3s;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.top-menu {
  background: #2d3748;
  padding: 0.75rem 2rem;
  margin: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid #4a5568;
}

.top-menu a {
  color: #e2e8f0;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  background: #4a5568;
  transition: background 0.3s;
}

.top-menu a:hover {
  background: #718096;
}

.top-menu a.active {
  background: #667eea;
  color: #fff;
}

.container {
  max-width: 2100px;
  margin: 2rem auto;
  padding: 0 2rem;
}

.panel {
  background: #2d3748;
  color: #e2e8f0;
  padding: 1rem 1.5rem;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  border: 1px solid #4a5568;
}

/* Filters and Inputs */
.filters,
.filters-container,
.filter-group {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.filters label,
.filter-group label {
  color: #e2e8f0;
  font-weight: bold;
}

.filters select,
.filter-group select,
.filter-group input,
.filters input {
  padding: 6px 8px;
  border: 1px solid #4a5568;
  border-radius: 6px;
  background: #1a202c;
  color: #e2e8f0;
}

.filters select:focus,
.filters input:focus,
.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: #667eea;
}

.filters input::placeholder,
.filter-group input::placeholder {
  color: #a0aec0;
}

.table-container {
  margin-top: 1rem;
}

#myGrid {
  width: 100% !important;
  font-family: "Open Sans", sans-serif;
}

table {
  width: 100% !important;
}

/* AG Grid dark theme overrides */
.ag-theme-quartz {
  --ag-font-family: "Open Sans", sans-serif;
  --ag-header-font-size: 14px;
  --ag-font-size: 13px;
  --ag-background-color: #1a202c;
  --ag-header-background-color: #2d3748;
  --ag-odd-row-background-color: #1a202c;
  --ag-row-hover-color: #2d3748;
  --ag-border-color: #4a5568;
  --ag-header-foreground-color: #e2e8f0;
  --ag-foreground-color: #e2e8f0;
  --ag-selected-row-background-color: #4a5568;
}

/* Dashboard page specific */
.navigation {
  background: #2d3748;
  color: #e2e8f0;
  padding: 0.5rem;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  margin-bottom: 0.3rem;
  text-align: center;
  border: 1px solid #4a5568;
}

.nav-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.nav-btn,
.load-btn,
.filter-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.3s;
}

.nav-btn:hover,
.load-btn:hover {
  background: #5a6fd8;
}

.load-btn:disabled {
  background: #4a5568;
  cursor: not-allowed;
}

.file-selector {
  padding: 0.5rem 1rem;
  border: 2px solid #4a5568;
  border-radius: 5px;
  font-size: 1rem;
  min-width: 300px;
  background: #1a202c;
  color: #e2e8f0;
}

.data-display {
  background: #2d3748;
  color: #e2e8f0;
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  border: 1px solid #4a5568;
}

.data-info {
  margin-bottom: 1rem;
  padding: 1rem;
  background: #1a202c;
  border-radius: 5px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 15px;
  color: #e2e8f0;
  border: 1px solid #4a5568;
}

.data-content {
  border: 1px solid #4a5568;
  border-radius: 5px;
  padding: 1rem;
  background: #1a202c;
  color: #e2e8f0;
}

.actions {
  margin-top: 2rem;
  text-align: center;
}

.run-script-btn {
  background: #28a745;
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 5px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.3s;
}

.run-script-btn:hover {
  background: #218838;
}

.script-status {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 5px;
  display: none;
}

.status-running {
  background: #2d3748;
  color: #fbb040;
  border: 1px solid #4a5568;
}

.status-success {
  background: #2d3748;
  color: #68d391;
  border: 1px solid #4a5568;
}

.status-error {
  background: #2d3748;
  color: #fc8181;
  border: 1px solid #4a5568;
}

/* Progress and loading (All Data) */
.progress-section {
  background: #2d3748;
  color: #e2e8f0;
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  margin-bottom: 2rem;
  border: 1px solid #4a5568;
}

.progress-section h2 {
  color: #f7fafc;
}

.progress-bar-container {
  width: 100%;
  background-color: #4a5568;
  border-radius: 10px;
  overflow: hidden;
  margin: 1rem 0;
}

.progress-bar {
  height: 20px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 10px;
}

.progress-text {
  text-align: center;
  margin: 0.5rem 0;
  font-weight: bold;
  color: #e2e8f0;
}

.file-status {
  margin-top: 1rem;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #4a5568;
  border-radius: 5px;
  padding: 1rem;
  background: #1a202c;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  border-bottom: 1px solid #4a5568;
  color: #e2e8f0;
}

.file-item:last-child {
  border-bottom: none;
}

.file-name {
  flex: 1;
  font-size: 0.9rem;
  color: #e2e8f0;
}

.file-status-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: bold;
}

.status-pending {
  background: #d69e2e;
  color: #1a202c;
}
.status-loading {
  background: #3182ce;
  color: white;
}
.status-completed {
  background: #38a169;
  color: white;
}
.status-error {
  background: #e53e3e;
  color: white;
}

.load-controls {
  text-align: center;
  margin-bottom: 1rem;
}
.load-btn {
  padding: 1rem 2rem;
  font-size: 1.1rem;
  margin: 0 0.5rem;
}

/* Loading spinner (shared) */
.loading-spinner {
  display: none;
  text-align: center;
  padding: 2rem;
}

.spinner {
  border: 4px solid #4a5568;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-text {
  color: #a0aec0;
  font-size: 1rem;
}

/* Email list specific */
.stats {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px;
  background: #1a202c;
  border-radius: 8px;
  border: 1px solid #4a5568;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-number {
  font-size: 2rem;
  font-weight: bold;
  color: #667eea;
}
.stat-label {
  font-size: 0.9rem;
  color: #a0aec0;
  margin-top: 5px;
}

.export-btn {
  background: #28a745;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.3s;
  margin-left: auto;
}

.export-btn:hover {
  background: #218838;
}
.export-btn:active {
  transform: translateY(1px);
}

.email-cell {
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
}

/* Merchant/customer filters */
.filters select:focus {
  outline: none;
  border-color: #667eea;
}

/* Login page specific */
body.login-page {
  background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e2e8f0;
}

.login-container {
  background: #2d3748;
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  width: 100%;
  max-width: 400px;
  border: 1px solid #4a5568;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}
.login-header h1 {
  color: #f7fafc;
  margin-bottom: 0.5rem;
}
.login-header p {
  color: #a0aec0;
  font-size: 0.9rem;
}

.form-group {
  margin-bottom: 1.5rem;
}
.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #e2e8f0;
  font-weight: 500;
}
.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #4a5568;
  border-radius: 5px;
  font-size: 1rem;
  transition: border-color 0.3s;
  background: #1a202c;
  color: #e2e8f0;
}
.form-group input:focus {
  outline: none;
  border-color: #667eea;
}
.form-group input::placeholder {
  color: #718096;
}

.login-btn {
  width: 100%;
  padding: 0.75rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.error {
  color: #fc8181;
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9rem;
  background: #2d3748;
  padding: 0.75rem;
  border-radius: 5px;
  border: 1px solid #e53e3e;
}
