/**
 * West Bethel Motel - Brand Theme
 * Professional motel branding with Maine mountain aesthetic
 */

:root {
  /* Brand Colors - Maine Natural Tones */
  --motel-primary: #2c5f2d;        /* Forest Green */
  --motel-secondary: #2d6a7c;      /* Mountain Blue (WCAG AA compliant: 5.3:1 contrast) */
  --motel-accent: #b45309;         /* Warm Amber (WCAG AA compliant: 4.6:1 contrast) */
  --motel-warm-wood: #6b5233;      /* Warm Wood (WCAG AA compliant: 6.1:1 contrast) */

  /* Neutrals */
  --motel-white: #ffffff;
  --motel-cream: #faf8f5;
  --motel-gray-50: #f9fafb;
  --motel-gray-100: #f3f4f6;
  --motel-gray-200: #e5e7eb;
  --motel-gray-300: #d1d5db;
  --motel-gray-400: #9ca3af;
  --motel-gray-500: #6b7280;
  --motel-gray-600: #4b5563;
  --motel-gray-700: #374151;
  --motel-gray-800: #1f2937;
  --motel-gray-900: #111827;

  /* Semantic Colors */
  --motel-success: #10b981;
  --motel-warning: #f59e0b;
  --motel-error: #ef4444;
  --motel-info: var(--motel-secondary);

  /* Typography */
  --font-display: 'Georgia', 'Times New Roman', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Courier New', Courier, monospace;

  /* Spacing Scale */
  --space-xs: 0.25rem;    /* 4px */
  --space-sm: 0.5rem;     /* 8px */
  --space-md: 1rem;       /* 16px */
  --space-lg: 1.5rem;     /* 24px */
  --space-xl: 2rem;       /* 32px */
  --space-2xl: 3rem;      /* 48px */
  --space-3xl: 4rem;      /* 64px */
  --space-4xl: 6rem;      /* 96px */

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 250ms ease-in-out;
  --transition-slow: 350ms ease-in-out;
}

/* Base Styles */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--motel-gray-800);
  background: var(--motel-cream);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  color: var(--motel-gray-900);
  margin-top: 0;
}

h1 { font-size: 3rem; margin-bottom: var(--space-xl); }
h2 { font-size: 2.25rem; margin-bottom: var(--space-lg); }
h3 { font-size: 1.875rem; margin-bottom: var(--space-md); }
h4 { font-size: 1.5rem; margin-bottom: var(--space-md); }
h5 { font-size: 1.25rem; margin-bottom: var(--space-sm); }
h6 { font-size: 1.125rem; margin-bottom: var(--space-sm); }

p {
  margin-top: 0;
  margin-bottom: var(--space-md);
}

a {
  color: var(--motel-secondary);
  text-decoration: underline;  /* WCAG: Links must be distinguishable by more than color */
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--motel-primary);
  text-decoration: underline;
}

/* Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

.container-wide {
  width: 100%;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.btn-primary {
  background: var(--motel-primary);
  color: var(--motel-white);
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  background: #234d24;
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
}

.btn-secondary {
  background: var(--motel-white);
  color: var(--motel-primary);
  border: 2px solid var(--motel-primary);
}

.btn-secondary:hover {
  background: var(--motel-primary);
  color: var(--motel-white);
  text-decoration: none;
}

.btn-accent {
  background: var(--motel-accent);
  color: var(--motel-white);
  box-shadow: var(--shadow-md);
}

.btn-accent:hover {
  background: #b45309;
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
}

.btn-lg {
  padding: var(--space-lg) var(--space-2xl);
  font-size: 1.125rem;
}

/* ============================================
   ACCESSIBILITY - Focus Indicators (WCAG 2.1 AA - 2.4.7)
   ============================================ */

/* Button focus states */
.btn:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-accent:focus-visible {
  outline: 3px solid var(--motel-accent);
  outline-offset: 2px;
}

/* Form input focus states */
.form-input:focus-visible,
.form-select:focus-visible {
  outline: 3px solid var(--motel-primary);
  outline-offset: 2px;
}

/* Link focus states */
a:focus-visible {
  outline: 3px solid var(--motel-secondary);
  outline-offset: 2px;
  text-decoration: underline;
}

/* Modal close button */
#modal-close:focus-visible {
  outline: 3px solid var(--motel-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Room card focus-within state */
.room-card:focus-within {
  outline: 3px solid var(--motel-primary);
  outline-offset: 2px;
}

/* Checkbox and radio focus */
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
  outline: 3px solid var(--motel-primary);
  outline-offset: 2px;
}

/* Cards */
.card {
  background: var(--motel-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-xl);
  transition: all var(--transition-base);
}

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

/* Sticky Bar (Booking Summary) */
.sticky-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--motel-white);
  border-top: 2px solid var(--motel-primary);
  box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1), 0 -2px 4px -1px rgba(0, 0, 0, 0.06);
  padding: var(--space-lg) 0;
  z-index: 1000;
  transition: all var(--transition-base);
}

