/* Enhanced CSS for WisdomAI - static/css/enhanced.css */

/* ====================================
   CUSTOM PROPERTIES & VARIABLES
   ==================================== */
:root {
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #9333ea 100%);
  --secondary-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* ====================================
   ENHANCED ANIMATIONS
   ==================================== */
@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 35px rgba(147, 51, 234, 0.8);
    transform: scale(1.02);
  }
}

@keyframes float-gentle {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33% { transform: translateY(-10px) rotate(1deg); }
  66% { transform: translateY(5px) rotate(-1deg); }
}

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

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

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

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

/* ====================================
   UTILITY CLASSES
   ==================================== */
.gradient-text {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}

.gradient-bg-primary { background: var(--primary-gradient); }
.gradient-bg-secondary { background: var(--secondary-gradient); }
.gradient-bg-success { background: var(--success-gradient); }
.gradient-bg-warning { background: var(--warning-gradient); }

.pulse-glow { animation: pulse-glow 3s ease-in-out infinite; }
.float-gentle { animation: float-gentle 6s ease-in-out infinite; }
.slide-in-left { animation: slideInFromLeft 0.6s ease-out; }
.slide-in-right { animation: slideInFromRight 0.6s ease-out; }
.fade-in-up { animation: fadeInUp 0.8s ease-out; }

.text-shadow-sm { text-shadow: 0 1px 2px rgb(0 0 0 / 0.1); }
.text-shadow-md { text-shadow: 0 4px 6px rgb(0 0 0 / 0.1); }

/* ====================================
   ENHANCED COMPONENTS
   ==================================== */

/* Enhanced Cards */
.card-enhanced {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  box-shadow: var(--shadow-xl);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-enhanced:hover {
  transform: translateY(-8px);
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}

/* Enhanced Buttons */
.btn-primary-enhanced {
  background: var(--primary-gradient);
  color: white;
  padding: 12px 24px;
  border-radius: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary-enhanced::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn-primary-enhanced:hover::before {
  left: 100%;
}

.btn-primary-enhanced:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-primary-enhanced:active {
  transform: translateY(0);
}

/* Enhanced Input Fields */
.input-enhanced {
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(99, 102, 241, 0.2);
  border-radius: 16px;
  padding: 16px 20px;
  font-size: 16px;
  transition: all 0.3s ease;
  width: 100%;
}

.input-enhanced:focus {
  outline: none;
  border-color: #6366f1;
  background: white;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
  transform: scale(1.02);
}

.input-enhanced::placeholder {
  color: rgba(107, 114, 128, 0.7);
}

/* Enhanced Navigation */
.nav-enhanced {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(229, 231, 235, 0.5);
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Enhanced Modal/Overlay */
.modal-overlay {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: white;
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--shadow-xl);
  transform: translateY(-50px) scale(0.9);
  transition: all 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

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

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top: 3px solid #6366f1;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ====================================
   ENHANCED DRAG & DROP
   ==================================== */
.dropzone-enhanced {
  border: 2px dashed rgba(99, 102, 241, 0.3);
  border-radius: 20px;
  padding: 48px 24px;
  text-align: center;
  transition: all 0.3s ease;
  background: rgba(99, 102, 241, 0.02);
  position: relative;
  overflow: hidden;
}

.dropzone-enhanced::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: var(--primary-gradient);
  border-radius: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.dropzone-enhanced:hover,
.dropzone-enhanced.drag-over {
  background: rgba(99, 102, 241, 0.08);
  border-color: #6366f1;
  transform: scale(1.02);
}

.dropzone-enhanced.drag-over::before {
  opacity: 1;
}

/* ====================================
   ENHANCED CHAT INTERFACE
   ==================================== */
.chat-message-user {
  background: var(--primary-gradient);
  color: white;
  border-radius: 20px 20px 6px 20px;
  padding: 16px 20px;
  margin-left: auto;
  max-width: 70%;
  box-shadow: var(--shadow-md);
}

.chat-message-ai {
  background: white;
  border: 1px solid rgba(229, 231, 235, 0.5);
  border-radius: 20px 20px 20px 6px;
  padding: 16px 20px;
  margin-right: auto;
  max-width: 85%;
  box-shadow: var(--shadow-sm);
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: #6b7280;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(1);
    opacity: 0.5;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* ====================================
   ENHANCED PROGRESS INDICATORS
   ==================================== */
.progress-bar {
  background: rgba(99, 102, 241, 0.1);
  border-radius: 10px;
  overflow: hidden;
  height: 8px;
}

.progress-fill {
  background: var(--primary-gradient);
  height: 100%;
  border-radius: 10px;
  transition: width 0.5s ease;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}

/* ====================================
   RESPONSIVE ENHANCEMENTS
   ==================================== */
@media (max-width: 768px) {
  .card-enhanced {
    border-radius: 16px;
    padding: 20px;
  }

  .btn-primary-enhanced {
    padding: 14px 20px;
    border-radius: 12px;
    width: 100%;
  }

  .input-enhanced {
    padding: 14px 16px;
    border-radius: 12px;
  }

  .dropzone-enhanced {
    padding: 32px 16px;
    border-radius: 16px;
  }

  .chat-message-user,
  .chat-message-ai {
    max-width: 90%;
    border-radius: 16px;
  }

  .chat-message-user {
    border-bottom-right-radius: 6px;
  }

  .chat-message-ai {
    border-bottom-left-radius: 6px;
  }
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
  .card-enhanced {
    border: 2px solid #000;
  }

  .btn-primary-enhanced {
    border: 2px solid #000;
  }

  .input-enhanced {
    border: 2px solid #000;
  }
}

/* Dark mode enhancements */
@media (prefers-color-scheme: dark) {
  :root {
    --primary-gradient: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
  }

  .card-enhanced {
    background: rgba(31, 41, 55, 0.95);
    border: 1px solid rgba(75, 85, 99, 0.3);
  }

  .input-enhanced {
    background: rgba(31, 41, 55, 0.9);
    border-color: rgba(139, 92, 246, 0.3);
    color: #f9fafb;
  }

  .input-enhanced::placeholder {
    color: rgba(156, 163, 175, 0.7);
  }

  .chat-message-ai {
    background: rgba(31, 41, 55, 0.8);
    border-color: rgba(75, 85, 99, 0.3);
    color: #f9fafb;
  }

  .nav-enhanced {
    background: rgba(17, 24, 39, 0.95);
    border-bottom-color: rgba(75, 85, 99, 0.3);
  }
}

/* ====================================
   PRINT STYLES
   ==================================== */
@media print {
  .nav-enhanced,
  .btn-primary-enhanced,
  .loading-spinner {
    display: none !important;
  }

  .card-enhanced {
    border: 1px solid #000;
    box-shadow: none;
    page-break-inside: avoid;
  }

  .gradient-text {
    -webkit-text-fill-color: initial;
    color: #000;
  }
}

/* ====================================
   FOCUS STYLES FOR ACCESSIBILITY
   ==================================== */
*:focus {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.btn-primary-enhanced:focus {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #000;
  color: #fff;
  padding: 8px;
  border-radius: 4px;
  text-decoration: none;
  z-index: 1000;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 6px;
}