* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--dark-text);
  background: var(--bg-grey);
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--navy);
  margin: 0 0 1rem;
  line-height: 1.25;
}

h1 {
  font-weight: 700;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Layout */
.page-wrapper {
  display: flex;
  flex-direction: column;
}

.content-container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.page-section {
  padding: 4rem 0;
}

@media (min-width: 768px) {
  .page-section {
    padding: 6rem 0;
  }
}

@media (min-width: 1024px) {
  .page-section {
    padding: 7rem 0;
  }
}

/* Footer */
.site-footer {
  background: var(--bg-grey);
  border-top: none;
  padding: 1.5rem 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--mid-grey);
}

.site-footer a {
  color: var(--blue);
  font-weight: 500;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* Navigation */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--border-grey);
  box-shadow: 0 2px 8px rgba(8, 47, 111, 0.04);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 1rem;
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--navy);
  min-width: 0;
}

.navbar-brand:hover {
  text-decoration: none;
}

.navbar-logo {
  height: 40px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.navbar-user {
  font-size: 0.9rem;
  color: var(--mid-grey);
  display: none;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .navbar-user {
    display: block;
  }

  .navbar-actions {
    gap: 1rem;
  }
}

@media (max-width: 640px) {
  .navbar-inner {
    height: auto;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .navbar-brand {
    font-size: 1.05rem;
    gap: 0.5rem;
    width: 100%;
  }

  .navbar-logo {
    height: 32px;
  }

  .navbar-actions {
    width: 100%;
    justify-content: flex-end;
    gap: 0.5rem;
  }

  .navbar-actions .btn-small {
    height: 36px;
    padding: 0 0.85rem;
    font-size: 0.85rem;
    white-space: nowrap;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 52px;
  padding: 0 1.5rem;
  border-radius: var(--radius-button);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.btn-primary:hover {
  background: var(--blue-hover);
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  color: var(--blue);
  border: 2px solid var(--blue);
}

.btn-secondary:hover {
  background: rgba(40, 112, 197, 0.06);
  text-decoration: none;
}

.btn-small {
  height: 40px;
  padding: 0 1rem;
  font-size: 0.9rem;
}

.btn-danger {
  color: #b91c1c;
  background: transparent;
  border: 2px solid #b91c1c;
}

.btn-danger:hover {
  background: rgba(185, 28, 28, 0.08);
  text-decoration: none;
}

/* Login page */
.login-page {
  min-height: 100vh;
  background: var(--gradient-brand);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}

.login-hero {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  height: 80px;
  width: auto;
  margin-bottom: 1rem;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}

.login-hero h1 {
  color: var(--white);
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.login-hero p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.1rem;
  margin: 0;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 2rem;
  width: 100%;
  max-width: 420px;
}

@media (min-width: 640px) {
  .login-card {
    padding: 2.5rem;
  }
}

.login-card h2 {
  color: var(--dark-text);
  margin-bottom: 0.25rem;
}

.login-subtitle {
  color: var(--mid-grey);
  margin: 0 0 1.5rem;
}

/* Forms */
.form-group {
  margin-bottom: 0.75rem;
}

.form-label {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--mid-grey);
  margin-bottom: 0.25rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border-grey);
  border-radius: var(--radius-input);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--dark-text);
  background: var(--white);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(40, 112, 197, 0.12);
}

.form-textarea {
  min-height: 72px;
  resize: vertical;
}

.form-error {
  color: #b91c1c;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.date-input-group {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.date-input-group .form-input {
  flex: 1;
}

.date-picker-inline {
  padding: 0.85rem 0.5rem;
  border: 1px solid var(--border-grey);
  border-radius: var(--radius-input);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--dark-text);
  background: var(--white);
  min-width: 130px;
}

.input-hint {
  font-size: 0.8rem;
  color: var(--mid-grey);
  margin: 0.35rem 0 0;
}

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1.25rem;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

@media (min-width: 640px) {
  .card {
    padding: 1.5rem;
  }
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.card-link:hover {
  text-decoration: none;
}

.card-link:hover .card {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-3px);
}

.card-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--dark-text);
  margin: 0 0 0.25rem;
}

.card-meta {
  color: var(--mid-grey);
  font-size: 0.95rem;
  margin: 0 0 0.75rem;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.card-progress {
  font-size: 0.85rem;
  color: var(--mid-grey);
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: capitalize;
}

.badge-planning {
  background: rgba(100, 116, 139, 0.12);
  color: var(--dark-text);
}

.badge-confirmed {
  background: rgba(53, 138, 174, 0.12);
  color: var(--secondary-blue);
}

.badge-completed {
  background: rgba(212, 175, 55, 0.15);
  color: #9a7b1a;
}

.badge-cancelled {
  background: rgba(185, 28, 28, 0.08);
  color: #b91c1c;
}

/* Dashboard */
.stats-section {
  padding: 2rem 0 1rem;
}

.stats-heading {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.stats-card {
  background: var(--white);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1.25rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
  border: 2px solid transparent;
}

.stats-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
  text-decoration: none;
}

.stats-card.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(40, 112, 197, 0.12), var(--shadow-card-hover);
}

.stats-card:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(40, 112, 197, 0.2);
}

.stats-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}

.stats-label {
  font-size: 0.9rem;
  color: var(--mid-grey);
  font-weight: 500;
}

.stats-card-planning .stats-value { color: var(--mid-grey); }
.stats-card-confirmed .stats-value { color: var(--secondary-blue); }
.stats-card-completed .stats-value { color: #9a7b1a; }
.stats-card-cancelled .stats-value { color: #b91c1c; }

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0;
  padding: 0.5rem;
  background: var(--white);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.category-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-button);
  font-weight: 500;
  color: var(--mid-grey);
  background: transparent;
  transition: all 0.2s ease;
}

.category-tab:hover {
  background: var(--bg-grey);
  color: var(--dark-text);
  text-decoration: none;
}

.category-tab.active {
  background: var(--blue);
  color: var(--white);
}

.category-tab-clear {
  margin-left: auto;
  color: var(--mid-grey);
  font-weight: 500;
}

.category-tab-clear:hover {
  color: #b91c1c;
  background: rgba(185, 28, 28, 0.06);
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.dashboard-list-section {
  padding: 1rem 0 3rem;
}

.empty-state {
  color: var(--mid-grey);
  font-size: 0.95rem;
  padding: 1rem 0;
}

.event-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .event-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Detail page */
.detail-layout {
  padding: 1.5rem 0 0.5rem;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.detail-header h1 {
  margin: 0;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.form-grid .form-group-full {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-grey);
  flex-wrap: wrap;
}

.success-message {
  color: var(--secondary-blue);
  font-weight: 500;
  font-size: 0.95rem;
}

/* History section */
.history-panel {
  margin-top: 1rem;
  padding: 1.25rem;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.history-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-grey);
  font-size: 0.9rem;
}

.history-item:last-child {
  border-bottom: none;
}

.history-field {
  font-weight: 500;
  color: var(--navy);
}

.history-change {
  color: var(--mid-grey);
  margin: 0.15rem 0;
}

.history-meta {
  font-size: 0.8rem;
  color: var(--mid-grey);
}

.history-empty {
  color: var(--mid-grey);
  font-size: 0.95rem;
}

.hidden {
  display: none;
}

/* Page header with add button */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.page-header h1 {
  margin: 0;
}
