/* ==========================================================================
   ShareCraft Web Dashboard — login + app styles
   Relies on the brand CSS variables defined in styles.css (:root)
   ========================================================================== */

/* ------------------------------- Login ---------------------------------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 15% 10%, rgba(107,179,214,0.22), transparent 45%),
    radial-gradient(circle at 90% 0%, rgba(49,125,164,0.18), transparent 40%),
    linear-gradient(180deg, #f5f9fc 0%, #ffffff 100%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
}
.auth-brand {
  display: flex; align-items: center; gap: 0.6rem; justify-content: center;
  font-weight: 800; color: var(--maastricht-blue); font-size: 1.2rem; margin-bottom: 6px;
}
.auth-brand img { width: 40px; height: 40px; }
.auth-card h1 { font-size: 1.5rem; text-align: center; margin: 10px 0 4px; }
.auth-card .sub { text-align: center; color: var(--ink-faint); font-size: 0.95rem; margin-bottom: 24px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 0.8rem 0.9rem; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 1rem; font-family: inherit; color: var(--ink); background: #fff; transition: border-color 0.15s;
}
.field input:focus { outline: none; border-color: var(--freedom-blue); }
.auth-actions { margin-top: 22px; }
.btn--block { width: 100%; justify-content: center; }
.auth-msg { font-size: 0.9rem; margin: 14px 0 0; text-align: center; min-height: 1.2em; }
.auth-msg.error { color: var(--desire); }
.auth-msg.ok { color: var(--success); }
.auth-links { margin-top: 20px; text-align: center; font-size: 0.9rem; color: var(--ink-faint); }
.auth-links a { color: var(--freedom-blue); font-weight: 600; }
.auth-foot { margin-top: 22px; text-align: center; font-size: 0.8rem; color: var(--ink-faint); }
.link-btn { background: none; border: 0; color: var(--freedom-blue); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }

/* ------------------------------- Dashboard shell ------------------------ */
body.app { background: var(--bg-soft); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }

.app-side {
  background: var(--maastricht-blue); color: #fff; padding: 20px 16px;
  display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh;
}
.app-side__brand { display: flex; align-items: center; gap: 0.55rem; font-weight: 800; font-size: 1.05rem; margin-bottom: 18px; padding: 0 8px; color: #fff; text-decoration: none; }
.app-side__brand:hover { opacity: 0.85; }
.app-side__brand img { width: 58px; height: auto; border-radius: 10px; display: block; }
.nav-item {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem 0.85rem; border-radius: 11px;
  color: rgba(255,255,255,0.78); font-weight: 600; font-size: 0.95rem; cursor: pointer; border: 0; background: none; text-align: left; width: 100%;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: var(--freedom-blue); color: #fff; }
.nav-item svg { width: 19px; height: 19px; flex: none; }
.app-side__spacer { flex: 1; }
.app-side__foot { padding: 8px; border-top: 1px solid rgba(255,255,255,0.12); margin-top: 8px; }

/* Topbar */
.app-main { display: flex; flex-direction: column; min-width: 0; }
.app-top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: #fff; border-bottom: 1px solid var(--line); padding: 14px 26px; position: sticky; top: 0; z-index: 20;
}
.app-top__left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.app-top h2 { font-size: 1.15rem; margin: 0; }
.aircraft-select { display: flex; align-items: center; gap: 8px; }
.aircraft-select select {
  padding: 0.5rem 0.7rem; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; font-weight: 600;
  color: var(--ink); background: #fff; max-width: 260px;
}
.app-top__right { display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink-soft); font-size: 0.9rem; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--freedom-blue); color: #fff; display: grid; place-items: center; font-weight: 700; overflow: hidden; }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pro-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em;
  padding: 0.28rem 0.6rem; border-radius: 999px; text-transform: uppercase;
}
.pro-badge.pro { background: rgba(209,160,47,0.16); color: #8a681b; }
.pro-badge.free { background: rgba(15,51,75,0.08); color: var(--ink-faint); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,51,75,0.5); display: grid; place-items: center; z-index: 200; padding: 20px; }
.modal { position: relative; background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 470px; padding: 26px 28px; }
.modal-close { position: absolute; top: 12px; right: 16px; background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--ink-faint); }
.modal-close:hover { color: var(--ink); }
.modal textarea.input { resize: vertical; font-family: inherit; }

