/* ============================================
   IWANNA Call - Custom Styles
   Agent Switch VoIP Platform
   ============================================ */

/* === Incoming Call Pulse Animation === */
@keyframes incoming-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(58, 173, 40, 0.4);
  }
  50% {
    box-shadow: 0 0 0 20px rgba(58, 173, 40, 0);
  }
}

@keyframes incoming-glow {
  0%, 100% {
    box-shadow: 0 0 15px rgba(58, 173, 40, 0.2), 0 0 30px rgba(58, 173, 40, 0.1);
  }
  50% {
    box-shadow: 0 0 25px rgba(58, 173, 40, 0.4), 0 0 50px rgba(58, 173, 40, 0.2);
  }
}

.incoming-call-pulse {
  animation: incoming-pulse 1.5s ease-in-out infinite;
}

.incoming-call-glow {
  animation: incoming-glow 2s ease-in-out infinite;
}

.answer-btn-pulse {
  animation: incoming-pulse 1.5s ease-in-out infinite;
}

/* === Status Indicator Animations === */
@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.status-online .status-dot-anim {
  animation: status-pulse 2s ease-in-out infinite;
}

/* === SIP Connection Status Colors === */
.sip-connected {
  background-color: rgba(58, 173, 40, 0.1);
  border-color: rgba(58, 173, 40, 0.3);
}
.sip-connected .status-dot { background-color: #3aad28; }
.sip-connected .status-label { color: #3aad28; }

.sip-break {
  background-color: rgba(240, 192, 0, 0.1);
  border-color: rgba(240, 192, 0, 0.3);
}
.sip-break .status-dot { background-color: #f0c000; }
.sip-break .status-label { color: #f0c000; }

.sip-offline {
  background-color: rgba(107, 114, 128, 0.1);
  border-color: rgba(107, 114, 128, 0.3);
}
.sip-offline .status-dot { background-color: #6b7280; }
.sip-offline .status-label { color: #6b7280; }

/* === Call Timer === */
.call-timer-active {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

/* === MOS Quality Bars === */
.mos-bar {
  transition: background-color 0.3s ease;
}
.mos-excellent .mos-bar { background-color: #3aad28; }
.mos-good .mos-bar:nth-child(-n+4) { background-color: #3aad28; }
.mos-fair .mos-bar:nth-child(-n+3) { background-color: #f0c000; }
.mos-poor .mos-bar:nth-child(-n+2) { background-color: #ef4444; }
.mos-bad .mos-bar:nth-child(1) { background-color: #ef4444; }

/* === Smooth Transitions === */
.transition-state {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.state-enter {
  opacity: 0;
  transform: scale(0.95) translateY(10px);
}

.state-enter-active {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* === Shake Animation (Login Error) === */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.animate-shake {
  animation: shake 0.5s ease-in-out;
}

/* === Modal Animation === */
@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.animate-modal-in {
  animation: modal-in 0.2s ease-out;
}

/* === Scrollbar Styling (Dark Theme) === */
.bg-selva ::-webkit-scrollbar,
[class*="bg-selva"] ::-webkit-scrollbar {
  width: 6px;
}

.bg-selva ::-webkit-scrollbar-track,
[class*="bg-selva"] ::-webkit-scrollbar-track {
  background: rgba(26, 46, 18, 0.5);
}

.bg-selva ::-webkit-scrollbar-thumb,
[class*="bg-selva"] ::-webkit-scrollbar-thumb {
  background: rgba(42, 74, 31, 0.8);
  border-radius: 3px;
}

.bg-selva ::-webkit-scrollbar-thumb:hover,
[class*="bg-selva"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(58, 173, 40, 0.5);
}

/* === Earnings Highlight === */
.earnings-value {
  color: #f0c000;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* === Break Mode Overlay === */
@keyframes break-breathe {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.break-icon-pulse {
  animation: break-breathe 3s ease-in-out infinite;
}

/* === Ripple Effect for Buttons === */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255,255,255,0.3), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-ripple:active::after {
  opacity: 1;
}

/* === Mobile Optimizations === */
@media (max-width: 640px) {
  /* Prevent zoom on input focus (iOS) */
  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="email"],
  select,
  textarea {
    font-size: 16px;
  }

  /* Larger tap targets on mobile */
  .mobile-tap-target {
    min-height: 44px;
    min-width: 44px;
  }
}

/* === Loading Skeleton === */
@keyframes skeleton-loading {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, #1a2e12 25%, #2a4a1f 50%, #1a2e12 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-light {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}

/* === Number formatting === */
.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* ============================================
   Dashboard SPA Styles
   ============================================ */

/* === Navbar Dropdown Animation === */
.nav-dropdown .nav-panel {
  display: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.nav-dropdown:hover .nav-panel,
.nav-dropdown .nav-panel.show {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* === SPA Section Transitions === */
.section {
  display: none;
}

.section.active {
  display: block;
  animation: sectionFadeIn 0.2s ease-out;
}

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

/* === Impersonation Banner === */
#impersonation-banner {
  background-color: #f0c000;
  color: #0a1507;
  z-index: 60;
}

/* === Money Values (Cali Yellow) === */
.money {
  color: #f0c000;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* === Status Badges === */
.badge-active { background: rgba(58, 173, 40, 0.1); color: #3aad28; }
.badge-inactive { background: rgba(107, 114, 128, 0.1); color: #6b7280; }
.badge-blocked { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.badge-sell { background: rgba(58, 173, 40, 0.1); color: #3aad28; }
.badge-cost { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.badge-percentage { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.badge-priority { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.badge-acd { background: rgba(58, 173, 40, 0.1); color: #3aad28; }

/* === Table Hover Effect === */
.tbl-hover tr:hover td {
  background-color: rgba(58, 173, 40, 0.02);
}

/* === Dashboard Card Hover === */
.kpi-card {
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.kpi-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

/* === Toast Notification === */
#toast {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Scrollbar Styling (Light Theme) === */
.overflow-x-auto::-webkit-scrollbar {
  height: 4px;
}

.overflow-x-auto::-webkit-scrollbar-track {
  background: #f3f4f6;
}

.overflow-x-auto::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 2px;
}

.overflow-x-auto::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* === Mobile Nav Drawer === */
@media (max-width: 1023px) {
  #mobile-nav-drawer {
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  }
}

/* === Country Destinations Expand Arrow === */
.country-arrow {
  transition: transform 0.2s ease;
}

/* === Footer bar === */
footer {
  font-variant-numeric: tabular-nums;
}
