/* Paddle Queenstown staff app — shared stylesheet.
 *
 * Hand-written, no external dependency (approved decision — "hand-written
 * plain CSS", no CDN library). Deliberately simple: this is an internal
 * staff tool used on a shop-floor tablet/laptop, not a marketing site.
 */

:root {
  --color-bg: #f5f7f8;
  --color-surface: #ffffff;
  --color-border: #dbe1e4;
  --color-text: #1c2b30;
  --color-text-muted: #5b6b70;
  --color-primary: #0f7a8c;
  --color-primary-dark: #0b5f6d;
  --color-danger: #b4432f;
  --color-danger-dark: #93341f;
  --color-success: #2f8f5b;
  --color-warning: #b8860b;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(28, 43, 48, 0.08), 0 1px 6px rgba(28, 43, 48, 0.06);
  /* Left-hand sidebar nav width - big/touch-friendly per explicit request
     ("navigation tab on the left hand side... quite big so staff can
     change easily on the ipad"). Shared between `.app-nav`'s own width
     and `.page`'s matching left margin below, so they can never drift
     apart. Collapses back to a normal top bar under the existing 720px
     breakpoint - see both rules' own @media blocks. */
  --nav-width: 260px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
}

a {
  color: var(--color-primary);
}

/* ---------------------------------------------------------------------- */
/* Left-hand sidebar navigation */
/* ---------------------------------------------------------------------- */
/* Changed from a top bar to a LEFT SIDEBAR per explicit request - big,
 * touch-friendly tap targets so staff can switch pages easily on an
 * iPad. Fixed/full-height so it never scrolls away; `.page` below carries
 * a matching `margin-left: var(--nav-width)` so content never sits under
 * it. Collapses back to the original top-bar layout under 720px (this
 * file's existing responsive breakpoint - see `.form-row`/`.grid-2`
 * above) so a genuinely narrow phone screen isn't left with most of its
 * width eaten by a fixed sidebar; an iPad (768px+ even in portrait) never
 * hits that breakpoint and always gets the big sidebar. */

.app-nav {
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--nav-width);
  overflow-y: auto;
  z-index: 10;
}

.nav-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px 14px;
  gap: 20px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--color-text);
  padding: 0 8px;
}

.brand-logo {
  height: 44px;
  width: auto;
  display: block;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-links a.nav-link {
  text-decoration: none;
  color: var(--color-text-muted);
  padding: 18px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 19px;
}

.nav-links a.nav-link:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.nav-links a.nav-link.active {
  background: var(--color-primary);
  color: #fff;
}

.nav-user {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 8px 4px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.nav-username {
  font-weight: 600;
  font-size: 15px;
  color: var(--color-text);
}

.nav-user button {
  width: 100%;
  padding: 12px;
  font-size: 15px;
}

@media (max-width: 720px) {
  .app-nav {
    position: sticky;
    top: 0;
    left: auto;
    bottom: auto;
    width: auto;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }

  .nav-inner {
    flex-direction: row;
    align-items: center;
    height: 56px;
    padding: 0 16px;
    gap: 16px;
  }

  .nav-brand {
    padding: 0;
  }

  .brand-logo {
    height: 32px;
  }

  .nav-links {
    flex-direction: row;
    flex: 1;
  }

  .nav-links a.nav-link {
    padding: 8px 12px;
    font-size: 14px;
  }

  .nav-user {
    flex-direction: row;
    align-items: center;
    border-top: none;
    padding: 0;
  }

  .nav-user button {
    width: auto;
    padding: 7px 14px;
    font-size: 14px;
  }
}

/* ---------------------------------------------------------------------- */
/* Page layout */
/* ---------------------------------------------------------------------- */

.page {
  max-width: 1100px;
  margin: 0 0 0 var(--nav-width);
  padding: 24px 24px 64px;
}

@media (max-width: 720px) {
  .page {
    margin-left: 0;
  }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 20px;
  margin: 0;
}

.page-header .meta {
  color: var(--color-text-muted);
  font-size: 13px;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 15px;
  margin: 0 0 12px;
  color: var(--color-text);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.report-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 720px) {
  .report-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

.report-stat {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.report-stat .report-stat-label {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.report-stat .report-stat-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text);
}

/* ---------------------------------------------------------------------- */
/* Buttons */
/* ---------------------------------------------------------------------- */

button,
.btn {
  font: inherit;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 7px 14px;
  cursor: pointer;
  font-weight: 500;
  background: var(--color-bg);
  color: var(--color-text);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

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

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

.btn-danger:hover:not(:disabled) {
  background: var(--color-danger);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: var(--color-border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-bg);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 13px;
}

/* ---------------------------------------------------------------------- */
/* Tables */
/* ---------------------------------------------------------------------- */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

th {
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

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

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------------- */
/* Status badges */
/* ---------------------------------------------------------------------- */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-pending {
  background: #fdf1d8;
  color: var(--color-warning);
}

.badge-progress {
  background: #e2f0fb;
  color: #1a6fa8;
}

.badge-finished {
  background: #e6f4ea;
  color: var(--color-success);
}

.usage-over {
  color: var(--color-danger);
  font-weight: 600;
}

.usage-ok {
  color: var(--color-success);
  font-weight: 600;
}

/* ---------------------------------------------------------------------- */
/* Forms */
/* ---------------------------------------------------------------------- */

form .field {
  margin-bottom: 14px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--color-text-muted);
}

input:not([type="radio"]):not([type="checkbox"]),
select,
textarea {
  font: inherit;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--color-text);
}

input[type="radio"],
input[type="checkbox"] {
  width: auto;
  padding: 0;
  border: none;
  accent-color: var(--color-primary);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: -1px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

/* Reports page's From/To date + Fetch button row - three columns instead
 * of .form-row's default two, since a single-day report is just from=to
 * rather than needing a whole separate layout. */
.report-date-row {
  align-items: end;
  grid-template-columns: 200px 200px auto;
}

@media (max-width: 720px) {
  .report-date-row {
    grid-template-columns: 1fr;
  }
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ---------------------------------------------------------------------- */
/* Messages / empty states */
/* ---------------------------------------------------------------------- */

.msg {
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 14px;
}

.msg-error {
  background: #fbeae6;
  color: var(--color-danger-dark);
}

.msg-success {
  background: #e6f4ea;
  color: var(--color-success);
}

.empty-state {
  color: var(--color-text-muted);
  font-size: 14px;
  padding: 12px 0;
}

/* ---------------------------------------------------------------------- */
/* Login page */
/* ---------------------------------------------------------------------- */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
}

.login-card h1 {
  font-size: 18px;
  text-align: center;
  margin: 0 0 24px;
}

.login-logo {
  display: block;
  margin: 0 auto 16px;
  height: 84px;
  width: auto;
}

/* ---------------------------------------------------------------------- */
/* Modal (used for the Add Order form) */
/* ---------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 43, 48, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  z-index: 100;
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 480px;
  padding: 24px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

.modal h2 {
  margin-top: 0;
}

.hidden {
  display: none !important;
}
