/**
 * 🔥 ULTRA UPGRADE - PHASE 6: UX POLISH STYLES
 *
 * Styles for:
 * - Tooltips
 * - Confirmation dialogs
 * - Undo toasts
 * - Global search
 * - Keyboard shortcuts guide
 */

/* ============================================
   TOOLTIP SYSTEM
   ============================================ */

.tooltip-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

.tooltip-content {
  position: fixed;
  max-width: 300px;
  padding: 0;
  background: var(--tooltip-bg, #1e293b);
  color: var(--tooltip-text, #ffffff);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(-5px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
  z-index: 10000;
}

.tooltip-content.tooltip-show {
  opacity: 1;
  transform: translateY(0);
}

.tooltip-inner {
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.5;
}

.tooltip-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px;
  border-color: transparent;
}

/* Tooltip themes */
.tooltip-dark {
  --tooltip-bg: #1e293b;
  --tooltip-text: #ffffff;
}

.tooltip-light {
  --tooltip-bg: #ffffff;
  --tooltip-text: #1e293b;
  border: 1px solid var(--border-color);
}

.tooltip-info {
  --tooltip-bg: #3b82f6;
  --tooltip-text: #ffffff;
}

.tooltip-warning {
  --tooltip-bg: #f59e0b;
  --tooltip-text: #ffffff;
}

.tooltip-error {
  --tooltip-bg: #ef4444;
  --tooltip-text: #ffffff;
}

.tooltip-success {
  --tooltip-bg: #10b981;
  --tooltip-text: #ffffff;
}

/* ============================================
   CONFIRMATION DIALOGS
   ============================================ */

.confirmation-dialog-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: 10000;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.confirmation-dialog-overlay.confirmation-show {
  opacity: 1;
}

.confirmation-dialog {
  background: var(--card-bg);
  border-radius: 16px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.confirmation-show .confirmation-dialog {
  transform: scale(1);
}

.confirmation-header {
  padding: 24px 24px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.confirmation-icon {
  font-size: 32px;
  line-height: 1;
}

.confirmation-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.confirmation-body {
  padding: 24px;
}

.confirmation-message {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0 0 16px;
}

.confirmation-impact {
  padding: 12px 16px;
  background: var(--warning-bg);
  color: var(--warning);
  border-radius: 8px;
  font-size: 14px;
  margin-top: 16px;
}

.type-to-confirm {
  margin-top: 20px;
}

.type-to-confirm-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.type-to-confirm-label strong {
  color: var(--danger);
  font-family: 'Courier New', monospace;
}

.type-to-confirm-input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 15px;
  font-family: 'Courier New', monospace;
  background: var(--input-bg);
  color: var(--text-primary);
  transition: border-color 0.2s ease;
}

.type-to-confirm-input:focus {
  border-color: var(--danger);
  outline: none;
}

.type-to-confirm-hint {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.checkbox-confirm {
  margin-top: 20px;
}

.checkbox-confirm-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
}

.checkbox-confirm-input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.confirmation-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.confirmation-cancel,
.confirmation-confirm {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.confirmation-confirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Confirmation types */
.confirmation-warning .confirmation-icon {
  color: var(--warning);
}

.confirmation-danger .confirmation-icon {
  color: var(--danger);
}

.confirmation-info .confirmation-icon {
  color: var(--info);
}

/* ============================================
   UNDO TOASTS
   ============================================ */

.undo-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
}

.undo-toast {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  transform: translateX(450px);
  transition: transform 0.3s ease;
}

.undo-toast.undo-toast-show {
  transform: translateX(0);
}

.undo-toast-content {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.undo-toast-icon {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
}

.undo-toast-message {
  flex: 1;
  min-width: 0;
}

.undo-toast-message strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.undo-toast-timer {
  font-size: 13px;
  color: var(--text-tertiary);
}

.undo-timer-seconds {
  font-weight: 600;
  color: var(--accent-primary);
}

.undo-toast-btn {
  padding: 8px 16px;
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.undo-toast-btn:hover {
  background: var(--accent-hover);
}

.undo-toast-close {
  padding: 8px;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 18px;
  cursor: pointer;
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.undo-toast-close:hover {
  color: var(--text-primary);
}

.undo-toast-progress {
  height: 3px;
  background: var(--bg-tertiary);
}

.undo-toast-progress-bar {
  height: 100%;
  background: var(--accent-primary);
  transition: width 0.1s linear;
}

.undo-toast-success {
  border-color: var(--success);
}

.undo-toast-success .undo-toast-icon {
  color: var(--success);
}

.undo-toast-error {
  border-color: var(--danger);
}

.undo-toast-error .undo-toast-icon {
  color: var(--danger);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .undo-toast-container {
    bottom: 80px; /* Above mobile nav */
    right: 12px;
    left: 12px;
    max-width: none;
  }
}

/* ============================================
   GLOBAL SEARCH MODAL
   ============================================ */

.global-search-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.global-search-modal.search-modal-show {
  opacity: 1;
}

.global-search-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.global-search-container {
  position: relative;
  max-width: 700px;
  margin: 80px auto 0;
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transform: translateY(-20px);
  transition: transform 0.2s ease;
}

.search-modal-show .global-search-container {
  transform: translateY(0);
}

.global-search-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.global-search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.global-search-icon {
  font-size: 20px;
  color: var(--text-tertiary);
}

.global-search-input {
  flex: 1;
  padding: 12px 0;
  border: none;
  background: transparent;
  font-size: 18px;
  color: var(--text-primary);
  outline: none;
}

.global-search-input::placeholder {
  color: var(--text-tertiary);
}

.global-search-shortcut {
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
}

.global-search-filters {
  padding: 12px 20px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.search-filter {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.search-filter:hover {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
}

.search-filter.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.global-search-results {
  max-height: 400px;
  overflow-y: auto;
}

.search-empty-state {
  padding: 60px 20px;
  text-align: center;
}

.search-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.search-empty-state p {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0;
}

.search-empty-state small {
  font-size: 14px;
  color: var(--text-tertiary);
}

.recent-searches {
  padding: 20px;
  margin-top: 20px;
  border-top: 1px solid var(--border-color);
}

.recent-searches-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin: 0 0 12px;
}

.recent-searches-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recent-search-item {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.recent-search-item:hover {
  background: var(--bg-hover);
}

.recent-search-icon {
  color: var(--text-tertiary);
}

.recent-search-text {
  color: var(--text-secondary);
  font-size: 14px;
}

.search-results-category {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.search-results-category:last-child {
  border-bottom: none;
}

.search-category-title {
  padding: 0 20px 12px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin: 0;
}

.search-results-list {
  display: flex;
  flex-direction: column;
}

.search-result-item {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.search-result-item:hover,
.search-result-item.search-result-selected {
  background: var(--bg-hover);
}

.search-result-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.search-result-content {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.search-result-subtitle {
  font-size: 13px;
  color: var(--text-tertiary);
}

.search-result-actions {
  display: flex;
  gap: 8px;
}

.search-result-action {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-result-action:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.global-search-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.search-footer-hint {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.search-footer-hint kbd {
  padding: 4px 8px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .global-search-container {
    margin: 20px 12px 0;
    max-width: none;
  }

  .global-search-results {
    max-height: 60vh;
  }
}

/* ============================================
   KEYBOARD SHORTCUTS GUIDE
   ============================================ */

.shortcuts-guide-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.shortcuts-guide-modal.shortcuts-guide-show {
  opacity: 1;
}

.shortcuts-guide-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.shortcuts-guide-container {
  position: relative;
  max-width: 800px;
  width: 90%;
  max-height: 80vh;
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.shortcuts-guide-show .shortcuts-guide-container {
  transform: scale(1);
}

.shortcuts-guide-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.shortcuts-guide-header h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.shortcuts-guide-close {
  padding: 8px;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 24px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.shortcuts-guide-close:hover {
  color: var(--text-primary);
}

.shortcuts-guide-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.shortcuts-category {
  margin-bottom: 32px;
}

.shortcuts-category:last-child {
  margin-bottom: 0;
}

.shortcuts-category-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-primary);
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent-primary);
}

.shortcuts-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  transition: background 0.2s ease;
}

.shortcut-item:hover {
  background: var(--bg-hover);
}

.shortcut-keys {
  display: flex;
  gap: 4px;
}

.shortcut-keys kbd {
  min-width: 28px;
  padding: 4px 8px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  color: var(--text-primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.shortcut-description {
  font-size: 14px;
  color: var(--text-secondary);
}

.shortcuts-guide-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  text-align: center;
}

.shortcuts-guide-footer p {
  margin: 0;
  font-size: 13px;
  color: var(--text-tertiary);
}

.shortcuts-guide-footer kbd {
  padding: 4px 8px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  margin: 0 4px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .shortcuts-guide-container {
    width: 95%;
    max-height: 90vh;
  }

  .shortcuts-list {
    grid-template-columns: 1fr;
  }

  .shortcut-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ============================================
   GENERAL UX ENHANCEMENTS
   ============================================ */

/* Focus visible for accessibility */
*:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Loading state skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 0%,
    var(--bg-hover) 50%,
    var(--bg-tertiary) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}

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

/* Disabled state */
[disabled], .disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Helper text */
.helper-text {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 6px;
}

.helper-text.error {
  color: var(--danger);
}

.helper-text.success {
  color: var(--success);
}

/* Loading spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

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

.fade-out {
  animation: fadeOut 0.3s ease;
}

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

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

/* Slide animations */
.slide-up {
  animation: slideUp 0.3s ease;
}

.slide-down {
  animation: slideDown 0.3s ease;
}

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

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

/* Print media query */
@media print {
  .tooltip-container,
  .confirmation-dialog-overlay,
  .undo-toast-container,
  .global-search-modal,
  .shortcuts-guide-modal {
    display: none !important;
  }
}

/* ============================================
   ENHANCED UX ANIMATIONS - v2.1.1
   ============================================ */

/* Button Press Feedback */
.btn,
button:not(.no-press-effect) {
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.2s ease;
}

.btn:active,
button:not(.no-press-effect):active {
  transform: scale(0.97);
}

.btn-primary:active,
.btn-success:active,
.btn-danger:active,
.btn-warning:active {
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Ripple Effect for Buttons */
.btn::after,
.nav-item::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
  pointer-events: none;
}

.btn:active::after,
.nav-item:active::after {
  width: 200px;
  height: 200px;
  opacity: 0;
}

/* Sidebar menu bubble sizing - keep full width and avoid clipping */
.sidebar {
  padding-left: 16px;
  padding-right: 16px;
}

.sidebar .nav-item {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
  padding: 12px 16px;
}

.sidebar .nav-item:hover,
.sidebar .nav-item:focus-visible,
.sidebar .nav-item.active {
  transform: none;
}

/* Card Hover Lift Effect */
.card,
.metric-card,
.shift-card,
.staff-chip,
.day-card {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              background-color 0.3s ease,
              border-color 0.3s ease;
}

.card:hover,
.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.shift-card:hover,
.staff-chip:hover {
  transform: translateY(-1px) scale(1.01);
}

.day-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* Input Focus Glow Animation */
input:not([type="checkbox"]):not([type="radio"]),
textarea,
select {
  transition: border-color 0.2s ease,
              box-shadow 0.2s ease,
              background-color 0.2s ease;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
textarea:focus,
select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  outline: none;
}

html[data-theme='dark'] input:not([type="checkbox"]):not([type="radio"]):focus,
html[data-theme='dark'] textarea:focus,
html[data-theme='dark'] select:focus {
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25);
}

/* Enhanced Checkbox/Toggle Animation */
input[type="checkbox"] {
  position: relative;
  width: 18px;
  height: 18px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--input-bg);
  border: 2px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

input[type="checkbox"]:hover {
  border-color: var(--accent-primary);
}

input[type="checkbox"]:checked {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  animation: checkboxPop 0.3s ease;
}

input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: 700;
}

@keyframes checkboxPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Staggered List Item Animation */
.stagger-in > * {
  opacity: 0;
  transform: translateY(10px);
  animation: staggerFadeIn 0.4s ease forwards;
}

.stagger-in > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-in > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-in > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-in > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-in > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-in > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-in > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-in > *:nth-child(8) { animation-delay: 0.4s; }
.stagger-in > *:nth-child(n+9) { animation-delay: 0.45s; }

@keyframes staggerFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Badge Pulse Animation */
.badge-pulse {
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Live Indicator Pulse */
.live-indicator {
  position: relative;
}

.live-indicator::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: inherit;
  border-radius: inherit;
  transform: translate(-50%, -50%);
  animation: livePulse 1.5s ease-in-out infinite;
  z-index: -1;
}

@keyframes livePulse {
  0% {
    opacity: 0.7;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.5);
  }
}

/* Avatar Hover Effect */
.avatar,
.chip-avatar,
.staff-avatar {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.avatar:hover,
.chip-avatar:hover,
.staff-avatar:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Section Fade Transition */
.section-content,
.content-section {
  animation: sectionFadeIn 0.3s ease;
}

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

/* Enhanced Theme Toggle Button */
.theme-toggle {
  position: relative;
  overflow: hidden;
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-toggle .theme-icon {
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.theme-toggle:hover .theme-icon {
  transform: rotate(20deg);
}

/* Smooth Number Counter Animation */
.counter-animate {
  display: inline-block;
  transition: transform 0.3s ease;
}

.counter-animate.counting {
  animation: counterPop 0.3s ease;
}

@keyframes counterPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ============================================
   Employee Ratings - Star Picker + CTA
   ============================================ */

#rateEmployeeShiftCard .star-rating-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 4vw, 32px);
  padding: clamp(12px, 3vw, 28px);
  margin: 12px 0 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.12), rgba(37, 99, 235, 0.18));
  border: 1px solid rgba(147, 197, 253, 0.35);
  box-shadow: 0 24px 40px rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(6px);
}

#rateEmployeeShiftCard .star-btn {
  position: relative;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid transparent;
  border-radius: 999px;
  min-width: clamp(58px, 10vw, 78px);
  min-height: clamp(58px, 10vw, 78px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.18);
}

#rateEmployeeShiftCard .star-btn::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: inherit;
  opacity: 0;
  box-shadow: 0 0 0 rgba(251, 191, 36, 0.4);
  transition: opacity 0.25s ease, box-shadow 0.25s ease;
  pointer-events: none;
}

#rateEmployeeShiftCard .star-btn .star-icon {
  display: block;
  font-size: clamp(32px, 6vw, 60px);
  line-height: 1;
  color: #475569;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transition: color 0.2s ease, transform 0.2s ease, text-shadow 0.2s ease;
}

#rateEmployeeShiftCard .star-btn:hover {
  transform: translateY(-3px) scale(1.05);
  border-color: rgba(251, 191, 36, 0.6);
  background: rgba(251, 191, 36, 0.22);
  box-shadow: 0 20px 40px rgba(251, 191, 36, 0.25);
}

#rateEmployeeShiftCard .star-btn:hover .star-icon {
  color: #fde68a;
  text-shadow: 0 4px 14px rgba(251, 191, 36, 0.7);
  transform: scale(1.1);
}

#rateEmployeeShiftCard .star-btn.filled,
#rateEmployeeShiftCard .star-btn.active {
  background: rgba(251, 191, 36, 0.22);
  border-color: rgba(251, 191, 36, 0.55);
  box-shadow: 0 22px 44px rgba(251, 191, 36, 0.35);
}

#rateEmployeeShiftCard .star-btn.filled .star-icon,
#rateEmployeeShiftCard .star-btn.active .star-icon {
  color: #fef9c3;
  text-shadow: 0 6px 18px rgba(251, 191, 36, 0.9);
  transform: scale(1.05);
}

#rateEmployeeShiftCard .star-btn.filled::after,
#rateEmployeeShiftCard .star-btn.active::after {
  opacity: 1;
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.55), 0 0 34px rgba(251, 191, 36, 0.45);
}

