/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --brand:        #4f46e5;
  --brand-dark:   #4338ca;
  --brand-light:  #ede9fe;
  --nav-bg:       #1e1b4b;
  --nav-text:     #c7d2fe;
  --nav-text-hover: #ffffff;
  --surface:      #ffffff;
  --surface-alt:  #f5f7ff;
  --border:       #e2e8f0;
  --text-1:       #1e293b;
  --text-2:       #64748b;
  --text-3:       #94a3b8;
  --radius:       8px;
  --shadow-sm:    0 1px 3px rgba(0, 0, 0, .08);
  --shadow-md:    0 4px 16px rgba(0, 0, 0, .10);
}

/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-1);
  background: var(--surface-alt);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Navigation ────────────────────────────────────────────── */
nav {
  background: var(--nav-bg);
  color: var(--nav-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .875rem 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -.01em;
  flex-shrink: 0;
}

.brand svg {
  flex-shrink: 0;
  opacity: .9;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex-wrap: wrap;
}

.nav-links a,
.nav-links .nav-btn {
  color: var(--nav-text);
  text-decoration: none;
  padding: .35rem .7rem;
  border-radius: 6px;
  font-size: .9rem;
  transition: background .15s, color .15s;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
}

.nav-links a:hover,
.nav-links .nav-btn:hover {
  background: rgba(255, 255, 255, .1);
  color: var(--nav-text-hover);
}

.nav-links .nav-btn {
  font-size: .9rem;
}

/* Avatar dropdown */
.user-menu { position: relative; }

.avatar-btn {
  display: flex;
  align-items: center;
  cursor: pointer;
  list-style: none;
}
.avatar-btn::-webkit-details-marker { display: none; }

.avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  font-weight: 600;
  user-select: none;
  border: 2px solid rgba(255, 255, 255, .2);
  transition: border-color .15s;
}
.avatar-btn:hover .avatar-circle { border-color: rgba(255, 255, 255, .5); }

.user-dropdown {
  display: none;
  flex-direction: column;
  position: absolute;
  right: 0;
  top: calc(100% + .5rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  z-index: 100;
  overflow: hidden;
}

.user-menu[open] .user-dropdown { display: flex; }

.user-dropdown-name {
  padding: .65rem 1rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.user-dropdown a,
.dropdown-logout {
  display: block;
  width: 100%;
  padding: .55rem 1rem;
  color: var(--text-1);
  text-decoration: none;
  font-size: .875rem;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background .12s;
}
.user-dropdown a:hover,
.dropdown-logout:hover { background: var(--surface-alt); }

/* Avatar icon picker (profile page) */
.avatar-picker { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }

.avatar-option { display: none; }

.avatar-option + label {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.avatar-option:checked + label,
.avatar-option + label:hover {
  border-color: var(--brand);
  background: var(--brand-light);
}

.avatar-option-none + label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-2);
  background: var(--surface-alt);
}

/* ── Flash messages ────────────────────────────────────────── */
.messages { padding: .75rem 2rem 0; }

.flash {
  padding: .65rem 1rem;
  margin-top: .5rem;
  border-radius: var(--radius);
  font-size: .9rem;
  border-width: 1px;
  border-style: solid;
}

.flash.info    { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.flash.error   { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.flash.success { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.flash.warning { background: #fef9c3; color: #854d0e; border-color: #fde047; }

/* ── Main content container ────────────────────────────────── */
main {
  flex: 1;
  max-width: 520px;
  width: 100%;
  margin: 2.5rem auto;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem 2.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

/* ── Typography ────────────────────────────────────────────── */
h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.25rem; color: var(--text-1); letter-spacing: -.02em; }
h2 { font-size: 1.1rem; font-weight: 600; margin: 1.5rem 0 .75rem; color: var(--text-1); }

/* ── Form elements ─────────────────────────────────────────── */
label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: .3rem;
  margin-top: .85rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .95rem;
  font-family: inherit;
  color: var(--text-1);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}

textarea { resize: vertical; min-height: 80px; }

button[type="submit"]:not(.btn-cancel):not(.btn-archive):not(.nav-btn) {
  margin-top: 1.25rem;
  width: 100%;
  padding: .65rem;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}

button[type="submit"]:not(.btn-cancel):not(.btn-archive):not(.nav-btn):hover { background: var(--brand-dark); }

.links {
  margin-top: 1rem;
  font-size: .875rem;
  color: var(--text-2);
}

.links a { color: var(--brand); text-decoration: none; }
.links a:hover { text-decoration: underline; }

/* ── Shared table styles ───────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

th {
  text-align: left;
  padding: .6rem 1rem;
  border-bottom: 2px solid var(--border);
  color: var(--text-2);
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-1);
}

tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-alt); }

/* ── Badges ────────────────────────────────────────────────── */
.category-badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 999px;
  background: var(--brand-light);
  color: #5b21b6;
  font-size: .78rem;
  font-weight: 500;
  white-space: nowrap;
}

.status-active {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: .78rem;
  font-weight: 500;
  white-space: nowrap;
}

.status-cancelled {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  font-size: .78rem;
  font-weight: 500;
  white-space: nowrap;
}

.status-other {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 999px;
  background: #f3f4f6;
  color: var(--text-2);
  font-size: .78rem;
  white-space: nowrap;
}

/* ── Shared buttons & action links ─────────────────────────── */
.btn-book {
  display: inline-block;
  padding: .4rem 1rem;
  background: var(--brand);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s;
}
.btn-book:hover { background: var(--brand-dark); }

.btn-cancel {
  padding: .35rem .8rem;
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: .82rem;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.btn-cancel:hover { background: #fecaca; }

.add-link {
  display: inline-block;
  margin-bottom: 1.25rem;
  padding: .5rem 1rem;
  background: var(--brand);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  transition: background .15s;
}
.add-link:hover { background: var(--brand-dark); }

.action-link {
  color: var(--brand);
  text-decoration: none;
  font-size: .875rem;
  margin-right: .75rem;
}
.action-link:hover { text-decoration: underline; }

.btn-archive {
  background: none;
  border: none;
  color: #991b1b;
  cursor: pointer;
  font-size: .875rem;
  font-family: inherit;
  padding: 0;
}
.btn-archive:hover { text-decoration: underline; }

/* ── Empty state ───────────────────────────────────────────── */
.empty {
  text-align: center;
  color: var(--text-3);
  padding: 2.5rem 0;
  font-size: .9rem;
}

/* ── New booking / back links ──────────────────────────────── */
.new-booking-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--brand);
  text-decoration: none;
  font-size: .9rem;
}
.new-booking-link:hover { text-decoration: underline; }

/* ── Footer ────────────────────────────────────────────────── */
footer {
  background: var(--nav-bg);
  color: var(--nav-text);
  padding: 3rem 2rem 0;
  margin-top: auto;
}

.footer-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.footer-brand .brand {
  font-size: 1rem;
  margin-bottom: .6rem;
  display: inline-flex;
}

.footer-brand p {
  font-size: .875rem;
  color: var(--text-3);
  line-height: 1.6;
  max-width: 260px;
}

.footer-col h4 {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #fff;
  margin-bottom: .85rem;
}

.footer-col a {
  display: block;
  color: var(--nav-text);
  text-decoration: none;
  font-size: .875rem;
  margin-bottom: .45rem;
  transition: color .15s;
}

.footer-col a:hover { color: #fff; }

.footer-bottom {
  max-width: 1140px;
  margin: 0 auto;
  padding: 1.25rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
}

.footer-bottom p {
  font-size: .8rem;
  color: var(--text-3);
}
