/* ReserveMe - Beautiful Pico CSS Theme
   Working WITH Pico CSS, not against it
   Using warm, cohesive color palette */

/* ============================================================================
   Light Theme - Warm & Professional
   ============================================================================ */
:root {
  /* Brand Colors - Warm Coral Primary */
  --pico-primary: #f7a5a5;
  --pico-primary-hover: #f49090;
  --pico-primary-background: #f7a5a5;
  --pico-primary-hover-background: #f49090;
  --pico-primary-focus: rgba(247, 165, 165, 0.125);
  --pico-primary-inverse: #ffffff;

  /* Secondary - Warm Peach for Accent Actions */
  --pico-secondary: #ffdbb6;
  --pico-secondary-hover: #ffd0a3;
  --pico-secondary-background: #ffdbb6;
  --pico-secondary-hover-background: #ffd0a3;
  --pico-secondary-focus: rgba(255, 219, 182, 0.125);
  --pico-secondary-inverse: #5d688a;

  /* Contrast - Warm Slate for Special Elements */
  --pico-contrast: #5d688a;
  --pico-contrast-hover: #4a5574;
  --pico-contrast-background: #5d688a;
  --pico-contrast-hover-background: #4a5574;
  --pico-contrast-focus: rgba(93, 104, 138, 0.125);
  --pico-contrast-inverse: #ffffff;

  /* Beautiful Backgrounds */
  --pico-background-color: #ffffff;
  --pico-card-background-color: #fafaf9;
  --pico-card-sectionning-background-color: #fff2ef; /* Warm blush for sections */
  --pico-dropdown-background-color: #ffffff;
  --pico-dropdown-border-color: #ebe9e7;
  --pico-modal-overlay-background-color: rgba(93, 104, 138, 0.4);

  /* Text Hierarchy for WCAG AAA */
  --pico-color: #1f1b17;
  --pico-h1-color: #1f1b17;
  --pico-h2-color: #342e29;
  --pico-h3-color: #4d453e;
  --pico-h4-color: #4d453e;
  --pico-h5-color: #4d453e;
  --pico-h6-color: #4d453e;
  --pico-muted-color: #6b635b;

  /* Links - Warm Coral */
  --pico-link: #f7a5a5;
  --pico-link-hover: #f49090;
  --pico-link-visited: #f7a5a5;

  /* Borders & Dividers */
  --pico-border-color: #ebe9e7;
  --pico-table-border-color: #ebe9e7;

  /* Forms - Clean & Accessible */
  --pico-form-element-background-color: #ffffff;
  --pico-form-element-border-color: #ddd9d5;
  --pico-form-element-active-border-color: #f7a5a5;
  --pico-form-element-focus-color: rgba(247, 165, 165, 0.125);
  --pico-form-element-disabled-background-color: #f5f4f3;
  --pico-form-element-disabled-border-color: #ebe9e7;
  --pico-form-element-disabled-opacity: 0.5;
  --pico-form-element-invalid-border-color: #d98a8a;
  --pico-form-element-valid-border-color: #7fa08c;

  /* Switch/Toggle */
  --pico-switch-background-color: #b5afa8;
  --pico-switch-checked-background-color: #f7a5a5;
  --pico-switch-color: #ffffff;

  /* Spacing & Typography */
  --pico-border-radius: 0.5rem;
  --pico-font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --pico-font-weight: 400;
  --pico-line-height: 1.6;
  --pico-font-size: 16px;

  /* Semantic Colors */
  --pico-ins-color: #7fa08c;
  --pico-del-color: #d98a8a;
  --pico-mark-background-color: #ffdbb6;
  --pico-mark-color: #5d688a;
  --pico-code-background-color: #fff2ef;
  --pico-code-color: #5d688a;
  --pico-kbd-background-color: #5d688a;
  --pico-kbd-color: #ffffff;

  /* Navigation Specific */
  --pico-nav-background-color: #ffffff;
  --pico-nav-border-color: #ebe9e7;
  --pico-nav-breadcrumb-divider: '›';
  --pico-nav-link-spacing-vertical: 1rem;
  --pico-nav-link-spacing-horizontal: 0.5rem;
}

/* ============================================================================
   Dark Theme - Inverted Warm Palette
   ============================================================================ */