html[data-theme='dark'] #rateEmployeeShiftCard .star-rating-picker {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.75), rgba(147, 197, 253, 0.1));
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: 0 30px 55px rgba(2, 6, 23, 0.75);
}

html[data-theme='dark'] #rateEmployeeShiftCard .star-btn {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(59, 130, 246, 0.2);
  box-shadow: 0 18px 42px rgba(2, 6, 23, 0.7);
}

html[data-theme='dark'] #rateEmployeeShiftCard .star-btn .star-icon {
  color: #64748b;
}

html[data-theme='dark'] #rateEmployeeShiftCard .star-btn.filled,
html[data-theme='dark'] #rateEmployeeShiftCard .star-btn.active {
  background: rgba(251, 191, 36, 0.3);
  border-color: rgba(251, 191, 36, 0.7);
  box-shadow: 0 0 32px rgba(251, 191, 36, 0.5);
}

html[data-theme='dark'] #rateEmployeeShiftCard .star-btn.filled .star-icon,
html[data-theme='dark'] #rateEmployeeShiftCard .star-btn.active .star-icon {
  color: #fef08a;
}

html[data-theme='dark'] #rateEmployeeShiftCard .star-btn.filled::after,
html[data-theme='dark'] #rateEmployeeShiftCard .star-btn.active::after {
  box-shadow: 0 0 22px rgba(251, 191, 36, 0.7), 0 0 38px rgba(251, 191, 36, 0.55);
}

