/* Modern Light Pilot Logbook Stylesheet */

:root {
  --primary-color: #1e3a8a;       /* Deep Royal Navy */
  --primary-hover: #1d4ed8;       /* Royal Blue */
  --accent-color: #2563eb;        /* Sky/Royal Accent */
  
  --header-bg: #ffffff;           /* Clean Light Header */
  --nav-link-color: #475569;      /* Medium Slate Link */
  --nav-link-hover: #1e3a8a;      /* Dark Navy Hover */
  --nav-link-active-bg: #dbeafe;  /* Light Blue Active Pill */
  --nav-link-active-text: #1e40af;

  --bg-color: #f8fafc;            /* Crisp Light Background */
  --card-bg: #ffffff;             /* Pure White Card */
  --text-main: #0f172a;           /* Dark Slate Main Text */
  --text-muted: #64748b;          /* Muted Grey Text */
  --border-color: #cbd5e1;        /* Light Border */
  --border-light: #e2e8f0;        /* Subtle Light Border */
  
  --table-header-bg: #f1f5f9;     /* Light Slate Table Header */
  --table-header-text: #1e293b;   /* Dark Slate Table Header Text */
  --table-row-alt: #f8fafc;       /* Alternating Row Striping */
  --table-summary-bg: #eff6ff;   /* Summary Row Light Blue */
  
  --danger-color: #dc2626;        /* Red Alert */
  --success-color: #16a34a;       /* Green Success */

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 25px -5px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* App Header & Navigation Bar */
.app-header {
  background-color: var(--header-bg);
  color: var(--text-main);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--border-light);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--primary-color);
}

.brand-icon {
  font-size: 22px;
}

.brand-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--primary-color);
}

/* Nav Menu Items */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-list {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 6px;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--nav-link-color);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease-in-out;
}

.nav-link:hover, .nav-link:focus {
  color: var(--nav-link-hover);
  background-color: #f1f5f9;
}

.nav-link.active {
  color: var(--nav-link-active-text);
  background-color: var(--nav-link-active-bg);
  font-weight: 600;
}

.arrow {
  font-size: 11px;
  opacity: 0.75;
  transition: transform 0.2s ease;
}

/* Dropdown Menus */
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  list-style: none;
  padding: 8px 0;
  min-width: 200px;
  z-index: 1200;
}

/* Bridge gap between link and dropdown so hover state is never lost */
.dropdown-menu::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 12px;
  background: transparent;
}

.dropdown-menu li {
  width: 100%;
}

.dropdown-item {
  display: block;
  padding: 10px 20px;
  color: #334155;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
  cursor: pointer;
}

.dropdown-item:hover, .dropdown-item:focus {
  background-color: #f1f5f9;
  color: var(--primary-color);
}

.dropdown-item.active-item {
  background-color: var(--nav-link-active-bg);
  color: var(--nav-link-active-text);
  font-weight: 600;
}

/* Display dropdown on desktop hover AND on active/show class */
@media (min-width: 769px) {
  .nav-item.dropdown:hover > .dropdown-menu,
  .nav-item.dropdown.show > .dropdown-menu {
    display: block;
  }

  .nav-item.dropdown:hover .arrow,
  .nav-item.dropdown.show .arrow {
    transform: rotate(180deg);
  }
}

/* User Actions & Badge */
.nav-user-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  background-color: #f1f5f9;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
}

.btn-logout {
  background-color: #fee2e2;
  color: #991b1b;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: 1px solid #fecaca;
  transition: background-color 0.2s ease;
}

.btn-logout:hover {
  background-color: #fca5a5;
  color: #7f1d1d;
}

/* Hamburger Toggle (Mobile) */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
}

.hamburger-bar {
  display: block;
  width: 24px;
  height: 3px;
  background-color: var(--text-main);
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* Responsive Mobile Navigation */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    flex-direction: column;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
    gap: 16px;
  }

  .nav-menu.open {
    display: flex;
  }

  .nav-list {
    flex-direction: column;
    width: 100%;
    align-items: stretch;
    gap: 6px;
  }

  .nav-link {
    width: 100%;
    font-size: 16px;
    padding: 12px 16px;
    justify-content: space-between;
  }

  .dropdown-menu {
    position: static;
    box-shadow: none;
    background-color: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    margin-top: 6px;
    padding: 6px 0;
  }

  .dropdown-menu::before {
    display: none;
  }

  .nav-item.dropdown.show > .dropdown-menu {
    display: block;
  }

  .nav-user-actions {
    width: 100%;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
  }
}

/* Main Content Layout */
.main-content {
  flex: 1;
  padding: 32px 24px;
}

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

.wide-container {
  max-width: 1440px;
}

.medium-container {
  max-width: 840px;
}

.small-container {
  max-width: 480px;
}

.mobile-container {
  max-width: 480px;
}

/* Cards & Sections */
.card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  margin-bottom: 24px;
}

h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 24px;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 14px;
}

.section-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* Form Controls */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  color: var(--text-main);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-control.readonly {
  background-color: #f1f5f9;
  color: var(--text-muted);
  cursor: not-allowed;
}

.time-input {
  width: 50px !important;
  display: inline-block !important;
  text-align: center;
  padding: 6px;
  font-size: 14px;
}

.text-center { text-align: center; }
.text-uppercase { text-transform: uppercase; }

.forgot-link {
  color: var(--accent-color);
  font-size: 13px;
  text-decoration: none;
  font-weight: 500;
}

.forgot-link:hover {
  text-decoration: underline;
}

/* Grid Layouts */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

@media (max-width: 640px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.margin-top { margin-top: 24px; }
.margin-bottom { margin-bottom: 28px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease-in-out;
}

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

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

.btn-secondary {
  background-color: #f1f5f9;
  color: var(--text-main);
  border-color: var(--border-color);
}

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

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

.btn-danger:hover {
  background-color: #b91c1c;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
  display: flex;
}

/* Alerts */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  font-size: 14px;
}

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

.alert-success {
  background-color: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alert-info {
  background-color: #f0f9ff;
  color: #075985;
  border: 1px solid #bae6fd;
}

/* Logbook & Data Tables */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.logbook-table, .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background-color: #ffffff;
}

/* Light Table Headers */
.logbook-table th, .data-table th {
  background-color: var(--table-header-bg);
  color: var(--table-header-text);
  font-weight: 600;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  text-align: center;
  font-size: 13px;
}

.logbook-table td, .data-table td {
  padding: 8px 12px;
  border: 1px solid var(--border-light);
}

.data-table tbody tr:nth-child(even) {
  background-color: var(--table-row-alt);
}

.data-table tbody tr:hover {
  background-color: #f1f5f9;
}

.num {
  text-align: right;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.font-bold {
  font-weight: bold;
}

/* Summary Rows */
.summary-row {
  background-color: var(--table-summary-bg);
  font-weight: bold;
  color: #1e3a8a;
}

.prev-summary {
  background-color: #f1f5f9;
  color: #334155;
}

.total-summary {
  background-color: #dbeafe;
  color: #1e40af;
}

.total-row {
  font-weight: bold;
  background-color: #f1f5f9;
  color: #1e293b;
}

/* Pagination */
.pagination-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-indicator {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 8px;
}

/* Login Card Center */
.login-body {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  max-width: 130px;
  margin-bottom: 14px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* App Footer */
.app-footer {
  background-color: #ffffff;
  color: #64748b;
  text-align: center;
  padding: 20px;
  font-size: 13px;
  margin-top: auto;
  border-top: 1px solid var(--border-light);
}

.footer-container {
  max-width: 1400px;
  margin: 0 auto;
}