.sticky-bar.hidden {
  display: none;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-md);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--motel-gray-100);
  color: var(--motel-gray-700);
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background: #fed7aa;
  color: #92400e;
}

.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

/* Grid Utilities */
.grid {
  display: grid;
  gap: var(--space-xl);
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* Flex Utilities */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* Spacing Utilities */
.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

.py-sm { padding-top: var(--space-sm); padding-bottom: var(--space-sm); }
.py-md { padding-top: var(--space-md); padding-bottom: var(--space-md); }
.py-lg { padding-top: var(--space-lg); padding-bottom: var(--space-lg); }
.py-xl { padding-top: var(--space-xl); padding-bottom: var(--space-xl); }
.py-2xl { padding-top: var(--space-2xl); padding-bottom: var(--space-2xl); }
.py-3xl { padding-top: var(--space-3xl); padding-bottom: var(--space-3xl); }

/* Text Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-primary { color: var(--motel-primary); }
.text-secondary { color: var(--motel-secondary); }
.text-accent { color: var(--motel-accent); }
.text-gray-600 { color: var(--motel-gray-600); }
.text-gray-700 { color: var(--motel-gray-700); }

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--motel-primary);
  box-shadow: var(--shadow-md);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--motel-white);
  text-decoration: none;
  font-weight: 600;
}

.site-logo:hover {
  text-decoration: none;
  opacity: 0.9;
}

.site-logo img {
  height: 50px;
  width: auto;
}

.nav-menu {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--space-xl);
}

.nav-menu li {
  margin: 0;
}

.nav-menu a {
  color: var(--motel-white);
  text-decoration: none;
  font-weight: 500;
  padding: var(--space-sm) 0;
  transition: opacity var(--transition-fast);
}

.nav-menu a:hover {
  opacity: 0.8;
  text-decoration: none;
}

.nav-menu a.active {
  border-bottom: 2px solid var(--motel-white);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.nav-phone {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--motel-white);
  text-decoration: none;
  font-weight: 500;
  transition: opacity var(--transition-fast);
}

.nav-phone:hover {
  opacity: 0.8;
  text-decoration: none;
}

.nav-phone svg {
  width: 1.25rem;
  height: 1.25rem;
}

.nav-phone-text {
  display: none;
}

/* Footer */
.footer,
.site-footer {
  background: var(--motel-gray-900);
  color: var(--motel-gray-300);
  padding: var(--space-3xl) 0 var(--space-xl);
}

.footer-content,
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-2xl);
  margin-bottom: var(--space-2xl);
}

.footer-section h3,
.footer-section h4 {
  color: var(--motel-white);
  font-size: 1.125rem;
  margin-bottom: var(--space-md);
}

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

.footer-links li {
  margin-bottom: var(--space-sm);
}

.footer-links a {
  color: var(--motel-gray-300);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--motel-white);
  text-decoration: none;
}

/* WCAG 2.1 AA: Ensure ALL footer links have sufficient contrast (4.5:1 minimum) */
/* This covers tel:, mailto:, and other links not in .footer-links */
.footer a,
.site-footer a {
  color: var(--motel-gray-300); /* #d1d5db on #111827 = 10.9:1 contrast ratio */
}

.footer a:hover,
.site-footer a:hover {
  color: var(--motel-white);
}

.footer-bottom {
  border-top: 1px solid var(--motel-gray-700);
  padding-top: var(--space-lg);
  text-align: center;
  font-size: 0.875rem;
}

.footer-powered {
  margin-top: var(--space-sm);
  color: var(--motel-gray-400);
}

.footer-powered a {
  color: var(--motel-gray-300);
}

/* Responsive Design */
@media (min-width: 640px) {
  .nav-phone-text {
    display: inline;
  }
}

@media (min-width: 768px) {
  .nav-menu {
    display: flex;
  }
}

@media (max-width: 768px) {
  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.875rem; }
  h3 { font-size: 1.5rem; }

  .container,
  .container-wide {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  h1 { font-size: 1.875rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }

  .btn {
    padding: var(--space-sm) var(--space-lg);
    font-size: 0.9375rem;
  }
}

/* =============================================
   Mobile Form Input Fix - Prevent iOS Auto-Zoom
   iOS Safari auto-zooms when input font-size < 16px
   ============================================= */

/* Base form input styles - ensure 16px minimum on all devices */
input,
select,
textarea,
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
  font-size: 16px !important;
  font-size: max(16px, 1rem) !important;
}

