/* Advanced Styles and Animations */

/* Dropdown Menu Styles */
.dropdown {
  position: relative;
}

.dropdown-toggle::after {
  content: '';
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  margin-left: 0.5rem;
  transition: var(--transition-base);
}

.dropdown-toggle.active::after {
  transform: rotate(135deg);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--dark-800);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-lg);
  min-width: 200px;
  padding: 0.75rem;
  margin-top: 0.5rem;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--transition-base);
  box-shadow: var(--shadow-lg);
}

.dropdown-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu a {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  color: #cbd5e1;
  border-radius: var(--radius-md);
  transition: var(--transition-base);
  text-align: left;
}

.dropdown-menu a:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-500);
}

.dropdown-menu a.active {
  background: rgba(99, 102, 241, 0.2);
  color: var(--primary-500);
}

/* Mobile Navigation */
@media (max-width: 768px) {
  .navbar-toggle {
    display: block !important;
  }

  .navbar-menu {
    display: flex;
    position: fixed;
    left: -100%;
    top: 60px;
    flex-direction: column;
    background-color: rgba(15, 23, 42, 0.98);
    width: 100%;
    text-align: center;
    transition: left 0.3s ease-out;
    gap: 0;
    padding: 1rem 0;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    z-index: 998;
    box-shadow: -2px 4px 20px rgba(0, 0, 0, 0.5);
  }
  
  .navbar-menu.active {
    left: 0 !important;
    box-shadow: 2px 4px 20px rgba(0, 0, 0, 0.5) !important;
  }
  
  .navbar-menu li {
    width: 100%;
  }
  
  .navbar-menu a {
    display: block;
    width: 100%;
    padding: 1rem;
    border-radius: 0;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s ease;
  }
  
  .navbar-menu a:hover,
  .navbar-menu a:active,
  .navbar-menu a:focus {
    background: rgba(99, 102, 241, 0.15);
    outline: none;
  }
  
  .dropdown-menu {
    position: static;
    opacity: 0;
    visibility: hidden;
    transform: scaleY(0);
    transform-origin: top;
    max-height: 0;
    overflow: hidden;
    transition: var(--transition-base);
  }
  
  .dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: scaleY(1);
    max-height: 500px;
  }
  
  .dropdown-menu a {
    background: rgba(99, 102, 241, 0.05);
    padding-left: 2rem;
  }
}

/* Card Animations */
@keyframes cardEntry {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card {
  animation: cardEntry 0.5s ease-out;
}

/* Button Animations */
@keyframes buttonPulse {
  0%, 100% {
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
  }
  50% {
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
  }
}

.btn-primary:focus {
  animation: buttonPulse 0.5s ease-out;
}

/* Loading Animation */
@keyframes shimmerLoad {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.loading {
  background: linear-gradient(
    90deg,
    rgba(99, 102, 241, 0.1) 25%,
    rgba(99, 102, 241, 0.2) 50%,
    rgba(99, 102, 241, 0.1) 75%
  );
  background-size: 1000px 100%;
  animation: shimmerLoad 2s infinite;
}

/* Scroll to top button */
.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--accent-500) 100%);
  border: none;
  border-radius: var(--radius-full);
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: var(--transition-base);
  opacity: 0;
  visibility: hidden;
  z-index: 999;
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-to-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

/* Code Block Styling */
code {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.5rem;
  font-family: 'Monaco', 'Courier New', monospace;
  color: #94a3b8;
}

pre {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-lg);
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: var(--spacing-lg);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: #e2e8f0;
}

/* Quote Styling */
blockquote {
  border-left: 4px solid var(--primary-500);
  padding-left: 1rem;
  margin: 1rem 0;
  color: #cbd5e1;
  font-style: italic;
}

/* List Styles */
ul, ol {
  margin: 1rem 0;
  margin-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Table Styles */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

th {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-500);
  font-weight: 700;
}

tr:hover {
  background: rgba(99, 102, 241, 0.05);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print Styles */
@media print {
  .navbar,
  footer,
  .btn,
  .navbar-toggle,
  .profile-actions {
    display: none;
  }
  
  body {
    background: white;
    color: black;
  }
  
  .card {
    background: white;
    border: 1px solid #ccc;
    box-shadow: none;
  }
}

/* Dark mode specific adjustments */
:root {
  color-scheme: dark;
}

/* Focus visible for accessibility */
*:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

/* Skip to main content link */
.skip-to-main {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary-500);
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-to-main:focus {
  top: 0;
}

/* Glassmorphism effect */
.glass {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Gradient Text */
.gradient-text {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--accent-500) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Neumorphism effect (subtle) */
.neumorphic {
  background: linear-gradient(145deg, #1e293b, #0f172a);
  box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3),
              -5px -5px 15px rgba(99, 102, 241, 0.1);
}

/* Success state */
.success-message {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-lg);
  padding: 1rem;
  color: var(--green-500);
  margin-bottom: 1rem;
}

.success-message i {
  margin-right: 0.75rem;
}

/* Error state */
.error-message {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-lg);
  padding: 1rem;
  color: var(--red-500);
  margin-bottom: 1rem;
}

.error-message i {
  margin-right: 0.75rem;
}

/* Warning state */
.warning-message {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-lg);
  padding: 1rem;
  color: #f59e0b;
  margin-bottom: 1rem;
}

.warning-message i {
  margin-right: 0.75rem;
}

/* Info state */
.info-message {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-lg);
  padding: 1rem;
  color: var(--blue-500);
  margin-bottom: 1rem;
}

.info-message i {
  margin-right: 0.75rem;
}