/* SatView — Auth & User Management Styles */

/* ===== LOGIN SCREEN ===== */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.login-overlay--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 36px 32px 28px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
}

.login-card__logo {
  text-align: center;
  margin-bottom: 24px;
}

.login-card__title {
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--color-text);
  margin: 12px 0 4px;
  letter-spacing: -0.5px;
}

.login-card__subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
}

/* Version badge — login screen & About modal */
.login-card__version {
  display: inline-block;
  margin: 6px 0 2px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--color-accent, #4FA8C9);
  background: rgba(79, 168, 201, 0.12);
  border: 1px solid rgba(79, 168, 201, 0.3);
  border-radius: 999px;
}

/* About modal */
.about-card__close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 0;
  border-radius: 6px;
}
.about-card__close:hover { color: var(--color-text); background: rgba(255, 255, 255, 0.06); }

.about-card__features {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  text-align: left;
}
.about-card__features li {
  position: relative;
  padding: 4px 0 4px 20px;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.4;
}
.about-card__features li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent, #4FA8C9);
}
.about-card__note {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--color-text-faint, #6B7280);
  line-height: 1.5;
  text-align: center;
}
.about-card__brand {
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  opacity: 0.8;
}

.login-card__form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.login-field label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.login-field input,
.login-field select {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: var(--text-base);
  color: var(--color-text);
  font-family: var(--font-body);
  transition: border-color 0.2s;
}

.login-field input:focus,
.login-field select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-glow);
}

.login-field input:disabled,
.profile-readonly {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: var(--text-sm);
  color: var(--color-error);
  text-align: center;
}

.login-btn {
  margin-top: 4px;
  padding: 10px 16px;
  font-size: var(--text-base);
  font-weight: 600;
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.login-card__hint {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  margin-top: 18px;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.login-card__hint strong {
  color: var(--color-accent);
  font-weight: 600;
}

.login-card__brand {
  text-align: center;
  margin-top: 20px;
  opacity: 0.7;
}

/* Session conflict modal */
.login-session-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
}

.login-session-modal.hidden {
  display: none;
}

.login-session-modal__content {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 24px;
  max-width: 380px;
  width: 100%;
}

.login-session-modal__content h3 {
  margin: 0 0 12px;
  color: var(--color-text);
  font-size: var(--text-lg);
}

.login-session-modal__content p {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1.5;
  margin: 0 0 20px;
}

.login-session-modal__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ===== SUBSCRIPTION BANNER ===== */

.subscription-banner {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(251, 191, 36, 0.12);
  border-bottom: 1px solid rgba(251, 191, 36, 0.25);
  color: var(--color-warning);
  font-size: var(--text-xs);
}

.subscription-banner__close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--color-warning);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
}

/* ===== USER MENU ===== */

.user-menu {
  position: relative;
  z-index: 21000;
}

.user-menu__trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  padding: 3px 10px 3px 3px;
  cursor: pointer;
  color: var(--color-text);
  transition: background 0.2s, border-color 0.2s;
}

.user-menu__trigger:hover {
  background: var(--color-surface-2);
  border-color: var(--color-border);
}

.user-menu__avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  flex-shrink: 0;
}

.user-menu__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-menu__avatar-initial {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-bg);
}

