/* =============================================
   Zeekr Call Dashboard - Design System
   ============================================= */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* CSS Variables */
:root {
  /* Colors - Dark Premium Theme */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a26;
  --bg-card-hover: #222233;
  --bg-glass: rgba(26, 26, 38, 0.8);

  /* Accent - Zeekr-inspired blue/cyan */
  --accent-primary: #00d4ff;
  --accent-secondary: #7c3aed;
  --accent-gradient: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
  --accent-glow: 0 0 20px rgba(0, 212, 255, 0.3);

  /* Status Colors */
  --status-new: #00d4ff;
  --status-new-bg: rgba(0, 212, 255, 0.1);
  --status-viewed: #f59e0b;
  --status-viewed-bg: rgba(245, 158, 11, 0.1);
  --status-completed: #10b981;
  --status-completed-bg: rgba(16, 185, 129, 0.1);

  /* Text */
  --text-primary: #f0f0f5;
  --text-secondary: #8888a0;
  --text-muted: #55556a;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(0, 212, 255, 0.3);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background ambient effect */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 20%, rgba(0, 212, 255, 0.04) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(124, 58, 237, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ============ LAYOUT ============ */

.app-container {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-lg);
  min-height: 100vh;
}

/* ============ HEADER ============ */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  margin-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border-subtle);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-logo {
  width: 40px;
  height: 40px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: white;
  letter-spacing: -1px;
}

.header-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.header-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* Connection Status Indicator */
.connection-status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-completed);
  animation: pulse-dot 2s ease-in-out infinite;
}

.connection-dot.disconnected {
  background: #ef4444;
  animation: none;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* Nav link */
.nav-link {
  font-size: 0.8rem;
  color: var(--accent-primary);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-accent);
  transition: var(--transition-fast);
  font-weight: 500;
}

.nav-link:hover {
  background: rgba(0, 212, 255, 0.1);
  box-shadow: var(--accent-glow);
}

/* ============ SECTION TITLES ============ */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.section-title .icon {
  font-size: 1rem;
}

.section-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 500;
}

/* ============ CALL CARDS ============ */

.cards-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.call-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
  cursor: default;
}

.call-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent-gradient);
  border-radius: 0 2px 2px 0;
  opacity: 0;
  transition: var(--transition-normal);
}

.call-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  transform: translateY(-1px);
}

.call-card:hover::before {
  opacity: 1;
}

/* New card entrance animation */
.call-card.card-enter {
  animation: cardSlideIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

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

/* New card pulse highlight */
.call-card.card-new {
  border-color: var(--accent-primary);
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.15),
              inset 0 0 30px rgba(0, 212, 255, 0.03);
  animation: cardSlideIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards,
             newCardGlow 2s ease-in-out 0.5s 3;
}

@keyframes newCardGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(0, 212, 255, 0.1); }
  50% { box-shadow: 0 0 40px rgba(0, 212, 255, 0.25), inset 0 0 20px rgba(0, 212, 255, 0.05); }
}

/* Card header */
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.client-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.client-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.client-phone {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', monospace;
}

.client-phone .phone-icon {
  font-size: 0.75rem;
}

/* Status badge */
.status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.status-badge.new {
  color: var(--status-new);
  background: var(--status-new-bg);
  border: 1px solid rgba(0, 212, 255, 0.2);
}

.status-badge.viewed {
  color: var(--status-viewed);
  background: var(--status-viewed-bg);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-badge.completed {
  color: var(--status-completed);
  background: var(--status-completed-bg);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Card summary */
.card-summary {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.02);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: var(--space-md);
}

/* Card footer */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-actions {
  display: flex;
  gap: var(--space-sm);
}

.btn-action {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: 'Inter', sans-serif;
}

.btn-action:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(0, 212, 255, 0.05);
}

.btn-action.btn-complete {
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--status-completed);
}

.btn-action.btn-complete:hover {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--status-completed);
}

/* ============ EMPTY STATE ============ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-lg);
  opacity: 0.4;
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.empty-state-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.6;
}

/* ============ NOTIFICATION TOAST ============ */

.notification-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-card);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), var(--accent-glow);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  backdrop-filter: blur(20px);
}

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

.notification-toast .toast-icon {
  font-size: 1.5rem;
}

.notification-toast .toast-text {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.notification-toast .toast-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ============ LOADING SKELETON ============ */

.skeleton-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

.skeleton-line {
  height: 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  margin-bottom: var(--space-sm);
}

.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-30 { width: 30%; }
.skeleton-line.w-100 { width: 100%; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.h-lg { height: 20px; }

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

/* ============ HISTORICO PAGE ============ */

.filters-bar {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.filter-btn {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: 'Inter', sans-serif;
}

.filter-btn:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-color: var(--accent-primary);
  font-weight: 600;
}

.search-input {
  flex: 1;
  min-width: 200px;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: var(--transition-fast);
}

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

.search-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

/* Stats bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: var(--space-xs);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
  padding: var(--space-md) 0;
}

.page-btn {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: 'Inter', sans-serif;
}

.page-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.page-btn.active {
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-color: var(--accent-primary);
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0 var(--space-sm);
}

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

@media (max-width: 640px) {
  .app-container {
    padding: var(--space-md);
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .card-header {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .card-footer {
    flex-direction: column;
    gap: var(--space-sm);
    align-items: flex-start;
  }

  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }
}
