/* ============================================================
   AGENDA SOBRAL — UX/UI Enhancements
   Animations, Loading States, Form Improvements, Accessibility
   ============================================================ */

/* ============================================================
   1. ANIMATIONS & TRANSITIONS
   ============================================================ */

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

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

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

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

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

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

@keyframes successCheck {
  0% {
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
  }
  100% {
    stroke-dasharray: 50;
    stroke-dashoffset: 0;
  }
}

/* Page transitions */
.page-enter {
  animation: fadeInUp 0.4s ease-out both;
}

.page-leave {
  animation: fadeInDown 0.2s ease-in both;
}

/* ============================================================
   2. LOADING STATES
   ============================================================ */

.loading-spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.loading-spinner svg {
  width: 100%;
  height: 100%;
  animation: spin 1s linear infinite;
}

.loading-bar {
  width: 100%;
  height: 3px;
  background: #e0e0e0;
  position: relative;
  overflow: hidden;
  border-radius: 3px;
  margin: 16px 0;
}

.loading-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, #1A2E4A, transparent);
  width: 50px;
  animation: slide 1.5s infinite;
}

@keyframes slide {
  0% {
    left: -50px;
  }
  100% {
    left: 100%;
  }
}

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

.skeleton-text {
  height: 12px;
  width: 100%;
  margin: 8px 0;
}

.skeleton-text.large {
  height: 24px;
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  gap: 16px;
  color: #64748B;
}

.loading-state svg {
  width: 48px;
  height: 48px;
  animation: spin 2s linear infinite;
}

/* ============================================================
   3. FORM IMPROVEMENTS
   ============================================================ */

.form-group {
  margin-bottom: 20px;
  animation: fadeInUp 0.3s ease-out;
}

.form-group:nth-child(2) {
  animation-delay: 0.05s;
}

.form-group:nth-child(3) {
  animation-delay: 0.1s;
}

.form-group:nth-child(4) {
  animation-delay: 0.15s;
}

.form-group:nth-child(5) {
  animation-delay: 0.2s;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 14px;
  color: #334155;
  transition: color 0.2s ease;
}

.form-label.required::after {
  content: ' *';
  color: #EF4444;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s ease;
  background: #FFFFFF;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: #1A2E4A;
  box-shadow: 0 0 0 3px rgba(26, 46, 74, 0.1);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background-color: #F8FAFC;
  cursor: not-allowed;
  opacity: 0.6;
}

.form-input.success {
  border-color: #10B981;
  background: #F0FDF4;
}

.form-input.error {
  border-color: #EF4444;
  background: #FEF2F2;
}

.form-help {
  margin-top: 6px;
  font-size: 12px;
  color: #64748B;
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.form-error {
  margin-top: 6px;
  font-size: 12px;
  color: #EF4444;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  animation: slideInLeft 0.2s ease-out;
}

.form-error-icon,
.form-help-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.form-success {
  margin-top: 6px;
  font-size: 12px;
  color: #10B981;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  animation: slideInLeft 0.2s ease-out;
}

.form-validation-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-group.has-validation {
  position: relative;
}

.form-group.has-validation .form-input,
.form-group.has-validation .form-select {
  padding-right: 40px;
}

/* ============================================================
   4. BUTTON STATES & HOVER EFFECTS
   ============================================================ */

.btn {
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::before {
  width: 300px;
  height: 300px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn.loading::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 8px;
}

/* ============================================================
   5. ERROR & EMPTY STATES
   ============================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  gap: 16px;
  animation: fadeInUp 0.4s ease-out;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  background: #F1F5F9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin-bottom: 8px;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: #1E293B;
}

.empty-state-desc {
  font-size: 14px;
  color: #64748B;
  max-width: 400px;
}

.empty-state-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}

.error-state {
  background: #FEF2F2;
  border: 1.5px solid #FECACA;
  border-radius: 12px;
  padding: 24px;
  animation: slideInDown 0.3s ease-out;
}

.error-state-title {
  font-size: 16px;
  font-weight: 600;
  color: #991B1B;
  margin-bottom: 8px;
}

.error-state-msg {
  font-size: 14px;
  color: #7F1D1D;
  margin-bottom: 12px;
}

.error-state-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.error-state-btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.error-state-btn-primary {
  background: #EF4444;
  color: white;
}

.error-state-btn-primary:hover {
  background: #DC2626;
}

.error-state-btn-secondary {
  background: rgba(239, 68, 68, 0.1);
  color: #991B1B;
}

.error-state-btn-secondary:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* ============================================================
   6. SUCCESS MESSAGES & TOASTS
   ============================================================ */

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 400px;
  animation: slideInRight 0.3s ease-out;
  z-index: 1000;
}

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

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

.toast.info {
  border-left: 4px solid #3B82F6;
}

.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.toast.success .toast-icon {
  color: #10B981;
}

.toast.error .toast-icon {
  color: #EF4444;
}

.toast.info .toast-icon {
  color: #3B82F6;
}

.toast-message {
  font-size: 14px;
  color: #1E293B;
  flex: 1;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #94A3B8;
  padding: 0;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.toast-close:hover {
  opacity: 1;
}

.toast-dismiss {
  animation: slideInLeft 0.2s ease-out;
}

/* ============================================================
   7. PROGRESS INDICATORS
   ============================================================ */

.progress-bar {
  width: 100%;
  height: 6px;
  background: #E2E8F0;
  border-radius: 3px;
  overflow: hidden;
  margin: 16px 0;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #1A2E4A, #51B7DE);
  width: 0%;
  transition: width 0.4s ease;
  border-radius: 3px;
}

.progress-steps {
  display: flex;
  gap: 8px;
  margin: 24px 0;
  justify-content: space-between;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.progress-step-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  border: 2px solid #E2E8F0;
  background: #FFFFFF;
  color: #94A3B8;
  transition: all 0.3s ease;
}

.progress-step.active .progress-step-circle {
  background: #1A2E4A;
  border-color: #1A2E4A;
  color: white;
  box-shadow: 0 0 0 8px rgba(26, 46, 74, 0.1);
}

.progress-step.completed .progress-step-circle {
  background: #10B981;
  border-color: #10B981;
  color: white;
}

.progress-step-label {
  font-size: 12px;
  font-weight: 500;
  color: #64748B;
  text-align: center;
}

.progress-step.active .progress-step-label {
  color: #1A2E4A;
  font-weight: 600;
}

.progress-step.completed .progress-step-label {
  color: #10B981;
}

.progress-step-line {
  position: absolute;
  top: 19px;
  left: 50%;
  width: calc(100% - 20px);
  height: 2px;
  background: #E2E8F0;
  margin-left: 8px;
}

.progress-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 19px;
  right: -calc(50% + 20px);
  width: calc(100% - 20px);
  height: 2px;
  background: #E2E8F0;
  transition: background 0.3s ease;
}

.progress-step.completed::after {
  background: #10B981;
}

/* ============================================================
   8. BREADCRUMBS & NAVIGATION
   ============================================================ */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  font-size: 13px;
}