.user-menu__name {
  font-size: var(--text-xs);
  font-weight: 500;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu__dropdown {
  position: fixed;
  top: var(--header-height);
  right: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  min-width: 220px;
  z-index: 99999;
  overflow: hidden;
}

.user-menu__dropdown.hidden {
  display: none;
}

.user-menu__dropdown-header {
  padding: 12px 14px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-menu__dropdown-header strong {
  font-size: var(--text-sm);
  color: var(--color-text);
}

.user-menu__dropdown-email {
  padding: 0 14px 10px;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.user-menu__dropdown-sep {
  height: 1px;
  background: var(--color-divider);
  margin: 2px 0;
}

.user-menu__dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  border: none;
  background: none;
  color: var(--color-text);
  font-size: var(--text-sm);
  font-family: var(--font-body);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.user-menu__dropdown-item:hover {
  background: var(--color-surface-2);
}

.user-menu__dropdown-item--danger {
  color: var(--color-error);
}

.user-menu__dropdown-item--danger:hover {
  background: rgba(248, 113, 113, 0.1);
}

.user-menu__role-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  letter-spacing: 0.3px;
}

.user-menu__role-badge--demo {
  background: rgba(107, 114, 128, 0.2);
  color: #9CA3AF;
}

.user-menu__role-badge--standard {
  background: var(--color-accent-light);
  color: var(--color-accent);
}

.user-menu__role-badge--admin {
  background: rgba(251, 191, 36, 0.15);
  color: var(--color-warning);
}

.user-menu__role-badge--manager {
  background: rgba(52, 211, 153, 0.15);
  color: #34D399;
}

/* ===== TEAM SELECTOR ===== */

.team-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
  color: var(--color-text-muted);
}

.team-selector svg {
  flex-shrink: 0;
}

.team-selector__select {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 4px 8px;
  font-size: var(--text-xs);
  color: var(--color-text);
  font-family: var(--font-body);
  cursor: pointer;
  max-width: 140px;
}

.team-selector__select:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* ===== LANGUAGE SELECTOR ===== */

.language-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
  color: var(--color-text-muted);
}

.language-selector svg {
  flex-shrink: 0;
}

.language-selector__select {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 4px 8px;
  font-size: var(--text-xs);
  color: var(--color-text);
  font-family: var(--font-body);
  cursor: pointer;
}

.language-selector__select:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* ===== PROFILE MODAL ===== */

.profile-modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  max-width: 440px;
  width: 100%;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

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

.profile-modal__header h3 {
  margin: 0;
  font-size: var(--text-lg);
  color: var(--color-text);
}

.profile-modal__close {
  color: var(--color-text-muted);
}

.profile-modal__body {
  padding: 20px;
}

/* ===== GENERIC MODAL CARD =====
   Shared by orders.js (single + bulk order), catalog-search.js (image
   detail), intel-report.js — these referenced .modal-card/.modal-card__title/
   .modal-field/.modal-actions/.modal-error without a definition anywhere;
   added here alongside .profile-modal since it's the same "small centered
   dialog inside .modal-overlay" pattern. */
.modal-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 20px 22px;
  box-shadow: var(--shadow-lg);
  width: 100%;
}
.modal-card__title {
  margin: 0 0 14px;
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
}
.modal-field { margin-bottom: 12px; }
.modal-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-faint);
  margin-bottom: 4px;
}
.modal-error {
  font-size: 12px;
  color: #FCA5A5;
  background: rgba(239, 68, 68, 0.12);
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 6px;
}

.profile-modal__avatar-section {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.profile-modal__avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.profile-modal__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-modal__avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: var(--color-bg);
  font-size: 22px;
  font-weight: 700;
}

.profile-modal__fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-modal__error {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-error);
}

.profile-modal__error.hidden {
  display: none;
}

.profile-modal__demo-notice {
  margin-top: 16px;
  padding: 10px 14px;
  background: var(--color-accent-glow);
  border: 1px solid rgba(79, 168, 201, 0.2);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-accent);
  text-align: center;
}

/* ===== ADMIN PANEL ===== */

.admin-overlay {
  position: fixed;
  inset: 0;
  z-index: 25000;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.admin-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--color-divider);
  background: var(--color-surface);
}

.admin-panel__header h2 {
  margin: 0;
  font-size: var(--text-xl);
  color: var(--color-text);
}

.admin-panel__tabs {
  display: flex;
  gap: 0;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-divider);
  padding: 0 20px;
}

.admin-tab {
  padding: 10px 20px;
  border: none;
  background: none;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-family: var(--font-body);
  transition: color 0.2s, border-color 0.2s;
}

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

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

