/* AgencyOS Calling Widget — v1.0 */

:root {
  --aoc-bg:         #1a1a2e;
  --aoc-bg-header:  #16213e;
  --aoc-accent:     #6c63ff;
  --aoc-green:      #22c55e;
  --aoc-amber:      #f59e0b;
  --aoc-red:        #ef4444;
  --aoc-muted:      #94a3b8;
  --aoc-text:       #f1f5f9;
  --aoc-text-sub:   #94a3b8;
  --aoc-radius:     14px;
  --aoc-shadow:     0 8px 32px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.3);
  --aoc-width:      280px;
}

/* ── Widget container ─────────────────────────────────────────────────────── */

.aoc-widget {
  position:     fixed;
  bottom:       24px;
  right:        24px;
  width:        var(--aoc-width);
  background:   var(--aoc-bg);
  border-radius: var(--aoc-radius);
  box-shadow:   var(--aoc-shadow);
  font-family:  -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size:    14px;
  color:        var(--aoc-text);
  z-index:      99999;
  overflow:     hidden;
  transition:   opacity 0.2s ease, transform 0.2s ease;
  border:       1px solid rgba(255,255,255,0.06);
  user-select:  none;
}

.aoc-widget.aoc-hidden {
  opacity:   0;
  pointer-events: none;
  transform: translateY(8px);
}

/* ── Header ───────────────────────────────────────────────────────────────── */

.aoc-header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         10px 14px;
  background:      var(--aoc-bg-header);
  border-bottom:   1px solid rgba(255,255,255,0.06);
}

.aoc-header-left {
  display:     flex;
  align-items: center;
  gap:         8px;
}

.aoc-header-right {
  display:     flex;
  align-items: center;
  gap:         4px;
}

.aoc-title {
  font-size:   12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color:       var(--aoc-text-sub);
  text-transform: uppercase;
}

/* ── Status dot ───────────────────────────────────────────────────────────── */

.aoc-dot {
  width:         8px;
  height:        8px;
  border-radius: 50%;
  flex-shrink:   0;
  transition:    background-color 0.3s ease;
}

.aoc-dot-idle        { background: var(--aoc-muted); }
.aoc-dot-connecting  { background: var(--aoc-amber); animation: aoc-pulse 1s infinite; }
.aoc-dot-ringing     { background: var(--aoc-amber); animation: aoc-pulse 0.6s infinite; }
.aoc-dot-connected   { background: var(--aoc-green); }
.aoc-dot-muted       { background: var(--aoc-amber); }
.aoc-dot-failed      { background: var(--aoc-red); }

@keyframes aoc-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

/* ── Body ─────────────────────────────────────────────────────────────────── */

.aoc-body {
  display:        flex;
  flex-direction: column;
  align-items:    center;
  padding:        20px 16px 18px;
  gap:            6px;
}

/* ── Phone number display ─────────────────────────────────────────────────── */

.aoc-number {
  font-size:   22px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color:       var(--aoc-text);
  min-height:  28px;
  text-align:  center;
}

/* ── Status text ──────────────────────────────────────────────────────────── */

.aoc-status {
  font-size:  12px;
  color:      var(--aoc-text-sub);
  text-align: center;
}

/* ── Call timer ───────────────────────────────────────────────────────────── */

.aoc-timer {
  font-size:   18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color:       var(--aoc-green);
  margin-top:  4px;
}

/* ── Controls row ─────────────────────────────────────────────────────────── */

.aoc-controls {
  display:     flex;
  align-items: center;
  justify-content: center;
  gap:         16px;
  margin-top:  12px;
}

/* ── Icon button (mute) ───────────────────────────────────────────────────── */

.aoc-btn-icon {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           42px;
  height:          42px;
  border-radius:   50%;
  border:          none;
  background:      rgba(255,255,255,0.08);
  color:           var(--aoc-text);
  cursor:          pointer;
  transition:      background 0.15s ease, color 0.15s ease;
}

.aoc-btn-icon:hover {
  background: rgba(255,255,255,0.14);
}

.aoc-btn-icon.aoc-btn-muted {
  background: var(--aoc-amber);
  color:      #000;
}

/* ── Hang-up button ───────────────────────────────────────────────────────── */

.aoc-btn-hangup {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           56px;
  height:          56px;
  border-radius:   50%;
  border:          none;
  background:      var(--aoc-red);
  color:           #fff;
  cursor:          pointer;
  transition:      background 0.15s ease, transform 0.1s ease;
  box-shadow:      0 4px 12px rgba(239,68,68,0.45);
}

.aoc-btn-hangup:hover {
  background: #dc2626;
  transform:  scale(1.06);
}

.aoc-btn-hangup:active {
  transform: scale(0.96);
}

/* ── Ghost button (header) ────────────────────────────────────────────────── */

.aoc-btn-ghost {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           26px;
  height:          26px;
  border-radius:   6px;
  border:          none;
  background:      transparent;
  color:           var(--aoc-text-sub);
  cursor:          pointer;
  transition:      background 0.15s ease;
}

.aoc-btn-ghost:hover {
  background: rgba(255,255,255,0.08);
  color:      var(--aoc-text);
}

/* ── Mobile overrides ─────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .aoc-widget {
    bottom: 0;
    right:  0;
    left:   0;
    width:  100%;
    border-radius: var(--aoc-radius) var(--aoc-radius) 0 0;
  }

  .aoc-body {
    padding-bottom: 28px; /* safe area for iPhone home bar */
  }
}

/* ── Reduced-motion ───────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .aoc-dot-connecting,
  .aoc-dot-ringing {
    animation: none;
  }

  .aoc-widget,
  .aoc-btn-hangup {
    transition: none;
  }
}