.breadcrumb-item {
  color: #64748B;
  text-decoration: none;
  transition: color 0.2s ease;
}

.breadcrumb-item:hover {
  color: #1A2E4A;
}

.breadcrumb-item.active {
  color: #1A2E4A;
  font-weight: 600;
}

.breadcrumb-separator {
  color: #CBD5E1;
  margin: 0 4px;
}

/* ============================================================
   9. MODALS & OVERLAYS
   ============================================================ */

.modal {
  animation: fadeInUp 0.3s ease-out;
}

.modal-overlay {
  animation: fadeInDown 0.2s ease-out;
}

.modal.closing {
  animation: fadeInDown 0.2s ease-in;
}

.modal-overlay.closing {
  animation: fadeInUp 0.2s ease-in;
}

.modal-close {
  transition: all 0.2s ease;
}

.modal-close:hover {
  transform: rotate(90deg);
}

/* ============================================================
   10. ACCESSIBILITY ENHANCEMENTS
   ============================================================ */

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: 2px solid #1A2E4A;
  outline-offset: 2px;
}

.btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.5);
}

/* Skip to content link */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: #1A2E4A;
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100;
  border-radius: 0 0 8px 0;
}

.skip-to-content:focus {
  top: 0;
}

/* High contrast mode support */
@media (prefers-contrast: more) {
  .form-input,
  .form-select,
  .form-textarea {
    border-width: 2px;
  }

  .btn {
    border-width: 2px;
  }
}

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

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .toast {
    background: #1E293B;
    color: #E2E8F0;
  }

  .empty-state-icon {
    background: #334155;
  }

  .empty-state-title {
    color: #F1F5F9;
  }

  .form-input,
  .form-select,
  .form-textarea {
    background: #1E293B;
    color: #E2E8F0;
    border-color: #334155;
  }

  .form-input:focus,
  .form-select:focus,
  .form-textarea:focus {
    border-color: #51B7DE;
    box-shadow: 0 0 0 3px rgba(81, 183, 222, 0.2);
  }

  .form-label {
    color: #CBD5E1;
  }
}

/* ============================================================
   11. RESPONSIVE ADJUSTMENTS
   ============================================================ */

@media (max-width: 640px) {
  .toast {
    bottom: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .empty-state {
    padding: 40px 16px;
  }

  .error-state {
    padding: 16px;
  }

  .progress-steps {
    gap: 4px;
  }

  .progress-step-label {
    font-size: 11px;
  }

  .breadcrumb {
    font-size: 12px;
  }
}

/* ============================================================
   12. PRINT STYLES
   ============================================================ */

@media print {
  .loading-spinner,
  .loading-state,
  .btn.loading {
    display: none !important;
  }

  .modal,
  .toast {
    display: none !important;
  }
}
