/* HTMX Loading States and Animations */

/* Loading skeletons */
.loading-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite;
  border-radius: 8px;
  height: 100%;
  min-height: 200px;
}

@keyframes loading-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Service skeleton */
.service-skeleton {
  min-height: 300px;
  margin: 1rem;
  border-radius: 12px;
}

/* Team skeleton */
.team-skeleton {
  min-height: 350px;
  margin: 1rem;
  border-radius: 12px;
}

/* Testimonial skeleton */
.testimonial-skeleton {
  min-height: 250px;
  margin: 1rem;
  border-radius: 12px;
}

/* Stats loading */
.stats-loading {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.loading-card {
  position: relative;
  overflow: hidden;
}

.loading-card .loading-skeleton {
  min-height: 120px;
}

/* Services loading grid */
.services-loading {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

/* Team loading grid */
.team-loading {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
}

/* Testimonials loading */
.testimonials-loading {
  display: flex;
  gap: 2rem;
  overflow-x: auto;
}

/* HTMX loading indicator */
.htmx-loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.htmx-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 1000;
}

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

/* Error states */
.error-message {
  padding: 2rem;
  text-align: center;
  background: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: 12px;
  color: #c53030;
  margin: 1rem 0;
}

.error-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.error-message p {
  margin: 1rem 0;
  color: #2d3748;
}

.error-message button {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.error-message button:hover {
  background: var(--primary-dark);
}

/* Filter button active states */
.services-filter .filter-btn.htmx-request {
  background: var(--primary-light);
  pointer-events: none;
}

/* Fade in animation for loaded content */
.htmx-settling {
  opacity: 0;
  animation: fadeIn 0.5s ease-in-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Time slots styling */
.time-slot {
  display: inline-block;
  margin: 0.5rem;
  padding: 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.time-slot.available {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.time-slot.available:hover {
  background: var(--primary-color);
  color: white;
}

.time-slot.booked {
  background: #f7fafc;
  color: #a0aec0;
  cursor: not-allowed;
}

.slot-time {
  font-weight: 600;
  font-size: 1.1rem;
}

.slot-status {
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.no-slots {
  text-align: center;
  padding: 2rem;
  color: #666;
  font-style: italic;
}

/* Emergency Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
}

.modal-content {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur-xl));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--glass-shadow-hover);
    padding: 32px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--glass-border);
}

.modal-header h3 {
    margin: 0;
    color: var(--color-primary);
    font-family: var(--font-heading);
    font-size: var(--text-xl);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: var(--text-2xl);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-base);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--glass-bg-hover);
    color: var(--text-primary);
}

.emergency-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.divider {
    text-align: center;
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin: 16px 0;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--glass-border);
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

/* Enhanced Form Success/Error Messages */
.form-success {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #4caf50;
    padding: 20px;
    border-radius: var(--radius-lg);
    text-align: center;
    margin: 16px 0;
    backdrop-filter: blur(var(--blur-sm));
}

/* Enhanced Loading States */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: var(--text-sm);
    min-height: 60px;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--glass-border);
    border-top: 2px solid var(--color-primary);
    border-radius: 50%;
    margin-left: 10px;
    animation: loading-spin 1s linear infinite;
}

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

/* Business Hours Status */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}

.status-badge.open {
    color: #4caf50;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.status-badge.closed {
    color: #f44336;
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-badge.open .status-dot {
    background: #4caf50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.5);
    animation: pulse 2s infinite;
}

.status-badge.closed .status-dot {
    background: #f44336;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .stats-loading {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .services-loading {
    grid-template-columns: 1fr;
  }
  
  .team-loading {
    grid-template-columns: 1fr;
  }
  
  .testimonials-loading {
    flex-direction: column;
  }
  
  .modal-content {
    padding: 20px;
    max-height: 95vh;
  }
  
  .modal {
    padding: 10px;
  }
}
