@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f5f5;
  color: #333;
  padding: 0;
}

.container {
  max-width: 100%;
  margin: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

header {
  text-align: center;
  margin-bottom: 0;
  flex-shrink: 0;
}

/* Filter Row */
.filter-row {
  background: #f8f8f8;
  border-bottom: 1px solid #ddd;
  padding: 5px 10px;
  flex-shrink: 0;
}

.filter-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 8px 0;
  font-weight: 600;
  font-size: 0.85rem;
  color: #333;
}

.filter-title svg {
  color: #555;
}

.filter-collapse {
  cursor: pointer;
  font-size: 0.7rem;
  color: #666;
  transition: transform 0.2s;
  user-select: none;
}

.filter-collapse:hover { color: #333; }
.filter-collapse.collapsed { transform: rotate(-90deg); }

.filter-content {
  margin-left: 25px;
  overflow: visible;
  transition: max-height 0.3s ease;
}

.filter-content.collapsed {
  max-height: 0 !important;
  padding: 0;
  overflow: hidden;
}

.filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
}

.filter-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.filter-header {
  font-size: 0.7rem;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
}

.filter-row input[type="date"],
.filter-row input[type="number"],
.filter-row input[type="text"],
.filter-row select {
  width: 100%;
  padding: 4px 6px;
  font-size: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 3px;
  box-sizing: border-box;
  height: 24px;
}

.filter-row input[type="number"] {
  -moz-appearance: textfield;
}

.filter-row input[type="number"]::-webkit-outer-spin-button,
.filter-row input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.filter-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.filter-stack input { width: 70px; }
.filter-stack.w80 input { width: 104px; }
.filter-col.w314 input { width: 314px; }
.filter-col.w218 input, .filter-col.w218 .multi-select-btn { width: 218px; }
.filter-col.w218 .multi-select-dropdown { min-width: 218px; }
.filter-col.w104 input, .filter-col.w104 .multi-select-btn, .filter-col.w104 select { width: 104px; }
.filter-col.w104 .multi-select-dropdown { min-width: 104px; }
.filter-col.wdate { width: 152px; }
.filter-col.wdate .filter-row-item input { width: 120px; }
.filter-row-top { margin-bottom: 8px; }

.filter-row-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.filter-label {
  font-size: 0.7rem;
  color: #666;
  min-width: 28px;
}

/* Multi-select dropdown */
.multi-select { position: relative; }

.multi-select-btn {
  width: 100%;
  padding: 4px 6px;
  font-size: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 24px;
  box-sizing: border-box;
}

.multi-select-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 3px;
  max-height: 150px;
  overflow-y: auto;
  z-index: 1000;
  min-width: 195px;
}

.multi-select-dropdown.active { display: block; }

.multi-select-dropdown label {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}

.multi-select-dropdown label input[type="checkbox"] {
  margin: 0 6px 0 0;
  vertical-align: middle;
  width: auto !important;
  cursor: pointer;
}

.multi-select-dropdown label:hover { background: #f0f0f0; }

.sku-actions {
  padding: 4px 8px;
  font-size: 0.75rem;
  border-bottom: 1px solid #ddd;
  text-align: center;
}

.sku-actions span {
  cursor: pointer;
  color: #0066cc;
}

.sku-actions span:hover { text-decoration: underline; }

/* Typography */
h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  color: #333;
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
}

.subtitle {
  color: #666;
  font-size: 1.1rem;
}

/* Table */
.table-container {
  background: #fff;
  border-radius: 0;
  padding: 0;
  margin: 0;
  overflow: auto;
  border-top: none;
  flex: 1;
  min-height: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  border: 1px solid #ddd;
}

th, td {
  padding: 0 15px;
  text-align: left;
  border-bottom: 1px solid #ddd;
  border-right: 1px solid #ddd;
}

th { padding: 12px 15px; }
th:last-child, td:last-child { border-right: none; }

th {
  background: #f8f8f8;
  color: #555;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  z-index: 10;
}

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: #eee; }
.sort-arrow { margin-left: 5px; font-size: 0.7rem; }