.admin-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.admin-tab-content {
  display: none;
}

.admin-tab-content.active {
  display: block;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.admin-table-wrap {
  overflow-x: auto;
}

/* Satellites table: own scroll context so thead can stick */
#adminSatsTable {
  overflow: auto;
  max-height: calc(100vh - 178px); /* panel header + tabs + body padding + toolbar */
}

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

.admin-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--color-divider);
  white-space: nowrap;
}

.admin-table td {
  padding: 10px 12px;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-divider);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: var(--color-surface-2);
}

.admin-actions {
  display: flex;
  gap: 4px;
}

.admin-status {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.admin-status--active {
  background: rgba(52, 211, 153, 0.15);
  color: var(--color-success);
}

.admin-status--inactive {
  background: rgba(248, 113, 113, 0.1);
  color: var(--color-error);
}

/* ===== ADMIN — SATELLITES TAB ===== */
.admin-export-btn,
.admin-import-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(79, 168, 201, 0.12);
  border: 1px solid rgba(79, 168, 201, 0.35);
  color: var(--color-accent, #4FA8C9);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
  user-select: none;
}
.admin-export-btn:hover,
.admin-import-btn:hover {
  background: rgba(79, 168, 201, 0.22);
}

.admin-sat-stats {
  margin-left: 4px;
  font-size: 11px;
  color: var(--color-text-muted);
}

.admin-import-status {
  font-size: 11px;
  margin-left: 4px;
}
.admin-import-status.ok    { color: var(--color-success, #10B981); }
.admin-import-status.error { color: var(--color-error,   #EF4444); }

.admin-sat-table td {
  padding: 6px 10px;
  font-size: 11px;
}
.admin-sat-table th {
  padding: 6px 10px;
  font-size: 10px;
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 2;
  box-shadow: 0 1px 0 var(--color-divider);
}

/* Sortable column header */
.ast-sort {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.ast-sort:hover {
  color: var(--color-text);
  background: var(--color-surface-2);
}
.ast-sort--active {
  color: var(--color-accent, #4FA8C9);
}
.ast-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 8px;
  opacity: 0.5;
  vertical-align: middle;
}
.ast-sort--active .ast-arrow {
  opacity: 1;
  color: var(--color-accent, #4FA8C9);
}

.admin-sat-type {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid;
  white-space: nowrap;
}

.admin-sat-tle {
  font-size: 13px;
  font-weight: 700;
}
.admin-sat-tle.yes { color: var(--color-success, #10B981); }
.admin-sat-tle.no  { color: var(--color-text-faint, #6B7280); opacity: 0.5; }

.admin-sat-link {
  color: var(--color-accent, #4FA8C9);
  text-decoration: none;
  font-size: 13px;
  opacity: 0.8;
}
.admin-sat-link:hover { opacity: 1; }

/* ── Inline editing inputs ── */
.admin-sat-input {
  background: var(--color-bg, #1A1F24);
  border: 1px solid var(--color-accent, #4FA8C9);
  border-radius: 4px;
  color: var(--color-text, #E8ECEF);
  font-size: 11px;
  padding: 2px 5px;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
}
.admin-sat-input:focus {
  outline: none;
  border-color: #7cc4e0;
  box-shadow: 0 0 0 2px rgba(79, 168, 201, 0.2);
}
.admin-sat-input--num {
  width: 72px;
  font-family: var(--font-mono, monospace);
  text-align: right;
}
.admin-sat-input--sel {
  width: auto;
  cursor: pointer;
}
tr.editing td {
  background: rgba(79, 168, 201, 0.06);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
  .login-card {
    margin: 16px;
    padding: 28px 24px 24px;
  }

  .user-menu__name {
    display: none;
  }

  .team-selector__select {
    max-width: 90px;
  }

  .admin-panel__body {
    padding: 12px;
  }

  .admin-table {
    font-size: var(--text-xs);
  }

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

/* ===== UTILITY ===== */

.hidden {
  display: none !important;
}
