/**
 * UI Enhancements - Advanced features for CPM-25 Dashboard
 */

/* ===== LOADING STATES & SKELETONS ===== */

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.1) 25%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0.1) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 0.5rem;
}

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

.skeleton-card {
  height: 120px;
  margin-bottom: 1rem;
}

.skeleton-text {
  height: 20px;
  margin-bottom: 0.5rem;
  width: 100%;
}

.skeleton-text.short {
  width: 60%;
}

/* ===== SEARCH BAR ===== */

.search-container {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-bar {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
  color: white;
  font-size: 1rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.search-bar:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.search-bar::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.2rem;
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.search-clear:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.search-clear.visible {
  display: flex;
}

/* ===== SORTABLE TABLE ===== */

.sortable-header {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 1.5rem !important;
  transition: all 0.2s ease;
}

.sortable-header:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sort-indicator {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
  font-size: 0.8rem;
}

.sort-indicator.active {
  opacity: 1;
  color: #4F46E5;
}

/* ===== LAST UPDATED INDICATOR ===== */

.last-updated {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.875rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: fadeIn 0.3s ease;
}

.last-updated .pulse-dot {
  width: 8px;
  height: 8px;
  background: #10B981;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

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

/* ===== QUICK ACTIONS MENU ===== */

.quick-actions {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
}

.fab-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab-button:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.fab-menu {
  position: absolute;
  bottom: 80px;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.fab-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.fab-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 2rem;
  color: #1F2937;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}

.fab-menu-item:hover {
  transform: translateX(-5px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  background: white;
}

.fab-menu-item .icon {
  font-size: 1.2rem;
}

/* ===== SMOOTH PAGE TRANSITIONS ===== */

.page-transition {
  animation: fadeInUp 0.6s ease-out;
}

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

.fade-in {
  animation: fadeIn 0.4s ease-out;
}

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

/* ===== IMPROVED TOAST NOTIFICATIONS ===== */

.toast-container {
  position: fixed;
  top: 80px;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 1rem 1.5rem;
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 1rem;
  animation: slideInRight 0.4s ease-out;
  border-left: 4px solid;
  min-width: 300px;
}

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

.toast.hiding {
  animation: slideOutRight 0.3s ease-in;
}

@keyframes slideOutRight {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

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

.toast.error {
  border-left-color: #EF4444;
}

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

.toast.warning {
  border-left-color: #F59E0B;
}

.toast-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.toast.success .toast-icon { color: #10B981; }
.toast.error .toast-icon { color: #EF4444; }
.toast.info .toast-icon { color: #3B82F6; }
.toast.warning .toast-icon { color: #F59E0B; }

.toast-content {
  flex: 1;
  color: #1F2937;
}

.toast-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.toast-message {
  font-size: 0.875rem;
  color: #6B7280;
}

.toast-close {
  background: none;
  border: none;
  color: #9CA3AF;
  cursor: pointer;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
  transition: color 0.2s ease;
}

.toast-close:hover {
  color: #1F2937;
}

/* ===== EMPTY STATES ===== */

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: rgba(255, 255, 255, 0.9);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.7;
}

.empty-state-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: white;
}

.empty-state-description {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 1.5rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.empty-state-action {
  margin-top: 1.5rem;
}

/* ===== USER PROFILE DROPDOWN ===== */
/* Note: User profile styles are now in carrier-theme.css for consistency */

/* ===== KEYBOARD SHORTCUTS DIALOG ===== */

.shortcuts-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
}

.shortcuts-dialog.open {
  opacity: 1;
  visibility: visible;
}

.shortcuts-content {
  background: white;
  border-radius: 1rem;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.shortcuts-header {
  padding: 1.5rem;
  border-bottom: 1px solid #E5E7EB;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.shortcuts-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1F2937;
  margin: 0;
}

.shortcuts-close {
  background: none;
  border: none;
  color: #6B7280;
  cursor: pointer;
  font-size: 1.5rem;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.shortcuts-close:hover {
  background: #F3F4F6;
  color: #1F2937;
}

.shortcuts-body {
  padding: 1.5rem;
}

.shortcuts-group {
  margin-bottom: 1.5rem;
}

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

.shortcuts-group-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.shortcut-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  border-radius: 0.5rem;
  transition: background 0.2s ease;
}

.shortcut-item:hover {
  background: #F9FAFB;
}

.shortcut-description {
  color: #1F2937;
  font-size: 0.875rem;
}

.shortcut-keys {
  display: flex;
  gap: 0.5rem;
}

.shortcut-key {
  padding: 0.25rem 0.5rem;
  background: #F3F4F6;
  border: 1px solid #E5E7EB;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-family: monospace;
  color: #1F2937;
  font-weight: 600;
  min-width: 28px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ===== UTILITY CLASSES ===== */

.hoverable {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hoverable:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.interactive {
  cursor: pointer;
  user-select: none;
}

.no-results {
  text-align: center;
  padding: 2rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1rem;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
  .search-bar {
    font-size: 0.875rem;
  }

  .fab-button {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
  }

  .quick-actions {
    bottom: 1rem;
    right: 1rem;
  }

  .toast-container {
    right: 1rem;
    left: 1rem;
    max-width: none;
  }

  .toast {
    min-width: auto;
  }

  .shortcuts-content {
    width: 95%;
    max-height: 90vh;
  }
}