tr { height: 45px; background: #f5f5f5; }

td {
  color: #333;
  font-weight: 300;
  height: 45px;
  vertical-align: middle;
}

td.editable-cell { background: #fff; }

/* Status badges */
.status-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: normal;
  display: inline-block;
}

.number-cell, .date-cell { line-height: normal; }
.number-cell.estimated { color: #888; font-style: italic; }
.number-cell.mismatch { color: #d32f2f; }

/* Instant tooltip for mismatch cells */
.mismatch-tooltip {
  position: fixed;
  background: #333;
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  z-index: 10000;
  pointer-events: none;
  white-space: nowrap;
}
.status-pending { background: #f0f0f0; color: #666; }
.status-completed { background: #e8e8e8; color: #333; }
.status-processing { background: #eee; color: #555; }

/* Loading & Empty states */
.loading { text-align: center; padding: 50px; color: #666; }

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #ddd;
  border-top-color: #888;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 50px; color: #666; }

/* Buttons */
.refresh-btn {
  background: transparent;
  border: 1px solid #333;
  color: #333;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  font-size: 0.75rem;
  margin: 0;
  transition: all 0.2s;
}

.refresh-btn:hover { background: #333; color: #fff; }

/* Cells */
.number-cell { color: #333; }
.date-cell { color: #555; }
.wide-col { min-width: 200px; }
.midwide-col { min-width: 120px; }
.datewide-col { min-width: 150px; }

/* Editable cells */
.editable-cell { cursor: pointer; position: relative; }
.editable-cell:hover { background: #f0f0f0 !important; }

.editable-cell input, .editable-cell select {
  background: #fff;
  border: 1px solid #999;
  color: #333;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.85rem;
  width: 100%;
  box-sizing: border-box;
}

.editable-cell input[type="number"] { -moz-appearance: textfield; }
.editable-cell input[type="number"]::-webkit-outer-spin-button,
.editable-cell input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.editable-cell input:focus, .editable-cell select:focus { outline: none; border-color: #666; box-shadow: 0 0 5px rgba(0,0,0,0.2); }

.editable-cell select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  min-width: 120px;
}

.editable-cell select.status-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  background: #fff;
  border: 1px solid #999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.editable-cell select option { background: #fff; color: #333; padding: 8px 12px; cursor: pointer; }
.editable-cell select option:hover { background: #eee; }

.editable-cell select.sku-cell-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  background: #fff;
  border: 1px solid #999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  min-width: 180px;
  max-height: 240px;
  overflow-y: auto;
}

.saving-indicator {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #555;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  display: none;
  z-index: 1000;
}

/* Login page */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: #f5f5f5;
}

.login-box {
  background: #fff;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 400px;
}

.login-box h1 { text-align: center; margin-bottom: 10px; font-size: 1.8rem; }
.login-box .subtitle { text-align: center; margin-bottom: 30px; color: #666; }
.login-box .form-group { margin-bottom: 20px; }
.login-box label { display: block; margin-bottom: 5px; font-weight: 500; color: #333; }

.login-box input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  box-sizing: border-box;
}

.login-box input:focus { outline: none; border-color: #666; }

/* Password toggle */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  padding-right: 40px;
}

.password-toggle {
  position: absolute;
  right: 10px;
  cursor: pointer;
  color: #666;
  user-select: none;
  display: flex;
  align-items: center;
}

.password-toggle:hover { color: #333; }
.password-toggle svg { display: block; }

.login-box button {
  width: 100%;
  padding: 12px;
  background: #333;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.login-box button:hover { background: #555; }

.login-box .register-toggle-btn {
  background: transparent;
  border: 1px solid #999;
  color: #666;
  margin-top: 10px;
}

.login-box .register-toggle-btn:hover { background: #f5f5f5; color: #333; }

.login-error {
  color: #d32f2f;
  text-align: center;
  margin-bottom: 15px;
  display: none;
}

/* User info header */
.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 0.85rem;
  color: #666;
}

.user-info span { padding: 4px 8px; background: #eee; border-radius: 4px; }

.logout-btn {
  background: transparent;
  border: 1px solid #999;
  color: #666;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.logout-btn:hover { background: #333; color: #fff; border-color: #333; }

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: #fff;
  border-bottom: 1px solid #ddd;
  flex-shrink: 0;
}

.header-left h1 { font-size: 1.5rem; margin: 0; }
.header-left .subtitle { font-size: 0.85rem; margin: 0; }

#mainApp { display: none; height: 100%; }

/* Approval page styles */
.approval-box {
  background: #fff;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 450px;
}

.approval-box h1 { text-align: center; margin-bottom: 10px; font-size: 1.5rem; }
.approval-box .subtitle { text-align: center; margin-bottom: 30px; color: #666; }
.info-row { margin-bottom: 15px; }
.info-row label { font-weight: 500; color: #333; }
.info-row span { color: #666; }
.role-select { margin: 20px 0; }
.role-select label { display: block; margin-bottom: 8px; font-weight: 500; }

.role-select select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

.buttons { display: flex; gap: 10px; margin-top: 20px; }

.btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-approve { background: #2e7d32; color: #fff; }
.btn-approve:hover { background: #1b5e20; }
.btn-reject { background: #c62828; color: #fff; }
.btn-reject:hover { background: #b71c1c; }

.message { text-align: center; padding: 20px; }
.message.success { color: #2e7d32; }
.message.error { color: #c62828; }
.login-prompt { text-align: center; margin-top: 20px; }
.login-prompt a { color: #333; }

/* Reset password page */
.reset-box {
  background: #fff;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 400px;
}

.reset-box h1 { text-align: center; margin-bottom: 10px; font-size: 1.5rem; }
.reset-box .subtitle { text-align: center; margin-bottom: 30px; color: #666; }
.reset-box .form-group { margin-bottom: 20px; }
.reset-box .form-group label { display: block; margin-bottom: 8px; font-weight: 500; color: #333; }

.reset-box .form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

.reset-box .form-group input:focus { outline: none; border-color: #333; }

.requirements {
  background: #f9f9f9;
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 20px;
  font-size: 0.85rem;
}

.requirements h4 { margin-bottom: 10px; color: #333; }
.requirements ul { margin-left: 20px; color: #666; }
.requirements li { margin-bottom: 5px; }
.requirements li.valid { color: #28a745; }
.requirements li.invalid { color: #dc3545; }

.reset-box .btn {
  width: 100%;
  padding: 12px;
  background: #333;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.reset-box .btn:hover { background: #555; }
.reset-box .btn:disabled { background: #999; cursor: not-allowed; }

.error { color: #dc3545; margin-bottom: 15px; display: none; text-align: center; }
.success { color: #28a745; margin-bottom: 15px; display: none; text-align: center; }
.back-link { text-align: center; margin-top: 20px; }
.back-link a { color: #333; text-decoration: none; }
.back-link a:hover { text-decoration: underline; }

/* Pending Registrations Notification */
.pending-notification {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 4px;
  margin: 10px 20px;
  overflow: hidden;
}

.pending-header {
  padding: 10px 15px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  color: #856404;
}

.pending-header:hover { background: #ffecb5; }

.pending-toggle {
  transition: transform 0.2s;
  font-size: 0.8rem;
}

.pending-toggle.open { transform: rotate(180deg); }

.pending-list {
  border-top: 1px solid #ffc107;
  max-height: 300px;
  overflow-y: auto;
}

.pending-item {
  padding: 10px 15px;
  border-bottom: 1px solid #ffeeba;
  cursor: pointer;
  background: #fffbf0;
}

.pending-item:last-child { border-bottom: none; }
.pending-item:hover { background: #fff3cd; }

.pending-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pending-item-email { font-weight: 500; color: #333; }
.pending-item-merchant { font-size: 0.85rem; color: #666; }
.pending-item-date { font-size: 0.75rem; color: #999; }

.pending-item-details {
  display: none;
  margin-top: 10px;
  padding: 10px;
  background: #fff;
  border-radius: 4px;
  border: 1px solid #ddd;
}

.pending-item-details.expanded { display: block; }

.pending-detail-row {
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.pending-detail-row label {
  font-weight: 500;
  color: #555;
  display: inline-block;
  min-width: 100px;
}

.pending-actions {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

.pending-actions button {
  padding: 6px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  border: none;
  transition: background 0.2s;
}

.pending-approve { background: #28a745; color: #fff; }
.pending-approve:hover { background: #218838; }
.pending-reject { background: #dc3545; color: #fff; }
.pending-reject:hover { background: #c82333; }

.pending-role-select {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* Status single-select dropdown */
.status-select { position: relative; }

.status-select-btn {
  width: 104px;
  padding: 4px 6px;
  font-size: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 24px;
  box-sizing: border-box;
}

.dropdown-arrows {
  font-size: 0.45rem;
  color: #666;
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.status-select-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 3px;
  z-index: 1000;
  min-width: 104px;
}

.status-select-dropdown.active { display: block; }

.status-option {
  padding: 6px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}

.status-option:hover { background: #f0f0f0; }
.status-option.selected { background: #e8e8e8; font-weight: 500; }

/* Directory Button */
.directory-btn {
  background: transparent;
  border: 1px solid #999;
  color: #666;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.directory-btn:hover { background: #333; color: #fff; border-color: #333; }

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.modal-content {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.directory-modal {
  width: 625px;
  max-width: 90vw;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #ddd;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: #333;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  padding: 0;
  line-height: 1;
}

.modal-close:hover { color: #333; }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: 60vh;
}

/* Directory List */
.directory-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.directory-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #f8f8f8;
  border-radius: 4px;
  gap: 10px;
}

.directory-row.editing { background: #fff8e6; }

.directory-email {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directory-email-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directory-role-select {
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.8rem;
  background: #fff;
  min-width: 80px;
}

.directory-role-select:disabled {
  background: #eee;
  color: #666;
  cursor: not-allowed;
}

.directory-role-select.editable {
  background: #fff;
  cursor: pointer;
}

.directory-edit-btn, .directory-save-btn {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  border: 1px solid #999;
  background: transparent;
  color: #666;
  transition: all 0.2s;
}

.directory-edit-btn:hover { background: #333; color: #fff; border-color: #333; }

.directory-save-btn {
  background: #28a745;
  color: #fff;
  border-color: #28a745;
}

.directory-save-btn:hover { background: #218838; border-color: #218838; }

.directory-current-user {
  font-size: 0.7rem;
  color: #999;
  margin-left: 5px;
}

.directory-merchant {
  font-size: 0.8rem;
  color: #666;
  min-width: 80px;
}

.directory-superadmin {
  font-size: 0.8rem;
  color: #666;
  font-style: italic;
}