@media (max-width: 640px) {
  #rateEmployeeShiftCard .star-rating-picker {
    flex-wrap: wrap;
    border-radius: 32px;
  }

  #rateEmployeeShiftCard .star-btn {
    min-width: 56px;
    min-height: 56px;
    padding: 10px;
  }

  #rateEmployeeShiftCard .star-btn .star-icon {
    font-size: 40px;
  }
}

#rateEmployeeShiftCard .star-rating-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-align: center;
  margin-top: 8px;
}

#rateEmployeeShiftCard .rating-submit-btn {
  background: linear-gradient(135deg, #93c5fd, #60a5fa);
  color: #0f172a;
  border: none;
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(96, 165, 250, 0.35);
  letter-spacing: 0.02em;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

#rateEmployeeShiftCard .rating-submit-btn:hover {
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  box-shadow: 0 20px 45px rgba(37, 99, 235, 0.45);
  transform: translateY(-2px) scale(1.01);
}

html[data-theme='dark'] #rateEmployeeShiftCard .rating-submit-btn {
  color: #020617;
  box-shadow: 0 0 32px rgba(147, 197, 253, 0.45);
}

html[data-theme='dark'] #rateEmployeeShiftCard .rating-submit-btn:hover {
  box-shadow: 0 0 40px rgba(96, 165, 250, 0.6);
  transform: translateY(-2px) scale(1.02);
}