/* Content */
.app-content { padding: 26px; max-width: 1180px; width: 100%; }
.app-content h3.sec-title { font-size: 1.05rem; margin: 0 0 4px; }
.muted { color: var(--ink-faint); font-size: 0.9rem; }
.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: 1fr 1fr; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: var(--shadow-sm); }
.panel h4 { margin: 0 0 14px; font-size: 1rem; }

.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat .label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); font-weight: 700; }
.stat .value { font-size: 1.7rem; font-weight: 800; color: var(--ink); margin-top: 4px; letter-spacing: -0.02em; }
.stat .value small { font-size: 0.9rem; font-weight: 600; color: var(--ink-faint); }
.stat .hint { font-size: 0.82rem; color: var(--ink-soft); margin-top: 2px; }

/* Aircraft hero card */
.ac-hero { display: flex; gap: 20px; align-items: center; }
.ac-hero__photo { width: 220px; height: 150px; border-radius: 14px; object-fit: cover; background: var(--bg-tint); flex: none; }
.ac-hero__photo.placeholder { display: grid; place-items: center; color: var(--freedom-blue); }
.ac-hero h3 { font-size: 1.5rem; margin: 0 0 2px; }
.ac-hero .mm { color: var(--ink-soft); font-weight: 600; }
.ac-hero .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 0.75rem; font-weight: 700; padding: 0.25rem 0.6rem; border-radius: 999px; background: var(--bg-tint); color: var(--freedom-blue); }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); font-weight: 700; padding: 10px 12px; border-bottom: 2px solid var(--line); white-space: nowrap; }
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line); color: var(--ink-soft); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: var(--bg-soft); }

.badge { font-size: 0.72rem; font-weight: 700; padding: 0.22rem 0.6rem; border-radius: 999px; display: inline-block; white-space: nowrap; }
.badge.green { background: rgba(28,101,46,0.14); color: var(--success); }
.badge.yellow { background: rgba(209,160,47,0.18); color: #8a681b; }
.badge.red { background: rgba(224,70,78,0.14); color: var(--desire); }
.badge.blue { background: rgba(49,125,164,0.14); color: var(--freedom-blue); }
.badge.gray { background: rgba(15,51,75,0.08); color: var(--ink-faint); }

/* Forms (aircraft settings, maintenance) */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .field { margin: 0; }
.form-grid .field.wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; }
select.input, input.input, textarea.input {
  width: 100%; padding: 0.7rem 0.8rem; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; color: var(--ink); background: #fff;
}
select.input:focus, input.input:focus, textarea.input:focus { outline: none; border-color: var(--freedom-blue); }
.readonly-note { font-size: 0.85rem; color: var(--ink-faint); background: var(--bg-tint); padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; }

.empty { text-align: center; color: var(--ink-faint); padding: 40px 20px; }
.loading { text-align: center; color: var(--ink-faint); padding: 40px; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--freedom-blue); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

