/**
 * ADVANCED UX ENHANCEMENTS
 * 
 * Additional improvements from UX_UI_RECOMMENDATIONS.md
 * Includes: floating labels, skeleton screens, progress indicators, micro-interactions
 */

/* ============================================
   FLOATING LABELS
   ============================================ */

.form-group.floating-label {
  position: relative;
  margin-bottom: 24px;
}

.form-group.floating-label label {
  position: absolute;
  top: 16px;
  left: 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  color: #8c8c8c;
  background: transparent;
  padding: 0 4px;
  font-size: 1rem;
  font-weight: 500;
}

.form-group.floating-label input,
.form-group.floating-label select {
  padding: 16px 12px 8px 12px;
}

.form-group.floating-label input:focus + label,
.form-group.floating-label input:not(:placeholder-shown) + label,
.form-group.floating-label select:focus + label,
.form-group.floating-label select:not([value=""]) + label,
.form-group.floating-label.filled label {
  top: -8px;
  left: 8px;
  font-size: 0.75rem;
  background: white;
  color: #ff6600;
  font-weight: 600;
}

/* ============================================
   SKELETON SCREENS
   ============================================ */

.skeleton-container {
  padding: 24px;
  background: white;
  border-radius: 12px;
  margin-bottom: 24px;
}

.skeleton-line {
  height: 16px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 12px;
}

.skeleton-line.title {
  height: 28px;
  width: 60%;
  margin-bottom: 16px;
}

.skeleton-line.short {
  width: 40%;
}

.skeleton-line.medium {
  width: 70%;
}

.skeleton-line.long {
  width: 90%;
}

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

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

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

/* ============================================
   MULTI-STEP FORM PROGRESS
   ============================================ */

.form-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: 32px;
  position: relative;
  padding: 0 24px;
}

.form-steps::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 24px;
  right: 24px;
  height: 2px;
  background: #e0e0e0;
  z-index: 0;
}

.form-step {
  position: relative;
  text-align: center;
  flex: 1;
  z-index: 1;
}

.form-step-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  border: 2px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  font-weight: 600;
  color: #8c8c8c;
  transition: all 0.3s ease;
}

.form-step-label {
  font-size: 0.875rem;
  color: #8c8c8c;
  font-weight: 500;
  transition: color 0.3s ease;
}

.form-step.active .form-step-circle {
  background: #ff6600;
  border-color: #ff6600;
  color: white;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(255, 102, 0, 0.3);
}

.form-step.active .form-step-label {
  color: #ff6600;
  font-weight: 600;
}

.form-step.completed .form-step-circle {
  background: #16a34a;
  border-color: #16a34a;
  color: white;
}

.form-step.completed .form-step-circle::after {
  content: '✓';
  font-size: 1.25rem;
}

.form-step.completed .form-step-label {
  color: #16a34a;
}

/* Progress line animation */
.form-steps-progress {
  position: absolute;
  top: 20px;
  left: 24px;
  height: 2px;
  background: linear-gradient(90deg, #ff6600, #ff8533);
  z-index: 0;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.tooltip-wrapper {
  position: relative;
  display: inline-block;
}

.tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: #1f1f1f;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.875rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
}

.tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1f1f1f;
}

.tooltip-wrapper:hover .tooltip,
.tooltip-wrapper:focus-within .tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================
   ENHANCED CARDS WITH BADGES
   ============================================ */

.card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #ff6600;
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-badge.success {
  background: #16a34a;
}

.card-badge.warning {
  background: #f39c12;
}

.card-badge.info {
  background: #0d6efd;
}

/* ============================================
   ANIMATED CHECKMARKS
   ============================================ */

.checkmark-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  animation: scaleIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.checkmark {
  width: 32px;
  height: 32px;
  color: white;
  animation: checkmarkDraw 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}

@keyframes scaleIn {
  0% { transform: scale(0); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes checkmarkDraw {
  0% { transform: scale(0) rotate(-45deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ============================================
   STICKY ELEMENTS
   ============================================ */

.sticky-header {
  position: sticky;
  top: 0;
  background: white;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0);
  transition: box-shadow 0.3s ease;
  padding: 16px 0;
}

.sticky-header.scrolled {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sticky-footer-cta {
  position: sticky;
  bottom: 0;
  background: white;
  padding: 16px 24px;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
  z-index: 100;
  animation: slideUp 0.3s ease;
}

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

/* ============================================
   ENHANCED GRID SYSTEM
   ============================================ */

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

.grid-responsive {
  display: grid;
  gap: 24px;
}

@media (min-width: 640px) {
  .grid-responsive { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .grid-responsive { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1280px) {
  .grid-responsive { grid-template-columns: repeat(4, 1fr); }
}

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

/* Pulse animation for notifications */
.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* Bounce animation for CTAs */
.bounce {
  animation: bounce 1s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Shake animation for errors */
.shake {
  animation: shake 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
  20%, 40%, 60%, 80% { transform: translateX(10px); }
}

/* Fade in animation */
.fade-in {
  animation: fadeIn 0.5s ease;
}

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

/* Slide in from bottom */
.slide-in-bottom {
  animation: slideInBottom 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ============================================
   ENHANCED MODALS
   ============================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
  backdrop-filter: blur(4px);
}

.modal {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1f1f1f;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #8c8c8c;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.modal-close:hover {
  background: #f0f0f0;
}

.modal-body {
  color: #5a5a5a;
  line-height: 1.6;
  margin-bottom: 24px;
}

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ============================================
   ENHANCED BADGES & CHIPS
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 600;
  gap: 6px;
}

.badge.primary {
  background: rgba(255, 102, 0, 0.1);
  color: #ff6600;
}

.badge.success {
  background: rgba(22, 163, 74, 0.1);
  color: #16a34a;
}

.badge.warning {
  background: rgba(243, 156, 18, 0.1);
  color: #f39c12;
}

.badge.error {
  background: rgba(231, 76, 60, 0.1);
  color: #e74c3c;
}

.badge.info {
  background: rgba(13, 110, 253, 0.1);
  color: #0d6efd;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 0.875rem;
  background: #f0f0f0;
  color: #1f1f1f;
  gap: 8px;
  transition: background 0.2s;
}

.chip:hover {
  background: #e0e0e0;
}

.chip-remove {
  background: none;
  border: none;
  color: #8c8c8c;
  cursor: pointer;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  transition: color 0.2s;
}

.chip-remove:hover {
  color: #e74c3c;
}

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */

.hide-mobile {
  display: none;
}

@media (min-width: 768px) {
  .hide-mobile {
    display: block;
  }
  
  .hide-desktop {
    display: none;
  }
}

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

@media print {
  .no-print {
    display: none !important;
  }
  
  .btn,
  .toast-container,
  .modal-overlay,
  .sticky-footer-cta {
    display: none !important;
  }
  
  body {
    background: white !important;
  }
  
  .card {
    box-shadow: none !important;
    border: 1px solid #e0e0e0 !important;
  }
}