/* Mobile-specific overrides */
@media screen and (max-width: 768px) {
  /* Ensure all form elements are at least 16px on mobile */
  input,
  select,
  textarea,
  button,
  .form-control,
  .form-input,
  [type="text"],
  [type="email"],
  [type="tel"],
  [type="number"],
  [type="password"],
  [type="search"],
  [type="url"],
  [type="date"],
  [type="time"],
  [type="datetime-local"] {
    font-size: 16px !important;
    /* Prevent zoom on focus in iOS Safari */
    -webkit-text-size-adjust: 100%;
  }

  /* Labels should also be readable */
  label,
  .form-label {
    font-size: 14px;
    font-size: max(14px, 0.875rem);
  }

  /* Ensure touch targets are large enough (44px minimum) */
  input,
  select,
  textarea,
  button {
    min-height: 44px;
    padding: 12px;
  }

  /* Date inputs need special handling */
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"] {
    min-height: 44px;
    padding: 10px 12px;
  }
}

/* iOS Safari specific fix */
@supports (-webkit-touch-callout: none) {
  input,
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* Placeholder text should also be readable */
::placeholder {
  font-size: inherit;
  opacity: 0.7;
}

/* Ensure select dropdowns are readable */
select option {
  font-size: 16px;
}

/* =============================================
   Booking Page Custom Classes
   ============================================= */

/* Container with custom max-width */
.container-custom {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

@media (min-width: 1280px) {
  .container-custom {
    max-width: 1280px;
  }
}

@media (min-width: 1536px) {
  .container-custom {
    max-width: 1400px;
  }
}

/* Form Input Styles */
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--motel-gray-700);
  margin-bottom: var(--space-sm);
}

.form-input,
.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--motel-gray-900);
  background-color: var(--motel-white);
  border: 2px solid var(--motel-gray-300);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--motel-primary);
  box-shadow: 0 0 0 3px rgba(44, 95, 79, 0.1);
}

.form-helper {
  font-size: 0.75rem;
  color: var(--motel-gray-600); /* WCAG 2.1 AA contrast fix: gray-600 = 7.0:1 ratio */
  margin-top: var(--space-xs);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  padding: var(--space-md);
  /* Display controlled by .hidden class */
}

/* Only show flex layout when modal is visible (not hidden) */
.modal-overlay:not(.hidden) {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ensure .hidden class takes precedence */
.modal-overlay.hidden {
  display: none !important;
}

.modal-content {
  background-color: var(--motel-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  z-index: 9999;
}

/* Room Card Specific */
.room-card {
  transition: all var(--transition-base);
}

.room-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Amenity Tags */
.amenity-tag {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  background-color: var(--motel-gray-100);
  color: var(--motel-gray-800); /* WCAG 2.1 AA contrast fix: gray-800 = 7.5:1 ratio */
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
}

/* Price Total */
.price-total {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--motel-primary);
}

/* Status Badges */
.status-available {
  background-color: var(--motel-success);
  color: var(--motel-white);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.status-booked {
  background-color: var(--motel-error);
  color: var(--motel-white);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

/* Spinner */
.spinner {
  border: 3px solid var(--motel-gray-200);
  border-top-color: var(--motel-primary);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Custom Motel Blue Color */
.bg-motel-blue-500 {
  background-color: var(--motel-secondary);
}

.text-motel-blue-500 {
  color: var(--motel-secondary);
}

/* Screen Reader Only (for accessibility) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* =============================================
   Desktop Enhancements (1024px+)
   ============================================= */

@media (min-width: 1024px) {
  /* Larger headings on desktop */
  h1 { font-size: 3.5rem; }
  h2 { font-size: 2.5rem; }

  /* Sticky bar better layout on desktop */
  .sticky-bar {
    padding: var(--space-xl) 0;
  }

  /* Room cards max width on ultra-wide screens */
  .room-card {
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
  }

  /* Modal larger on desktop */
  .modal-content {
    max-width: 700px;
  }
}

/* =============================================
   Ultra-Wide Enhancements (1280px+)
   ============================================= */

@media (min-width: 1280px) {
  /* Constrain content width on ultra-wide screens */
  .container-custom {
    padding-left: var(--space-xl);
    padding-right: var(--space-xl);
  }

  /* Larger text for readability */
  body {
    font-size: 18px;
  }
}

/* =============================================
   Mobile Touch Target Improvements
   ============================================= */

/* Ensure buttons meet WCAG 2.1 Level AA touch target size (44x44px minimum) */
.btn,
.btn-primary,
.btn-secondary,
.btn-accent {
  min-height: 44px;
  min-width: 44px;
  /* Add touch-action for better mobile responsiveness */
  touch-action: manipulation;
  /* Prevent text selection on double-tap */
  -webkit-user-select: none;
  user-select: none;
  /* Remove tap highlight on mobile */
  -webkit-tap-highlight-color: transparent;
}

/* Larger buttons on mobile for better touch */
@media (max-width: 768px) {
  .btn,
  .btn-primary,
  .btn-secondary {
    min-height: 48px;
    font-size: 1rem;
  }
}
