/* Header Action Icons - Mobile First, Performance Optimized */

/* Container */
.header-actions-container {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 100;
  margin-left: 8px;
}

/* Action Wrapper */
.header-action-wrapper {
  position: relative;
  overflow: visible;
}

/* Action Button Base */
.header-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.1),
    0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.05);
  color: #475569;
  text-decoration: none;
  transition: 
    transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    background 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: visible;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Hover Effects */
.header-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.15),
    0 2px 6px rgba(0, 0, 0, 0.1);
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
  color: #1a73e8;
}

.header-action-btn:active {
  transform: translateY(0);
  box-shadow: 
    0 2px 6px rgba(0, 0, 0, 0.1),
    0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Focus States */
.header-action-btn:focus {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

/* Icon Container */
.header-action-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  position: relative;
  z-index: 1;
}

.header-action-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-action-btn:hover .header-action-icon svg {
  transform: scale(1.1);
}

/* Badge */
.header-action-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  background: var(--badge-color, #ef4444);
  color: white;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  z-index: 2;
  transform: scale(1);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid white;
  white-space: nowrap;
  overflow: visible;
}

.header-action-btn:hover .header-action-badge {
  transform: scale(1.1);
}

/* Screen Reader Text */
.screen-reader-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Animations */

/* Pulse Animation */
.header-action-anim-pulse {
  animation-name: headerActionPulse;
  animation-duration: var(--animation-duration, 2s);
  animation-delay: var(--animation-delay, 0s);
  animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1);
  animation-iteration-count: infinite;
}

.header-action-anim-pulse.anim-trigger-hover {
  animation-play-state: paused;
}

.header-action-anim-pulse.anim-trigger-hover:hover {
  animation-play-state: running;
}

.header-action-anim-pulse.anim-trigger-load {
  animation-iteration-count: 3;
}

@keyframes headerActionPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Bounce Animation */
.header-action-anim-bounce {
  animation-name: headerActionBounce;
  animation-duration: var(--animation-duration, 1s);
  animation-delay: var(--animation-delay, 0s);
  animation-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  animation-iteration-count: infinite;
}

.header-action-anim-bounce.anim-trigger-hover {
  animation-play-state: paused;
}

.header-action-anim-bounce.anim-trigger-hover:hover {
  animation-play-state: running;
}

.header-action-anim-bounce.anim-trigger-load {
  animation-iteration-count: 2;
}

@keyframes headerActionBounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
  60% { transform: translateY(-3px); }
}

/* Shake Animation */
.header-action-anim-shake {
  animation-name: headerActionShake;
  animation-duration: var(--animation-duration, 0.5s);
  animation-delay: var(--animation-delay, 0s);
  animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1);
  animation-iteration-count: infinite;
}

.header-action-anim-shake.anim-trigger-hover {
  animation-play-state: paused;
}

.header-action-anim-shake.anim-trigger-hover:hover {
  animation-play-state: running;
}

.header-action-anim-shake.anim-trigger-load {
  animation-iteration-count: 3;
}

@keyframes headerActionShake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
  20%, 40%, 60%, 80% { transform: translateX(2px); }
}

/* Responsive Visibility */

/* Mobile First - Show by default */
.header-actions-container {
  display: flex;
}

/* Mobile specific adjustments */
@media (max-width: 900px) {
  .header-actions-container.hide-mobile,
  .header-action-wrapper.hide-mobile {
    display: none !important;
  }
  
  .header-actions-container {
    margin-left: 0;
    gap: 6px;
    flex-shrink: 0;
    min-width: 100px;
  }
  
  .header-action-badge {
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    padding: 0 4px;
    top: -3px;
    right: -3px;
    border: 1px solid white;
  }
  
  /* Ensure mobile badge numbers don't get cut off */
  .header-action-btn {
    position: relative;
    overflow: visible;
  }
}

/* Hide on desktop when specified */
@media (min-width: 901px) {
  .header-actions-container.hide-desktop,
  .header-action-wrapper.hide-desktop {
    display: none !important;
  }
  
  /* Larger icons on desktop */
  .header-action-btn {
    width: 48px;
    height: 48px;
    position: relative;
    overflow: visible;
  }
  
  .header-action-icon {
    width: 22px;
    height: 22px;
  }
  
  .header-action-badge {
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 700;
    top: -4px;
    right: -4px;
    padding: 0 6px;
    border: 2px solid white;
    white-space: nowrap;
    overflow: visible;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .header-actions-container {
    gap: 12px;
  }
}

/* Tablet Adjustments */
@media (min-width: 601px) and (max-width: 900px) {
  .header-action-btn {
    width: 46px;
    height: 46px;
  }
  
  .header-action-icon {
    width: 21px;
    height: 21px;
  }
  
  .header-actions-container {
    gap: 10px;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .header-action-btn {
    border: 2px solid #000;
    box-shadow: none;
  }
  
  .header-action-btn:hover {
    background: #000;
    color: #fff;
  }
  
  .header-action-badge {
    border: 2px solid #000;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .header-action-btn,
  .header-action-icon svg,
  .header-action-badge {
    transition: none;
  }
  
  .header-action-anim-pulse,
  .header-action-anim-bounce,
  .header-action-anim-shake {
    animation: none;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .header-action-btn {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    box-shadow: 
      0 2px 8px rgba(0, 0, 0, 0.3),
      0 1px 3px rgba(0, 0, 0, 0.2);
  }
  
  .header-action-btn:hover {
    background: linear-gradient(135deg, #334155 0%, #475569 100%);
    color: #60a5fa;
    box-shadow: 
      0 4px 12px rgba(0, 0, 0, 0.4),
      0 2px 6px rgba(0, 0, 0, 0.3);
  }
}

/* Print Styles */
@media print {
  .header-actions-container {
    display: none !important;
  }
}

/* Loading State Prevention (Prevents Layout Shift) */
.header-actions-container {
  /* Reserve space to prevent layout shift */
  min-width: 100px; /* Adjust based on typical content */
  min-height: 44px;
  flex-shrink: 0;
}

@media (min-width: 901px) {
  .header-actions-container {
    min-width: 120px;
    min-height: 48px;
  }
}

/* Performance Optimizations */
.header-action-btn {
  /* Use GPU acceleration for transforms */
  will-change: transform;
  transform: translateZ(0);
}

.header-action-icon svg {
  /* Optimize SVG rendering */
  shape-rendering: geometricPrecision;
}

/* Badge number transitions for dynamic updates */
.header-action-badge {
  transition: 
    transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    background-color 0.2s ease;
}

/* Badge appearing animation */
@keyframes badgeAppear {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.header-action-badge.badge-new {
  animation: badgeAppear 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}