/**
 * WP Open Appointments - Frontend Styles
 * Modern, accessible appointment booking interface
 */

:root {
  --woa-primary: #3b82f6;
  --woa-primary-hover: #2563eb;
  --woa-success: #10b981;
  --woa-error: #ef4444;
  --woa-warning: #f59e0b;
  --woa-gray-50: #f9fafb;
  --woa-gray-100: #f3f4f6;
  --woa-gray-200: #e5e7eb;
  --woa-gray-300: #d1d5db;
  --woa-gray-400: #9ca3af;
  --woa-gray-500: #6b7280;
  --woa-gray-600: #4b5563;
  --woa-gray-700: #374151;
  --woa-gray-800: #1f2937;
  --woa-gray-900: #111827;
  --woa-radius: 0.5rem;
  --woa-radius-lg: 0.75rem;
  --woa-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --woa-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --woa-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --woa-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Widget Container */
.woa-widget {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  max-width: 800px;
  margin: 2rem auto;
  background: white;
  border-radius: var(--woa-radius-lg);
  box-shadow: var(--woa-shadow-lg);
  padding: 2rem;
  color: var(--woa-gray-900);
}

/* Loading State */
.woa-loading {
  text-align: center;
  padding: 3rem 1rem;
}

.woa-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 1rem;
  border: 4px solid var(--woa-gray-200);
  border-top-color: var(--woa-primary);
  border-radius: 50%;
  animation: woa-spin 0.8s linear infinite;
}

@keyframes woa-spin {
  to { transform: rotate(360deg); }
}

/* Card */
.woa-card {
  background: white;
  border: 1px solid var(--woa-gray-200);
  border-radius: var(--woa-radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.woa-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--woa-shadow-md);
  border-color: var(--woa-primary);
}

/* Buttons */
.woa-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: var(--woa-radius);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.woa-button-primary {
  background: var(--woa-primary);
  color: white;
}

.woa-button-primary:hover {
  background: var(--woa-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--woa-shadow);
}

.woa-button-secondary {
  background: var(--woa-gray-100);
  color: var(--woa-gray-700);
}

.woa-button-secondary:hover {
  background: var(--woa-gray-200);
}

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

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

.woa-label {
  display: block;
  font-weight: 500;
  color: var(--woa-gray-700);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.woa-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--woa-gray-300);
  border-radius: var(--woa-radius);
  transition: all 0.2s ease;
}

.woa-input:focus {
  outline: none;
  border-color: var(--woa-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.woa-input:disabled {
  background: var(--woa-gray-100);
  cursor: not-allowed;
}

/* Service Grid */
.woa-service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.woa-service-card {
  border-left: 4px solid var(--woa-primary);
}

.woa-service-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  color: var(--woa-gray-900);
}

.woa-service-duration {
  font-size: 0.875rem;
  color: var(--woa-gray-600);
}

.woa-service-price {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--woa-primary);
  margin-top: 0.5rem;
}

/* Time Slots */
.woa-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.woa-time-slot {
  padding: 0.75rem;
  text-align: center;
  border: 2px solid var(--woa-gray-200);
  border-radius: var(--woa-radius);
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.woa-time-slot:hover {
  border-color: var(--woa-primary);
  background: var(--woa-gray-50);
}

.woa-time-slot.selected {
  background: var(--woa-primary);
  border-color: var(--woa-primary);
  color: white;
}

.woa-time-slot:disabled {
  background: var(--woa-gray-100);
  color: var(--woa-gray-400);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Progress Bar */
.woa-progress {
  display: flex;
  align-items: center;
  margin-bottom: 2rem;
  justify-content: space-between;
}

.woa-progress-step {
  flex: 1;
  text-align: center;
  position: relative;
  padding: 1rem 0;
}

.woa-progress-step::before {
  content: '';
  position: absolute;
  top: 1.5rem;
  left: -50%;
  right: 50%;
  height: 2px;
  background: var(--woa-gray-200);
  z-index: -1;
}

.woa-progress-step:first-child::before {
  display: none;
}

.woa-progress-step.active {
  color: var(--woa-primary);
  font-weight: 600;
}

.woa-progress-step.completed::before {
  background: var(--woa-primary);
}

/* Status Badges */
.woa-status {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
}

.woa-status-pending {
  background: var(--woa-warning);
  color: white;
}

.woa-status-confirmed {
  background: var(--woa-success);
  color: white;
}

.woa-status-cancelled {
  background: var(--woa-error);
  color: white;
}

/* Confirmation */
.woa-confirmation {
  text-align: center;
  padding: 2rem;
}

.woa-confirmation-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 1rem;
  background: var(--woa-success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
}

.woa-confirmation h2 {
  margin: 0 0 1rem;
  color: var(--woa-gray-900);
}

.woa-confirmation-details {
  background: var(--woa-gray-50);
  border-radius: var(--woa-radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
  text-align: left;
}

/* Responsive */
@media (max-width: 768px) {
  .woa-widget {
    padding: 1rem;
    margin: 1rem;
  }

  .woa-service-grid {
    grid-template-columns: 1fr;
  }

  .woa-slots-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }

  .woa-progress {
    flex-direction: column;
  }

  .woa-progress-step::before {
    display: none;
  }
}

/* Dark Theme */
.woa-theme-dark {
  background: var(--woa-gray-900);
  color: var(--woa-gray-100);
}

.woa-theme-dark .woa-card {
  background: var(--woa-gray-800);
  border-color: var(--woa-gray-700);
  color: var(--woa-gray-100);
}

.woa-theme-dark .woa-input {
  background: var(--woa-gray-800);
  border-color: var(--woa-gray-700);
  color: var(--woa-gray-100);
}

/* 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;
}

/* Focus styles for accessibility */
*:focus-visible {
  outline: 2px solid var(--woa-primary);
  outline-offset: 2px;
}