/* ==========================================================================
   Edunexsys Android Companion Bridge - Mobile PWA Styling
   ========================================================================== */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  --dark: #0f172a;
  --dark-surface: #1e293b;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --bg-page: #f1f5f9;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.4;
  font-size: 14px;
  padding-bottom: 30px;
  user-select: none;
}

.hidden {
  display: none !important;
}

/* App Header */
.app-header {
  background: var(--dark);
  color: white;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-logo {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: white;
}

.app-title-box h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.app-title-box p {
  font-size: 11px;
  color: #94a3b8;
}

.header-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
}

.status-dot.online {
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
  animation: pulseGreen 1.5s infinite;
}

.status-dot.ringing {
  background: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.3);
  animation: pulseAmber 0.8s infinite;
}

@keyframes pulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulseAmber {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* Main Container */
.container {
  max-width: 460px;
  margin: 0 auto;
  padding: 14px;
}

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* PIN Entry UI */
.pin-input-group {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 16px 0;
}

.pin-input {
  width: 44px;
  height: 52px;
  font-size: 24px;
  font-weight: 800;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  font-family: monospace;
}

.pin-input:focus {
  border-color: var(--primary);
  background: white;
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:active {
  background: var(--primary-hover);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-outline {
  background: white;
  border-color: var(--border);
  color: var(--text-main);
}

.btn-outline-danger {
  background: white;
  border-color: #fca5a5;
  color: #dc2626;
}

.btn-lg {
  padding: 14px 20px;
  font-size: 16px;
  border-radius: var(--radius-md);
}

/* Active Call Full Screen / Prominent Alert */
.active-call-card {
  background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-lg);
  border: 2px solid #6366f1;
  animation: callGlow 2s infinite alternate;
}

@keyframes callGlow {
  0% { box-shadow: 0 0 10px rgba(99, 102, 241, 0.3); }
  100% { box-shadow: 0 0 24px rgba(99, 102, 241, 0.7); }
}

.call-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.lead-name-call {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 2px;
}

.lead-phone-call {
  font-size: 16px;
  font-family: monospace;
  color: #93c5fd;
  margin-bottom: 14px;
}

.lead-context-box {
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

.lead-context-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.lead-context-row:last-child {
  margin-bottom: 0;
}

.call-timer-big {
  font-family: 'Courier New', Courier, monospace;
  font-size: 38px;
  font-weight: 800;
  text-align: center;
  color: #34d399;
  margin: 12px 0 18px 0;
  letter-spacing: 2px;
}

/* Telemetry Grid */
.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
  margin-top: 10px;
}

.telemetry-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
}

.telemetry-val {
  font-weight: 700;
  font-size: 13px;
  color: var(--dark);
}

.telemetry-lbl {
  font-size: 11px;
  color: var(--text-muted);
}

/* Toast */
.toast-msg {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e293b;
  color: white;
  padding: 10px 20px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  z-index: 1000;
  max-width: 90%;
  text-align: center;
}

.toast-msg.show {
  transform: translateX(-50%) translateY(0);
}