#map { height: 460px; border-radius: 14px; border: 1px solid var(--line); z-index: 1; }
.leaflet-container { font: inherit; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

/* Calendar */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cal-head h4 { flex: 1; text-align: center; margin: 0; font-size: 1.1rem; }
.cal-nav { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 1.25rem; line-height: 1; color: var(--maastricht-blue); }
.cal-nav:hover { background: var(--bg-soft); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dows { margin-bottom: 6px; }
.cal-dow { text-align: center; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-faint); padding: 2px 0; }
.cal-cell { min-height: 98px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: #fff; overflow: hidden; }
.cal-cell.out { background: var(--bg-soft); opacity: 0.55; }
.cal-cell.today { border-color: var(--freedom-blue); box-shadow: inset 0 0 0 1px var(--freedom-blue); }
.cal-daynum { font-size: 0.8rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 4px; }
.cal-cell.today .cal-daynum { color: var(--freedom-blue); }
.cal-pill { font-size: 0.72rem; font-weight: 700; padding: 3px 6px; border-radius: 6px; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.cal-pill .ap { font-weight: 600; opacity: 0.85; }
.cal-pill.green { background: rgba(28,101,46,0.14); color: var(--success); }
.cal-pill.yellow { background: rgba(209,160,47,0.2); color: #8a681b; }
.cal-pill.blue { background: rgba(49,125,164,0.14); color: var(--freedom-blue); }
.cal-pill.gray { background: rgba(15,51,75,0.08); color: var(--ink-faint); }
.cal-more { font-size: 0.68rem; color: var(--ink-faint); font-weight: 600; padding-left: 4px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 0.8rem; color: var(--ink-faint); }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.ac-filters { display: flex; flex-wrap: wrap; gap: 10px; }
.ac-filter { display: inline-flex; align-items: center; gap: 7px; padding: 0.45rem 0.8rem; border: 1px solid var(--line); border-radius: 999px; font-weight: 600; font-size: 0.88rem; color: var(--ink-soft); cursor: pointer; user-select: none; }
.ac-filter:hover { border-color: var(--freedom-blue); }
.ac-filter input { accent-color: var(--freedom-blue); width: 15px; height: 15px; }

/* Report tabs (Expenses & Reports) */
.rtabs { display: flex; flex-wrap: wrap; gap: 6px; background: var(--bg-tint); padding: 5px; border-radius: 12px; margin-bottom: 20px; }
.rtab { border: 0; background: none; padding: 0.55rem 1rem; border-radius: 9px; font-weight: 700; font-size: 0.9rem; color: var(--ink-soft); cursor: pointer; white-space: nowrap; transition: background 0.15s, color 0.15s; }
.rtab:hover { color: var(--freedom-blue); }
.rtab.active { background: #fff; color: var(--freedom-blue); box-shadow: var(--shadow-sm); }
.range-pick { display: inline-flex; gap: 4px; background: var(--bg-tint); padding: 4px; border-radius: 10px; }
.range-pick button { border: 0; background: none; padding: 0.4rem 0.7rem; border-radius: 7px; font-weight: 600; font-size: 0.82rem; color: var(--ink-soft); cursor: pointer; }
.range-pick button.active { background: #fff; color: var(--freedom-blue); box-shadow: var(--shadow-sm); }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.bar-row .bl { width: 130px; font-size: 0.85rem; color: var(--ink-soft); flex: none; }
.bar-row .bt { flex: 1; height: 9px; background: var(--bg-tint); border-radius: 99px; overflow: hidden; }
.bar-row .bt > i { display: block; height: 100%; background: var(--freedom-blue); border-radius: 99px; }
.bar-row .bv { width: 92px; text-align: right; font-weight: 700; font-size: 0.85rem; flex: none; }
@media (max-width: 700px) {
  .cal-cell { min-height: 78px; padding: 4px; }
  .cal-pill { font-size: 0.64rem; padding: 2px 4px; }
  .cal-grid { gap: 3px; }
}

/* Mobile */
.app-side__toggle { display: none; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-side {
    position: fixed; left: 0; top: 0; bottom: 0; width: 240px; z-index: 60; transform: translateX(-100%);
    transition: transform 0.2s ease; height: 100vh;
  }
  .app-shell.side-open .app-side { transform: translateX(0); }
  .app-side__toggle { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
  .app-side__toggle svg { width: 20px; height: 20px; color: var(--maastricht-blue); }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .form-grid, .grid-2 { grid-template-columns: 1fr; }
  .ac-hero { flex-direction: column; align-items: flex-start; }
  .ac-hero__photo { width: 100%; height: 200px; }
  .app-content { padding: 18px; }
}
@media (max-width: 560px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .user-chip span.name { display: none; }
  .aircraft-select select { max-width: 150px; }
}
/* Airport type-ahead search */
.ac-search { position: relative; }
.ac-search__list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 50;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); max-height: 240px; overflow-y: auto; padding: 4px;
}
.ac-search__item {
  display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.ac-search__item b { font-size: 0.9rem; color: var(--ink); letter-spacing: 0.02em; }
.ac-search__item span { font-size: 0.78rem; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-search__item:hover, .ac-search__item.active { background: var(--bg-soft); }
.ac-search__empty { padding: 10px 12px; font-size: 0.82rem; color: var(--ink-faint); }
