/**
 * Driver App Custom Styles
 * Professional UI enhancements and animations
 */

/* === CSS Custom Properties === */
:root {
  /* Color Palette */
  --color-primary: #10b981;
  --color-primary-dark: #059669;
  --color-secondary: #3b82f6;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  --color-purple: #8b5cf6;
  --color-teal: #14b8a6;

  /* Status Colors */
  --status-pending: #f59e0b;
  --status-picked-up: #3b82f6;
  --status-out-for-delivery: #8b5cf6;
  --status-delivered: #10b981;
  --status-completed: #059669;

  /* Gray Scale */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.3);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
}

/* === Base Styles === */
* {
  -webkit-tap-highlight-color: transparent;
}

body {
  font-size: 16px;
  line-height: 1.5;
}

/* === Enhanced Delivery Cards === */
.delivery-card {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.delivery-card:active {
  transform: scale(0.98);
}

.delivery-card:hover {
  box-shadow: var(--shadow-2xl);
}

.delivery-card-enter {
  animation: slideUp 0.3s ease-out;
}

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

/* === Pending Pickups Section === */
#pending-pickups-section {
  animation: slideDown 0.4s ease-out;
}

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

.pending-mini-card {
  transition: all var(--transition-base);
}

.pending-mini-card:hover {
  transform: translateX(4px);
  border-color: var(--color-primary) !important;
  background: rgba(16, 185, 129, 0.1);
}

/* === Status Badges === */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.status-badge-pending {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #78350f;
}

.status-badge-picked-up {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  color: #ffffff;
}

.status-badge-out-for-delivery {
  background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
  color: #ffffff;
  animation: pulse 2s ease-in-out infinite;
}

.status-badge-delivered {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  color: #064e3b;
}

.status-badge-completed {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #064e3b;
}

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

/* === Button Enhancements === */
.btn {
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--color-secondary) 0%, #2563eb 100%);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary:hover {
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

.btn-purple {
  background: linear-gradient(135deg, var(--color-purple) 0%, #7c3aed 100%);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-purple:hover {
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--gray-600);
  color: var(--gray-300);
}

.btn-outline:hover {
  border-color: var(--gray-500);
  background: var(--gray-800);
}

/* === Filter Tabs === */
.tab-button {
  position: relative;
  transition: all var(--transition-base);
}

.tab-button:not(.tab-active) {
  color: var(--gray-400);
  background: var(--gray-800);
}

.tab-button:not(.tab-active):hover {
  color: var(--gray-200);
  background: var(--gray-700);
}

.tab-active {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.tab-active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: white;
  border-radius: 3px 3px 0 0;
}

/* === Header Enhancements === */
.app-header {
  background: linear-gradient(180deg, var(--gray-800) 0%, var(--gray-900) 100%);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.connection-indicator {
  transition: all var(--transition-base);
}

.connection-indicator.connected .status-dot {
  background: var(--color-primary);
  animation: pulse 2s ease-in-out infinite;
}

.connection-indicator.connecting .status-dot {
  background: var(--color-warning);
  animation: blink 1s ease-in-out infinite;
}

.connection-indicator.disconnected .status-dot {
  background: var(--color-danger);
}

@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* === Route Optimizer Button === */
.route-optimizer-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
  animation: subtle-float 3s ease-in-out infinite;
}

.route-optimizer-btn:hover {
  box-shadow: 0 15px 35px rgba(59, 130, 246, 0.4);
  transform: translateY(-2px);
}

@keyframes subtle-float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-3px);
  }
}

/* === SMS Button === */
.sms-button {
  background: linear-gradient(135deg, var(--color-teal) 0%, #0d9488 100%);
  box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
  position: relative;
  overflow: hidden;
}

.sms-button:hover {
  box-shadow: 0 6px 20px rgba(20, 184, 166, 0.4);
  transform: translateY(-1px);
}

.sms-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.sms-button:hover::before {
  left: 100%;
}

/* === Completed Section === */
.completed-card {
  opacity: 0.7;
  filter: grayscale(0.3);
}

.completed-card:hover {
  opacity: 0.9;
  filter: grayscale(0);
}

/* === Empty State === */
.empty-state-icon {
  animation: float 3s ease-in-out infinite;
}

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

/* === Loading States === */
.skeleton {
  background: linear-gradient(90deg, var(--gray-800) 25%, var(--gray-700) 50%, var(--gray-800) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
}

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

/* === Modal Enhancements === */
.modal-backdrop {
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  animation: scaleIn 0.3s var(--transition-spring);
}

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

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

/* === Details Section === */
.details-section {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow) ease-out;
}

.details-section.open {
  max-height: 1000px;
}

/* === Focus States for Accessibility === */
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

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

/* === Touch Feedback === */
@media (hover: none) {
  .btn:active,
  .tab-button:active {
    transform: scale(0.96);
  }
}

/* === Badge Counters === */
.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.375rem;
  background: var(--color-danger);
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* === Success Animations === */
@keyframes successPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 20px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.success-pulse {
  animation: successPulse 0.6s ease-out;
}

/* === Custom Scrollbar === */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--gray-900);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-700);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-600);
}

/* === Numeric Font for Money === */
.money-value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* === Improved Text Hierarchy === */
.text-hierarchy-1 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.text-hierarchy-2 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
}

.text-hierarchy-3 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

/* === Utility Classes === */
.gradient-text {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.glass-effect {
  background: rgba(31, 41, 55, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
