/* style.css - Phone App Version */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: rgb(51, 95, 147);
  --primary-light: rgba(51, 95, 147, 0.1);
  --primary-hover: rgb(41, 75, 127);
  --white: #ffffff;
  --text-dark: #1a1a1a;
  --text-light: #666666;
  --border-color: #e0e0e0;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
  --mobile-nav-height: 60px;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-top: env(safe-area-inset-top, 0px);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #f5f7fa;
  min-height: 100vh;
  color: var(--text-dark);
  padding-bottom: calc(var(--mobile-nav-height) + var(--safe-area-bottom));
  -webkit-tap-highlight-color: transparent;
}

/* Desktop nav hidden - only mobile */
.desktop-nav {
  display: none;
}

/* App Header */
.site-header {
  background: var(--white);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
}

.navbar {
  padding: 0.75rem 0;
}

.nav-container {
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-light);
}

.user-info .username {
  display: none;
}

/* Mobile Bottom Navigation - Phone Style */
.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
  padding: 0.5rem 0.75rem;
  padding-bottom: calc(0.5rem + var(--safe-area-bottom));
  z-index: 1000;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.mobile-nav-container {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 500px;
  margin: 0 auto;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  text-decoration: none;
  color: var(--text-light);
  font-size: 0.7rem;
  padding: 0.5rem;
  transition: all 0.2s;
  border-radius: 12px;
  flex: 1;
  text-align: center;
}

.nav-item.active {
  color: var(--primary-color);
  background: var(--primary-light);
}

.nav-item svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Container - Phone Friendly */
.container {
  padding: 1rem;
  max-width: 100%;
}

/* Login Page - Phone Style */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
  background: var(--white);
  padding: 2rem 1.5rem;
  border-radius: 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 360px;
}

.login-box h1 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  text-align: center;
}

.login-box h2 {
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--text-light);
  font-size: 0.9rem;
  font-weight: normal;
}

/* Alerts */
.alert {
  padding: 0.875rem;
  margin-bottom: 1rem;
  border-radius: 12px;
  font-size: 0.85rem;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Forms - Touch Friendly */
.form-group {
  margin-bottom: 1rem;
}

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.2s;
  background: var(--white);
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Buttons - Bigger for Touch */
.btn {
  padding: 0.875rem 1.25rem;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s;
  text-align: center;
}

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

.btn-primary:active {
  transform: scale(0.97);
  background: var(--primary-hover);
}

.btn-secondary {
  background: #e9ecef;
  color: var(--text-dark);
}

.btn-secondary:active {
  transform: scale(0.97);
}

.btn-logout {
  background: #dc3545;
  color: var(--white);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
}

.btn-logout:active {
  transform: scale(0.97);
}

/* Dashboard - Phone Grid */
.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.card {
  background: var(--white);
  padding: 1.25rem;
  border-radius: 20px;
  box-shadow: var(--shadow);
  transition: all 0.2s;
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.card:active {
  transform: scale(0.98);
}

.card h2 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}

.card p {
  color: var(--text-light);
  margin-bottom: 1rem;
  line-height: 1.5;
  font-size: 0.9rem;
}

/* Flight Form */
.flight-form {
  background: var(--white);
  padding: 1.25rem;
  border-radius: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.form-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #f0f0f0;
}

.form-section:last-child {
  border-bottom: none;
}

.form-section h2 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary-color);
  display: inline-block;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 1rem;
}

.form-actions .btn {
  width: 100%;
}

/* Dynamic Sections */
.dynamic-section {
  border: 1px solid var(--border-color);
  padding: 1rem;
  margin: 0.75rem 0;
  border-radius: 16px;
  background: #fafafa;
  position: relative;
}

.remove-btn {
  background: #dc3545;
  color: var(--white);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8rem;
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}

.add-btn {
  background: #28a745;
  color: var(--white);
  border: none;
  padding: 0.75rem;
  border-radius: 30px;
  cursor: pointer;
  margin-top: 0.75rem;
  width: 100%;
  font-size: 0.9rem;
  font-weight: 500;
}

.subsection {
  margin-left: 0;
  padding: 1rem;
  border-left: 3px solid var(--primary-color);
  background: var(--primary-light);
  border-radius: 12px;
  margin-bottom: 1rem;
}

.subsection h3 {
  color: var(--primary-color);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

/* PAX Form Table - Scrollable on Phone */
table.pax-form {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.8rem;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
}

table.pax-form td,
table.pax-form th {
  border: 1px solid var(--border-color);
  padding: 0.6rem;
  min-width: 70px;
}

table.pax-form th {
  background: var(--primary-color);
  color: var(--white);
  font-weight: 600;
}

table.pax-form td:first-child {
  font-weight: 500;
  background: #f8f9fa;
}

table.pax-form input {
  width: 100%;
  border: none;
  padding: 0.5rem;
  font-size: 0.85rem;
  text-align: center;
}

/* Documents Section */
.documents-section {
  margin-top: 1.5rem;
  background: var(--white);
  padding: 1.25rem;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.documents-section h2 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.documents-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
}

.documents-table th,
.documents-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.documents-table th {
  background: var(--primary-color);
  color: var(--white);
  font-weight: 600;
}

.documents-table tr:active {
  background: #f8f9fa;
}

.documents-table form {
  display: inline;
}

.btn-small {
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
  display: inline-block;
  border-radius: 20px;
}

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

.no-documents {
  text-align: center;
  color: var(--text-light);
  padding: 2rem;
  font-style: italic;
}

/* Page Title */
.container h1 {
  color: var(--primary-color);
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

/* Draft Info & Save Indicator */
.draft-info {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary-light);
  color: var(--primary-color);
  padding: 0.5rem 1rem;
  border-radius: 30px;
  font-size: 0.8rem;
  margin-bottom: 1rem;
}

#save-indicator {
  position: fixed;
  bottom: calc(var(--mobile-nav-height) + 10px);
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 30px;
  font-size: 0.75rem;
  z-index: 999;
  pointer-events: none;
}

.clear-draft-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 30px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.clear-draft-btn:active {
  transform: scale(0.96);
}

/* Restore Prompt */
.restore-prompt {
  background: white;
  border: 2px solid var(--primary-color);
  border-radius: 20px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-lg);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.restore-prompt-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  text-align: center;
}

.restore-prompt-actions {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  flex-direction: column;
}

.restore-prompt-actions .btn {
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
}

/* Touch Optimizations */
input, select, textarea, button, .btn, .nav-item, .card {
  touch-action: manipulation;
}

input[type="number"] {
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 0.5;
}

/* Tablet and up - Keep mobile style but adjust spacing */
@media (min-width: 768px) {
  .container {
    max-width: 500px;
    margin: 0 auto;
    padding: 1rem;
  }
  
  .login-box {
    max-width: 400px;
  }
  
  .dashboard-grid {
    gap: 1rem;
  }
  
  .form-row {
    flex-direction: column;
  }
  
  .restore-prompt-content {
    flex-direction: row;
    text-align: left;
  }
  
  .restore-prompt-actions {
    flex-direction: row;
    width: auto;
    margin-left: auto;
  }
}

/* Larger screens - Keep centered phone UI */
@media (min-width: 1024px) {
  .container {
    max-width: 500px;
  }
  
  .mobile-nav {
    max-width: 500px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 20px 20px 0 0;
  }
  
  body {
    background: #e8ecf1;
  }
}

/* Print Styles */
@media print {
  .site-header,
  .mobile-nav,
  .form-actions,
  .btn,
  .clear-draft-btn {
    display: none;
  }

  body {
    background: white;
    padding-bottom: 0;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }
}