/* PilotFiles Dashboard Styles */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --bg-color: #f9fafb;
  --card-bg: #ffffff;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

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

/* Header */
.header {
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  box-shadow: var(--shadow);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.nav a:hover {
  color: var(--primary-color);
}

/* Auth Pages */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  background: var(--card-bg);
  padding: 2.5rem;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
}

.auth-card h1 {
  font-size: 1.875rem;
  margin-bottom: 0.5rem;
  text-align: center;
}

.auth-card p {
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 2rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  font-size: 1rem;
  transition: border-color 0.2s;
}

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

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

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

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

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

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

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Dashboard */
.dashboard {
  padding: 2rem 0;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.page-header p {
  color: var(--text-secondary);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
}

.stat-card h3 {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.stat-card .value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Card */
.card {
  background: var(--card-bg);
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

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

.card-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.card-body {
  padding: 1.5rem;
}

/* Table */
.table-container {
  overflow-x: auto;
}

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

thead {
  background-color: var(--bg-color);
}

th {
  text-align: left;
  padding: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--border-color);
}

tr:hover {
  background-color: var(--bg-color);
}

/* Badge */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

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

.badge-warning {
  background-color: #fef3c7;
  color: #92400e;
}

/* Alert */
.alert {
  padding: 1rem;
  border-radius: 0.375rem;
  margin-bottom: 1.5rem;
}

.alert-success {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.alert-error {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.alert-info {
  background-color: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: var(--card-bg);
  padding: 2rem;
  border-radius: 0.5rem;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h2 {
  font-size: 1.5rem;
}

.close {
  font-size: 2rem;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
}

.close:hover {
  color: var(--text-primary);
}

/* Loading Spinner */
.spinner {
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 2rem auto;
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-secondary);
}

.empty-state h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.mt-2 {
  margin-top: 1rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.hidden {
  display: none;
}

/* Overall Status Banner */
.overall-status-banner {
  padding: 16px;
  margin-bottom: 20px;
  border-radius: 8px;
  font-weight: 600;
  text-align: center;
}

.overall-status-banner.violation {
  background: #fef2f2;
  border: 2px solid #dc2626;
  color: #dc2626;
}

.overall-status-banner.compliant {
  background: #f0fdf4;
  border: 2px solid #16a34a;
  color: #16a34a;
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
  }

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

  table {
    font-size: 0.875rem;
  }

  td, th {
    padding: 0.5rem;
  }
}

/* Settings Page Styles */
.settings-container {
  max-width: 900px;
  margin: 0 auto;
}

.settings-card {
  margin-bottom: 1.5rem;
}

.settings-card h2 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Compact form styling */
.compact-form .form-group {
  margin-bottom: 0.75rem;
}

.compact-form .form-row {
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.compact-form .form-row-3 {
  margin-bottom: 0.75rem;
}

.compact-form .form-label {
  margin-bottom: 0.25rem;
  font-size: 13px;
}

.compact-form .form-input {
  padding: 0.5rem 0.75rem;
  font-size: 14px;
}

.compact-form .form-actions {
  margin-top: 1rem;
  padding-top: 0.75rem;
}

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  .form-row-3 {
    grid-template-columns: 1fr;
  }
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrapper input {
  padding-right: 45px;
}

.password-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  font-size: 18px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.password-toggle:hover {
  opacity: 1;
}

.form-help {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.danger-zone {
  border: 2px solid var(--danger-color);
  background-color: #fef2f2;
}

.danger-zone h2 {
  color: var(--danger-color);
  border-bottom-color: var(--danger-color);
}

.danger-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.danger-action h3 {
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-size: 1rem;
}

.danger-action p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin: 0;
}

@media (max-width: 768px) {
  .danger-action {
    flex-direction: column;
    align-items: flex-start;
  }
}

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

.modal-content {
  background-color: var(--card-bg);
  padding: 2rem;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h2 {
  margin-bottom: 1rem;
  color: var(--danger-color);
  font-size: 1.5rem;
}

.modal-content ul {
  margin: 1rem 0 1rem 2rem;
  color: var(--text-secondary);
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* Notification Styles */
.notification {
  position: fixed;
  top: 80px;
  right: 20px;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s ease;
  max-width: 400px;
}

.notification.show {
  opacity: 1;
  transform: translateX(0);
}

.notification-success {
  background-color: #d1fae5;
  border-left: 4px solid var(--success-color);
  color: #065f46;
}

.notification-error {
  background-color: #fee2e2;
  border-left: 4px solid var(--danger-color);
  color: #991b1b;
}

.notification-info {
  background-color: #dbeafe;
  border-left: 4px solid var(--primary-color);
  color: #1e40af;
}

.notification-warning {
  background-color: #fef3c7;
  border-left: 4px solid var(--warning-color);
  color: #92400e;
}

/* ============================================
   PAUSED ACCOUNT STYLES
   ============================================ */

/* Banner that appears at top of all pages when account is paused */
.paused-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
  padding: 12px 20px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  z-index: 10000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
}

.paused-banner a {
  color: white;
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 16px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 13px;
  transition: background 0.2s;
}

.paused-banner a:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Push body content down when banner is shown */
body.account-paused {
  padding-top: 50px;
}

body.account-paused .header {
  top: 50px;
}

/* Grey overlay for disabled pages (aircraft, tokens) */
.paused-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(128, 128, 128, 0.7);
  z-index: 9998;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(2px);
}

.paused-overlay-message {
  background: white;
  padding: 30px 50px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-width: 450px;
}

.paused-overlay-message h2 {
  color: #dc2626;
  margin-bottom: 10px;
  font-size: 24px;
}

.paused-overlay-message p {
  color: #6b7280;
  margin-bottom: 20px;
}

.paused-overlay-message .btn {
  background: #dc2626;
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.paused-overlay-message .btn:hover {
  background: #b91c1c;
}
/* Archive/Restore/Delete Button Styles */
.archive-btn, .restore-btn, .delete-btn {
  background: transparent;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 4px 6px;
  cursor: pointer;
  color: #9ca3af;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.archive-btn:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #d97706;
}

.restore-btn:hover {
  background: #dcfce7;
  border-color: #22c55e;
  color: #16a34a;
}

.delete-btn {
  font-size: 14px;
  padding: 2px 6px;
}

.delete-btn:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #dc2626;
}

/* Pilot item with action buttons */
.pilot-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.pilot-item .pilot-info {
  flex: 1;
  min-width: 0;
}

.pilot-item .pilot-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.pilot-item.archived {
  opacity: 0.7;
}

.pilot-item.archived .pilot-name {
  color: #9ca3af;
}

/* Archived Section Styles */
.archived-section {
  margin-top: 16px;
  border-top: 1px solid #e5e7eb;
  padding-top: 8px;
}

.archived-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f3f4f6;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
  transition: background 0.2s;
}

.archived-header:hover {
  background: #e5e7eb;
}

.archived-header .chevron {
  transition: transform 0.2s;
}

.archived-list {
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.archived-list.collapsed {
  max-height: 0;
  padding: 0;
}

.archived-list:not(.collapsed) {
  max-height: 500px;
  padding-top: 8px;
}

/* Aircraft item with archive button */
.aircraft-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.aircraft-item .aircraft-info {
  flex: 1;
  min-width: 0;
}

.aircraft-item.archived {
  opacity: 0.7;
}

.aircraft-item.archived .aircraft-info {
  color: #9ca3af;
}

/* ========================================
   Demo Mode Banner & Styles
   ======================================== */

.demo-banner {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-bottom: 2px solid #f59e0b;
  padding: 12px 20px;
  text-align: center;
  font-size: 14px;
  color: #92400e;
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.demo-banner-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.demo-banner-icon {
  font-size: 18px;
}

.demo-banner-cta {
  background: #1d4ed8;
  color: white;
  padding: 6px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  transition: background 0.2s;
}

.demo-banner-cta:hover {
  background: #1e40af;
}

/* Demo mode indicator badge */
.demo-badge-header {
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  margin-left: 8px;
}

/* Demo mode modal for blocked actions */
.demo-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.demo-modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.demo-modal {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: scale(0.9);
  transition: transform 0.2s;
}

.demo-modal-overlay.show .demo-modal {
  transform: scale(1);
}

.demo-modal-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.demo-modal h3 {
  font-size: 20px;
  color: #1e293b;
  margin-bottom: 8px;
}

.demo-modal p {
  color: #64748b;
  margin-bottom: 24px;
}

.demo-modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.demo-modal-btn {
  padding: 10px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.demo-modal-btn.primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
}

.demo-modal-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.demo-modal-btn.secondary {
  background: #f1f5f9;
  color: #475569;
}

.demo-modal-btn.secondary:hover {
  background: #e2e8f0;
}