/* public/css/core/base.css */

:root {
  --blue: #1E40AF;
  --teal: #0031c6;
  --bg: #dae8f8;
  --card: #FFFFFF;
  --text: #1E293B;
  --muted: #64748B;
  --border: #a0bcdf;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Times New Roman", Times, serif;
  background: var(--bg);
  color: var(--text);
}

#appHeader {
  background: var(--blue);
  color: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  box-shadow: none;
}

#appHeader h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1;
}

#appHeader p {
  margin: 4px 0 0;
  font-size: 14px;
  opacity: 0.95;
}

#appHeader nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

button {
  font-family: "Times New Roman", Times, serif;
  border: 1px solid #bfc7d1;
  border-radius: 7px;
  padding: 7px 11px;
  font-size: 14px;
  cursor: pointer;
  background: var(--teal);
  color: white;
  font-weight: bold;
}

button:hover {
  filter: brightness(0.95);
}

#logoutButton {
  background: white;
  color: var(--blue);
}

#dashboardPage {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px;
}

#dashboardContent {
  background: var(--card);
  border: 1px solid #cfd6dd;
  border-radius: 10px;
  padding: 14px;
  box-shadow: none;
}

#welcomeText {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--muted);
}

#modulesContainer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.dashboard-module-button {
  min-height: 72px;
  border-radius: 10px;
  background: white;
  color: var(--blue);
  border: 1px solid #cfd6dd;
  box-shadow: none;
  font-size: 16px;
  text-align: left;
  padding: 12px;
}

.dashboard-module-button:hover {
  border-color: var(--teal);
  transform: none;
}

@media (max-width: 600px) {
  #appHeader {
    align-items: flex-start;
    flex-direction: column;
  }

  #appHeader nav,
  .app-header-nav {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
  }

  #dashboardPage {
    padding: 10px;
  }

  #modulesContainer {
    grid-template-columns: 1fr;
  }
}

/* Master page shell */

.page-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px;
}

.page-card {
  background: var(--card);
  border: 1px solid #cfd6dd;
  border-radius: 10px;
  padding: 14px;
  box-shadow: none;
}

.page-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.page-title-row h2 {
  margin: 0;
  color: var(--blue);
  font-size: 22px;
}

.page-title-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.toolbar-row {
  margin-bottom: 12px;
}

.toolbar-row input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: "Times New Roman", Times, serif;
  font-size: 14px;
}

.table-wrap {
  width: 100%;
  max-height: 62vh;
  overflow: auto;
  border-radius: 8px;
}

.data-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  background: white;
}

.data-table th {
  background: var(--blue);
  color: white;
  text-align: left;
  padding: 9px;
  font-size: 14px;
  white-space: nowrap;
}

.data-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px;
  font-size: 14px;
  vertical-align: top;
  white-space: nowrap;
}

.data-table tr:hover td {
  background: #dbeafe;
}

.status-pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef6fb;
  color: var(--blue);
  font-weight: bold;
  font-size: 12px;
}

@media (max-width: 700px) {
  .page-shell {
    padding: 10px;
  }

  .page-title-row {
    flex-direction: column;
    align-items: stretch;
  }

  .table-wrap {
    overflow-x: visible;
  }

  .data-table,
  .data-table thead,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 8px;
    box-shadow: none;
  }

  .data-table td {
    border-bottom: none;
    padding: 5px 2px;
  }

  .data-table td::before {
    content: attr(data-label) ": ";
    font-weight: bold;
    color: var(--blue);
  }
}

.full-page {
  max-width: none;
  width: 100%;
}

.small-button {
  padding: 5px 8px;
  font-size: 12px;
  border-radius: 6px;
  white-space: nowrap;
}

.small-button.secondary {
  background: white;
  color: var(--blue);
  border: 1px solid var(--border);
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.status-pill.status-new {
  background: #eef6fb;
  color: var(--blue);
}

.status-pill.status-checked-in {
  background: #e9f8f1;
  color: #0b6b3a;
}

.status-pill.status-in-service {
  background: #fff7e6;
  color: #8a5700;
}

.status-pill.status-waiting-for-approval,
.status-pill.status-waiting-for-parts {
  background: #fff0f0;
  color: #9b1c1c;
}

.status-pill.status-ready-for-pickup,
.status-pill.status-delivered {
  background: #eaf7ff;
  color: #075985;
}

.data-table th:first-child,
.data-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  background: white;
  box-shadow: none;
}

.data-table th:first-child {
  background: var(--blue);
  color: white;
  z-index: 5;
}

.data-table th:last-child,
.data-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 3;
  background: white;
  box-shadow: none;
}

.data-table th:last-child {
  background: var(--blue);
  color: white;
  z-index: 5;
}

.action-button-row {
  display: flex;
  gap: 5px;
  align-items: center;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  color: var(--text);
}

.form-grid input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: "Times New Roman", Times, serif;
  font-size: 14px;
}

.action-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.scanner-preview {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: white;
  max-width: 700px;
}

.scanner-preview img {
  width: 100%;
  display: block;
}

.page-message {
  margin-top: 10px;
  font-weight: bold;
  font-size: 16px;
  line-height: 1.3;
}

.page-message.ok {
  color: var(--blue);
}

.page-message.fail {
  color: #b00020;
}

@media (max-width: 700px) {
  .page-message {
    font-size: 18px;
  }
}

.hidden {
  display: none;
}

.field-error {
  border: 2px solid #f6a7bcdd !important;
  background: #ffecec !important;
}

/* Compact operational tool UI */

.tool-card {
  background: #d9e6f5;
  border: 1px solid #a8b4c0;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
}

.tool-card h3 {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 16px;
}