/* Loading Dots Animation */
.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  background: var(--accent-primary);
  border-radius: 50%;
  animation: loadingDot 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes loadingDot {
  0%, 100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.3);
    opacity: 1;
  }
}

/* Success Checkmark Animation */
.success-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--success);
  border-radius: 50%;
  color: white;
  font-size: 24px;
  animation: successPop 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes successPop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Shake Animation for Errors */
.shake {
  animation: shake 0.5s ease;
}

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

/* Bounce Animation for Attention */
.bounce {
  animation: bounce 0.6s ease;
}

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

/* Smooth Scroll Indicator */
.scroll-indicator {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--accent-primary);
  transition: width 0.1s linear;
  z-index: 9999;
}

/* Tab Underline Animation */
.tab,
.comm-tab,
.swap-tab {
  position: relative;
}

.tab::after,
.comm-tab::after,
.swap-tab::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent-primary);
  transition: width 0.25s ease, left 0.25s ease;
}

.tab.active::after,
.comm-tab.active::after,
.swap-tab.active::after {
  width: 100%;
  left: 0;
}

/* Floating Action Button Animation */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: white;
  border: none;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 100;
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-xl);
}

.fab:active {
  transform: scale(0.95);
}

@media (max-width: 768px) {
  .fab {
    bottom: 88px; /* Above mobile nav */
  }
}

/* Tooltip Arrow Animation */
.tooltip-content {
  transform-origin: center bottom;
}

.tooltip-content.tooltip-show {
  animation: tooltipPop 0.2s ease;
}

@keyframes tooltipPop {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(-5px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Fix for Team Management Save Button to match Submit Rating button */
.team-save-btn {
  background: linear-gradient(135deg, #93c5fd, #60a5fa) !important;
  color: #0f172a !important;
  border: none !important;
  box-shadow: 0 18px 40px rgba(96, 165, 250, 0.35) !important;
  font-weight: 700 !important;
}

.team-save-btn:hover {
  background: linear-gradient(135deg, #60a5fa, #3b82f6) !important;
  box-shadow: 0 20px 45px rgba(37, 99, 235, 0.45) !important;
  transform: translateY(-2px) scale(1.01) !important;
}

html[data-theme='dark'] .team-save-btn {
  color: #020617 !important;
  box-shadow: 0 0 32px rgba(147, 197, 253, 0.45) !important;
}

html[data-theme='dark'] .team-save-btn:hover {
  box-shadow: 0 0 40px rgba(96, 165, 250, 0.6) !important;
}
