/* ============================================
   UX POLISH SYSTEM
   Level 4 improvements:
   1. Smooth Transitions (GLOBAL_MOTION_SYSTEM)
   2. Empty States
   3. Contextual Help (Tooltips)
   ============================================ */

/* ============================================
   1. SMOOTH TRANSITIONS
   zgodnie z GLOBAL_MOTION_SYSTEM.md
   ============================================ */

/* SECTION NAV: fade + micro-slide (200-300ms) */
.tab-content {
  animation: sectionFadeIn 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* INTERNAL NAV: micro-transition tabs (120-180ms) */
.content-transition {
  animation: contentCrossFade 150ms ease-out;
}

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

/* Card hover transitions */
.premium-card,
.tile,
.employee-card {
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Button interactions */
button,
.btn,
.btn-primary,
.btn-secondary {
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Input focus transitions */
input:focus,
select:focus,
textarea:focus {
  transition: border-color 150ms ease-out,
              box-shadow 150ms ease-out;
}

/* ============================================
   2. EMPTY STATES
   Przyjazne komunikaty gdy brak danych
   ============================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  text-align: center;
  color: var(--text-secondary);
  background: rgba(31, 41, 55, 0.3);
  border-radius: 16px;
  border: 2px dashed rgba(59, 130, 246, 0.2);
  min-height: 400px;
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 24px;
  opacity: 0.6;
  line-height: 1;
}

.empty-state-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.empty-state-description {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 32px;
  max-width: 500px;
  color: var(--text-secondary);
}

.empty-state-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.empty-state-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
  filter: brightness(1.1);
}

.empty-state-action-icon {
  font-size: 1.2rem;
}

/* Empty state variants */
.empty-state.compact {
  padding: 40px 24px;
  min-height: 300px;
}

.empty-state.compact .empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.empty-state.compact .empty-state-title {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.empty-state.compact .empty-state-description {
  font-size: 0.95rem;
  margin-bottom: 24px;
}

/* ============================================
   3. CONTEXTUAL HELP (TOOLTIPS)
   Tooltips dla inputów i przycisków
   ============================================ */

/* Tooltip container */
.tooltip-container {
  position: relative;
  display: inline-block;
}

/* Tooltip trigger (question mark icon) */
.tooltip-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 50%;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: help;
  transition: all 150ms ease-out;
  vertical-align: middle;
}

.tooltip-trigger:hover {
  background: rgba(59, 130, 246, 0.3);
  border-color: rgba(59, 130, 246, 0.5);
  transform: scale(1.1);
}

/* Tooltip content (hidden by default) */
.tooltip-content {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(31, 41, 55, 0.98) 0%, rgba(17, 24, 39, 1) 100%);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: nowrap;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 150ms ease-out, visibility 150ms ease-out, transform 150ms ease-out;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Arrow */
.tooltip-content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(31, 41, 55, 0.98);
}

/* Show tooltip on hover */
.tooltip-container:hover .tooltip-content {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-4px);
}

/* Tooltip positioning variants */
.tooltip-content.tooltip-right {
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  bottom: auto;
}

.tooltip-content.tooltip-right::after {
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 6px solid rgba(31, 41, 55, 0.98);
  border-left: none;
}

.tooltip-container:hover .tooltip-content.tooltip-right {
  transform: translateY(-50%) translateX(4px);
}

.tooltip-content.tooltip-left {
  right: calc(100% + 8px);
  left: auto;
  top: 50%;
  transform: translateY(-50%);
  bottom: auto;
}

.tooltip-content.tooltip-left::after {
  right: -6px;
  left: auto;
  top: 50%;
  transform: translateY(-50%);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 6px solid rgba(31, 41, 55, 0.98);
  border-right: none;
}

.tooltip-container:hover .tooltip-content.tooltip-left {
  transform: translateY(-50%) translateX(-4px);
}

/* Multiline tooltips */
.tooltip-content.multiline {
  white-space: normal;
  max-width: 300px;
  text-align: left;
}

/* Inline help text (subtle hints below inputs) */
.help-text {
  display: block;
  margin-top: 6px;
  font-size: 0.875rem;
  color: var(--text-tertiary);
  line-height: 1.4;
}

.help-text.info {
  color: rgba(6, 182, 212, 0.8);
}

.help-text.warning {
  color: rgba(245, 158, 11, 0.8);
}

.help-text.error {
  color: rgba(239, 68, 68, 0.8);
}

/* Icon in help text */
.help-text::before {
  content: 'ℹ️';
  margin-right: 4px;
  font-size: 0.8rem;
}

.help-text.warning::before {
  content: '⚠️';
}

.help-text.error::before {
  content: '❌';
}

/* ============================================
   LOADING STATES (bonus)
   Skeleton loaders dla lepszego UX
   ============================================ */

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(31, 41, 55, 0.4) 25%,
    rgba(55, 65, 81, 0.6) 50%,
    rgba(31, 41, 55, 0.4) 75%
  );
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s ease-in-out infinite;
  border-radius: 8px;
}

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

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-text.large {
  height: 24px;
}

.skeleton-text.small {
  height: 12px;
}

.skeleton-card {
  height: 120px;
  border-radius: 12px;
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

/* ============================================
   INTEGRATIONS - HISTORY TABLE FIX
   ============================================ */

#integrationsView .integration-card-history {
  grid-column: 1 / -1;
  min-height: auto !important;
}

#allegroImportHistory,
#erliSyncHistory {
  overflow-x: auto;
}

#allegroImportHistory .history-table,
#erliSyncHistory .history-table {
  width: 100%;
  min-width: 760px;
  table-layout: auto;
}

#allegroImportHistory .history-table th,
#allegroImportHistory .history-table td,
#erliSyncHistory .history-table th,
#erliSyncHistory .history-table td {
  white-space: nowrap;
}

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

@media (max-width: 768px) {
  .empty-state {
    padding: 40px 24px;
    min-height: 350px;
  }
  
  .empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
  }
  
  .empty-state-title {
    font-size: 1.25rem;
  }
  
  .empty-state-description {
    font-size: 0.95rem;
    margin-bottom: 24px;
  }
  
  .tooltip-content {
    max-width: 250px;
    white-space: normal;
    text-align: center;
  }
}

/* ENTERPRISE PATCH — HARD EDGES */
*,
*::before,
*::after {
  border-radius: 0 !important;
}