[data-theme='dark'] {
  /* Keep Coral Primary in Dark for consistency */
  --pico-primary: #f7a5a5;
  --pico-primary-hover: #ffb3b3;
  --pico-primary-background: #f7a5a5;
  --pico-primary-hover-background: #ffb3b3;
  --pico-primary-focus: rgba(247, 165, 165, 0.125);
  --pico-primary-inverse: #1f1b17;

  /* Peach Secondary in Dark */
  --pico-secondary: #ffdbb6;
  --pico-secondary-hover: #ffe5ca;
  --pico-secondary-background: #ffdbb6;
  --pico-secondary-hover-background: #ffe5ca;
  --pico-secondary-focus: rgba(255, 219, 182, 0.125);
  --pico-secondary-inverse: #1f1b17;

  /* Slate for Contrast */
  --pico-contrast: #5d688a;
  --pico-contrast-hover: #6d78a0;
  --pico-contrast-background: #5d688a;
  --pico-contrast-hover-background: #6d78a0;
  --pico-contrast-focus: rgba(93, 104, 138, 0.125);
  --pico-contrast-inverse: #ffffff;

  /* Rich Dark Backgrounds */
  --pico-background-color: #1f1b17;
  --pico-card-background-color: #2a2520;
  --pico-card-sectionning-background-color: #342e29;
  --pico-dropdown-background-color: #2a2520;
  --pico-dropdown-border-color: #3a342f;
  --pico-modal-overlay-background-color: rgba(0, 0, 0, 0.7);

  /* Light Text for Dark Mode */
  --pico-color: #f5f4f3;
  --pico-h1-color: #ffffff;
  --pico-h2-color: #f5f4f3;
  --pico-h3-color: #ebe9e7;
  --pico-h4-color: #ebe9e7;
  --pico-h5-color: #ebe9e7;
  --pico-h6-color: #ebe9e7;
  --pico-muted-color: #b5afa8;

  /* Warm Links in Dark */
  --pico-link: #f7a5a5;
  --pico-link-hover: #ffb3b3;
  --pico-link-visited: #f49090;

  /* Subtle Dark Borders */
  --pico-border-color: #3a342f;
  --pico-table-border-color: #3a342f;

  /* Dark Forms */
  --pico-form-element-background-color: #2a2520;
  --pico-form-element-border-color: #3a342f;
  --pico-form-element-active-border-color: #f7a5a5;
  --pico-form-element-focus-color: rgba(247, 165, 165, 0.125);
  --pico-form-element-disabled-background-color: #1f1b17;
  --pico-form-element-disabled-border-color: #342e29;
  --pico-form-element-invalid-border-color: #d98a8a;
  --pico-form-element-valid-border-color: #7fa08c;

  /* Dark Switch/Toggle */
  --pico-switch-background-color: #4d453e;
  --pico-switch-checked-background-color: #f7a5a5;
  --pico-switch-color: #1f1b17;

  /* Semantic Colors for Dark */
  --pico-ins-color: #7fa08c;
  --pico-del-color: #d98a8a;
  --pico-mark-background-color: rgba(255, 219, 182, 0.2);
  --pico-mark-color: #ffdbb6;
  --pico-code-background-color: #2a2520;
  --pico-code-color: #ffdbb6;
  --pico-kbd-background-color: #f5f4f3;
  --pico-kbd-color: #1f1b17;

  /* Dark Navigation */
  --pico-nav-background-color: #1f1b17;
  --pico-nav-border-color: #3a342f;
}

/* ============================================================================
   Minimal Custom Utilities
   ============================================================================ */

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Error text styling */
.error-text {
  color: var(--pico-color-red-550);
}

/* Footer styling - uses Pico's section background */
footer {
  background-color: var(--pico-card-sectionning-background-color);
  border-top: 1px solid var(--pico-border-color);
}

/* Hero section styling */
.hero {
  background-color: var(--pico-card-sectionning-background-color);
  padding: 3rem 0;
  border-radius: var(--pico-border-radius);
  text-align: center;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.125rem;
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* User avatar in navigation */
.user-avatar {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.avatar-circle {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background-color: #f7a5a5;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
}

.username {
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Footer layout */
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--pico-border-color);
}

/* Theme switch */
.theme-switch-footer {
  display: flex;
  align-items: center;
}

/* Card enhancements */
.card {
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

.card-body {
  flex-grow: 1;
  padding: 1.5rem;
}

.card-footer {
  margin-top: auto;
  padding: 1rem 1.5rem;
  background-color: var(--pico-card-background-color);
  border-top: 1px solid var(--pico-border-color);
}

/* Button groups */
.cta-group {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================================
   HTMX Transitions & Animations
   ============================================================================ */

/* Smooth transitions for HTMX partial swaps */
.htmx-swapping {
  opacity: 0;
  transition: opacity 200ms ease-out;
}

.htmx-settling {
  opacity: 1;
  transition: opacity 200ms ease-in;
}

/* HTMX progress bar */
.htmx-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #f7a5a5 0%, #ffdbb6 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms ease;
  z-index: 9999;
}

.htmx-request .htmx-progress {
  transform: scaleX(1);
  animation: progress 2s ease-in-out infinite;
}

/* Utility classes for visibility */
.htmx-hidden {
  display: none !important;
}

.htmx-visible {
  display: block !important;
}

/* Fade animations */
.fade-in {
  animation: fadeIn 200ms ease-in;
}

.fade-out {
  animation: fadeOut 200ms ease-out;
}

/* Alert notifications */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--pico-border-radius);
  margin-bottom: 1rem;
  position: relative;
  border-left: 4px solid;
  animation: slideDown 200ms ease-out;
}

