/* 
 * R&R Tampa - Enhanced UX Styles
 * Additional styles for polish, animations, and micro-interactions
 */

/* =================================================================
   FOCUS STATES & ACCESSIBILITY
   ================================================================= */

/* Better focus visibility for all interactive elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #0d9488;
  color: #ffffff;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100;
  border-radius: 0 0 4px 0;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* =================================================================
   FORM ENHANCEMENTS
   ================================================================= */

/* Input focus animations */
input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
  transform: translateY(-1px);
  transition: all 0.2s ease;
}

/* Input with value - keep elevated */
input:not(:placeholder-shown),
select:not([value=""]),
textarea:not(:placeholder-shown) {
  background: #fafafa;
}

/* Field error states */
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: #dc2626;
  background: #fef2f2;
}

.field-error {
  color: #dc2626;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  display: none;
  animation: slideInError 0.2s ease;
}

@keyframes slideInError {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Success state for inputs */
input.valid:not(:focus),
select.valid:not(:focus),
textarea.valid:not(:focus) {
  border-color: #10b981;
  background: #f0fdf4;
}

/* Add checkmark to valid fields */
input.valid:not(:focus)::after {
  content: '✓';
  color: #10b981;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

/* Progress bar for forms */
.form-progress {
  width: 100%;
  height: 4px;
  background: rgba(13, 148, 136, 0.2);
  border-radius: 2px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.form-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--teal-light));
  width: 0%;
  transition: width 0.3s ease;
}

/* =================================================================
   BUTTON ENHANCEMENTS
   ================================================================= */

/* Button press effect */
.cta-button:active {
  transform: translateY(1px) !important;
}

/* Loading state */
.cta-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Spinner animation */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spinner {
  animation: spin 1s linear infinite;
}

/* Ripple effect container */
.cta-button {
  position: relative;
  overflow: hidden;
}

/* Ripple animation */
@keyframes ripple-animation {
  from {
    transform: scale(0);
    opacity: 1;
  }
  to {
    transform: scale(4);
    opacity: 0;
  }
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  width: 100px;
  height: 100px;
  margin-left: -50px;
  margin-top: -50px;
  animation: ripple-animation 0.6s;
  pointer-events: none;
}

/* =================================================================
   MICRO-INTERACTIONS
   ================================================================= */

/* Smooth hover transitions */
.step,
.benefit,
.pricing-card,
.review-card,
details {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.step:hover,
.benefit:hover,
.pricing-card:hover,
.review-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

/* Pricing card pulse on popular */
.pricing-card.popular {
  animation: subtlePulse 2s ease-in-out infinite;
}

@keyframes subtlePulse {
  0%, 100% {
    box-shadow: 0 2px 10px rgba(13, 148, 136, 0.1);
  }
  50% {
    box-shadow: 0 4px 20px rgba(13, 148, 136, 0.2);
  }
}

/* FAQ details animation */
details[open] summary {
  color: var(--teal);
  margin-bottom: 0.5rem;
}

details summary {
  transition: color 0.2s ease;
}

details summary:hover {
  color: var(--teal-light);
}

/* =================================================================
   MOBILE STICKY CTA
   ================================================================= */

.sticky-cta-mobile {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--navy);
  padding: 12px 16px;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  transform: translateY(120%);
  transition: transform 0.3s ease;
}

/* =================================================================
   TOAST NOTIFICATIONS
   ================================================================= */

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: white;
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  animation: slideInRight 0.3s ease;
  max-width: 320px;
}

.toast.success {
  border-left: 4px solid #10b981;
}

.toast.error {
  border-left: 4px solid #dc2626;
}

.toast.info {
  border-left: 4px solid var(--teal);
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* =================================================================
   LOADING SKELETON
   ================================================================= */

.skeleton {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

/* =================================================================
   CONFETTI
   ================================================================= */

@keyframes confetti-fall {
  to {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

/* =================================================================
   OFFLINE WARNING
   ================================================================= */

#offline-warning {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #dc2626;
  color: #ffffff;
  padding: 12px;
  text-align: center;
  z-index: 10000;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-100%);
  }
}

/* =================================================================
   IMPROVED FORM SUCCESS/ERROR MESSAGES
   ================================================================= */

#formSuccess,
#formError {
  animation: slideInUp 0.4s ease;
}

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

/* =================================================================
   ENHANCED TOOLTIPS
   ================================================================= */

[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.875rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 1000;
}

[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: 115%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--navy);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 1000;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before,
[data-tooltip]:focus::after,
[data-tooltip]:focus::before {
  opacity: 1;
}

/* =================================================================
   RESPONSIVE IMPROVEMENTS
   ================================================================= */

/* Mobile: Ensure minimum tap targets */
@media (max-width: 768px) {
  button,
  a.cta-button,
  input[type="submit"],
  input[type="button"] {
    min-height: 48px;
    min-width: 48px;
  }

  /* Larger form inputs on mobile */
  input,
  select,
  textarea {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  /* Better spacing for mobile forms */
  .grid {
    gap: 1rem;
  }

  /* Sticky CTA appears on mobile */
  .sticky-cta-mobile {
    display: block;
  }
}

/* Desktop: Show hover effects */
@media (min-width: 769px) {
  .sticky-cta-mobile {
    display: none !important;
  }
}

/* =================================================================
   PRINT STYLES
   ================================================================= */

@media print {
  .sticky-cta-mobile,
  .cta-section,
  #offline-warning,
  .toast {
    display: none !important;
  }

  .breadcrumb {
    display: block !important;
  }
}

/* =================================================================
   REDUCED MOTION
   ================================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .form-progress-fill {
    transition: none;
  }
}

/* =================================================================
   HIGH CONTRAST MODE
   ================================================================= */

@media (prefers-contrast: high) {
  .cta-button {
    border: 2px solid currentColor;
  }

  input:focus,
  select:focus,
  textarea:focus {
    outline-width: 4px;
  }
}