.tool-help {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.tool-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.tool-row input {
  flex: 1;
  min-width: 180px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: "Times New Roman", Times, serif;
  font-size: 14px;
}

.tool-preview {
  border: 1px solid #d4dbe3;
  border-radius: 10px;
  padding: 8px;
  background: white;
}

.tool-preview-grid {
  display: block;
  font-size: 14px;
  line-height: 1.45;
}

.tool-preview-grid div {
  margin-bottom: 3px;
}

.tool-message {
  margin: 6px 0 8px;
  font-weight: bold;
  font-size: 16px;
  line-height: 1.3;
}

.tool-message.ok {
  color: var(--blue);
}

.tool-message.fail {
  color: #b00020;
}

@media (max-width: 700px) {
  .tool-message {
    font-size: 18px;
  }
}

.tool-details {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.35;
}

.tool-details div {
  margin-bottom: 3px;
}

.move-validation-error {
  background: #ffd7d7 !important;
  border: 2px solid #d60000 !important;
}

button:disabled {
  background: #bfc7d1 !important;
  color: #6b7280 !important;
  cursor: not-allowed;
  opacity: 1;
}

.parking-availability-wrap {
  margin-top: 10px;
}

.parking-availability-title {
  font-weight: bold;
  margin-bottom: 8px;
}

.parking-availability-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.parking-availability-item {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;

  background: #ffffff;
  border: 1px solid #c9c9c9;
  border-radius: 8px;

  padding: 8px 12px;

  font-size: 14px;
  font-weight: bold;
}

.parking-availability-label {
  color: #222;
}

.parking-availability-count {
  color: #008a2e;
}

.parking-availability-item.parking-full {
  border-color: #b00020;
}

.parking-availability-item.parking-full .parking-availability-count {
  color: #b00020;
}

/* APP HEADER */

#appHeader {
  background: #0b3d91;
  color: #fff;

  display: flex;
  align-items: center;
  justify-content: space-between;

  position: sticky;
  top: 0;
  z-index: 1000;

  padding-top: 10px;
  padding-right: 14px;
  padding-bottom: 10px;
  padding-left: 14px;

  box-sizing: border-box;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-logo-button {
  background: transparent;
  border: none;
  cursor: pointer;

  padding: 0;
  margin: 0;

  display: flex;
  align-items: center;
}

.app-header-logo-image {
  height: 58px;
  width: auto;
  display: block;
  object-fit: contain;
}

.app-logo-button:hover {
  opacity: 0.9;
}

.app-header-divider {
  font-size: 28px;
  font-weight: bold;
  opacity: 0.85;
}

.app-header-info h1 {
  margin: 0;
  padding: 0;

  font-size: 24px;
  line-height: 1.1;
}

.app-header-info p {
  margin: 2px 0 0 0;
  padding: 0;

  font-size: 14px;
  opacity: 0.92;
}

.app-header-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

#headerAlertsButton.is-open {
  background: #d32f2f;
  border-color: #b71c1c;
}

/* =========================
   ADMIN
========================= */

.page-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.page-section {
  margin-bottom: 24px;
}

.dexp-admin-card {
  background: #d9e6f5;
  border: 1px solid #a8b4c0;
  border-radius: 10px;
  padding: 16px;
}

.dexp-admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.dexp-admin-table th,
.dexp-admin-table td {
  border: 1px solid #cfd6df;
  padding: 6px 8px;
  text-align: left;
}

.dexp-admin-table th {
  background: #0b3d91;
  color: white;
}

.dexp-notification-tray {
  position: fixed;
  top: 72px;
  right: 16px;
  z-index: 9999;
  width: 320px;
  max-width: calc(100vw - 32px);
}

.dexp-notification-card {
  background: #ffffff;
  border: 1px solid #d7dee8;
  border-left: 5px solid #1d4ed8;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  padding: 12px;
  margin-bottom: 10px;
}

.dexp-notification-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.dexp-notification-message {
  font-size: 14px;
  margin-bottom: 10px;
}

.dexp-notification-dismiss {
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}

.dexp-notification-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.dexp-notification-open,
.dexp-notification-dismiss {
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
}

.dexp-notification-open {
  font-weight: 600;
}

.dexp-notification-dismiss {
  opacity: 0.85;
}

.dexp-notification-card-opened {
  opacity: 0.65;
  filter: grayscale(1);
}

.dexp-notification-opened-label {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
}

/* Mobile notification presentation */

.dexp-notification-count-button,
.dexp-notification-collapse-button {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  background: #d32f2f;
  color: white;
  border: 1px solid #b71c1c;
}

@media (max-width: 600px) {
  .dexp-notification-tray {
    top: 150px;
    right: 16px;
    left: 16px;

    width: auto;
    max-width: none;
  }
}

@media (max-width: 600px) {
  @supports (-webkit-touch-callout: none) {
    #appHeader {
      padding-top: 54px;
    }
  }
}

/* iOS zoom fix + consistent form controls */
input,
textarea,
select {
  font-size: 16px;
  font-family: "Times New Roman", Times, serif;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-sizing: border-box;
}

/* Consistent headings on small screens */
@media (max-width: 700px) {
  .page-section h1,
  .page-title-row h2,
  .page-card h1,
  .page-card h2 {
    font-size: 20px;
    margin: 0 0 6px;
    line-height: 1.2;
  }

  .page-section h2,
  .page-card h3,
  .tool-card h3 {
    font-size: 16px;
    margin: 0 0 6px;
    line-height: 1.2;
  }

  .page-section p,
  .page-title-row p {
    font-size: 14px;
    margin: 0 0 8px;
  }
}

.form-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
}

.form-row input {
  flex: 1;
  min-width: 0;
}

.form-row button {
  flex: 0 0 auto;
  white-space: nowrap;
}