.alert-success {
  background-color: rgba(127, 160, 140, 0.1);
  color: #7fa08c;
  border-left-color: #7fa08c;
}

.alert-error {
  background-color: rgba(217, 138, 138, 0.1);
  color: #d98a8a;
  border-left-color: #d98a8a;
}

.alert-warning {
  background-color: rgba(232, 184, 139, 0.1);
  color: #e8b88b;
  border-left-color: #e8b88b;
}

.alert-info {
  background-color: rgba(247, 165, 165, 0.1);
  color: #f7a5a5;
  border-left-color: #f7a5a5;
}

/* Dark mode alert styles */
[data-theme='dark'] .alert-success {
  background-color: rgba(127, 160, 140, 0.15);
}

[data-theme='dark'] .alert-error {
  background-color: rgba(217, 138, 138, 0.15);
}

[data-theme='dark'] .alert-warning {
  background-color: rgba(232, 184, 139, 0.15);
}

[data-theme='dark'] .alert-info {
  background-color: rgba(247, 165, 165, 0.15);
}

/* Animation keyframes */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes progress {
  0% {
    transform: scaleX(0);
  }
  50% {
    transform: scaleX(0.5);
  }
  100% {
    transform: scaleX(1);
  }
}

/* Step cards styling - only target headers with mark elements */
article header:has(mark) {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

article header mark {
  background-color: transparent;
  color: var(--pico-primary);
  font-size: 1.75rem;
  font-weight: bold;
  padding: 0;
  margin: 0;
  line-height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 1.75rem;
}

article header:has(mark) svg {
  color: var(--pico-primary);
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
}

/* Feature cards - icon and text on same line */
article.card header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

article.card header svg {
  color: var(--pico-primary);
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
}

article.card header h3 {
  margin: 0;
  line-height: 1.2;
}

/* Responsive utilities */
@media (max-width: 768px) {
  .username {
    display: none;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .hide-mobile {
    display: none !important;
  }

  /* Fix dropdown menu overflow on mobile */
  details.dropdown[open] ul {
    right: 0;
    left: auto;
    min-width: 200px;
    transform: translateX(0);
  }
}

@media (min-width: 769px) {
  .show-mobile {
    display: none !important;
  }
}

/* ============================================================================
   OR Divider for Login Form
   ============================================================================ */
.or-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.5rem 0;
  position: relative;
}

.or-divider::before,
.or-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--pico-muted-border-color);
  opacity: 0.5;
}

.or-divider span {
  padding: 0 1rem;
  color: var(--pico-muted-color);
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--pico-background-color);
}

/* Dark mode adjustment for OR divider */
[data-theme='dark'] .or-divider span {
  background: var(--pico-background-color);
}

/* Help text styling */
.help-text {
  color: var(--pico-muted-color);
  font-style: italic;
  text-align: center;
  display: block;
  margin-top: 1rem;
}

/* ============================================================================
   Legal Document Dialogs
   ============================================================================ */

dialog:not([open]) {
  display: none;
}

dialog {
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.4s ease-out,
    overlay 0.4s allow-discrete,
    display 0.4s allow-discrete;
}

dialog[open] {
  opacity: 1;
  pointer-events: auto;

  @starting-style {
    opacity: 0;
  }
}

.legal-dialog-content {
  max-width: 600px;
  max-height: 90dvh;
  border-radius: var(--pico-border-radius);
  opacity: 0;
  transition:
    opacity 0.4s ease-out,
    transform 0.2s ease-out;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

dialog[open] .legal-dialog-content {
  opacity: 1;
  transform: translateY(0);

  @starting-style {
    opacity: 0;
    transform: translateY(100vh);
  }
}

dialog:not([open]) .legal-dialog-content {
  transform: translateY(100vh);
}

.legal-dialog-content > section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.legal-dialog-content > section > article {
  margin-bottom: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.legal-dialog-content article header {
  flex-shrink: 0;
  text-align: center;
  padding: 1.5rem;
  padding-bottom: 1rem;
  margin-bottom: 0;
}

.legal-dialog-content .scrollable-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 0 1.5rem;
}

.legal-dialog-content article footer {
  flex-shrink: 0;
  padding: 1.5rem;
  padding-top: 1rem;
  margin-top: 0;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition:
    opacity 0.4s ease-out,
    overlay 0.4s allow-discrete,
    display 0.4s allow-discrete;
}

dialog[open]::backdrop {
  opacity: 1;

  @starting-style {
    opacity: 0;
  }
}

@media (max-width: 768px) {
  .legal-dialog-content {
    max-width: 95vw;
  }
}

/* ============================================================================
   Button Styled as Link
   ============================================================================ */
.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--pico-primary);
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
}

.link-button:hover {
  color: var(--pico-primary-hover);
  text-decoration: underline;
}

.link-button:focus {
  outline: 2px solid var(--pico-primary-focus);
  outline-offset: 2px;
}
