/*
 * ZCC Smart Embed + Zoho CRM Widget Styles
 * Designed to run as a Zoho CRM Web Tab widget
 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  color: #333;
  background: #f5f6fa;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── Header ── */
#header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 10px;
  background: #1a1a2e;
  color: #fff;
}

#header-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

#agent-info {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #ccc;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot.connected {
  background: #4caf50;
  box-shadow: 0 0 4px #4caf50;
}

.dot.disconnected {
  background: #f44336;
}

/* ── Status bar ── */
.status {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

#status-icon {
  font-size: 10px;
}

.status.idle {
  background: #e8f5e9;
  color: #2e7d32;
}

.status.ringing {
  background: #fff8e1;
  color: #f57f17;
  animation: pulse 1s ease-in-out infinite;
}

.status.connected {
  background: #e8f5e9;
  color: #1b5e20;
}

.status.ended {
  background: #eceff1;
  color: #546e7a;
}

.status.error {
  background: #ffebee;
  color: #c62828;
}

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

/* ── ZCC Smart Embed iFrame ── */
#zcc-softphone {
  width: 100%;
  border: none;
  display: block;
  background: #fff;
}

/* ── Call info panel ── */
#call-info {
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
}

#call-info.hidden {
  display: none;
}

#call-info-header {
  display: none;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.direction-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}

.direction-badge.inbound {
  background: #e3f2fd;
  color: #1565c0;
}

.direction-badge.outbound {
  background: #fce4ec;
  color: #c62828;
}

#call-timer {
  font-size: 13px;
  font-weight: 700;
  font-family: "SF Mono", "Consolas", monospace;
  color: #1b5e20;
}

#caller-name {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 2px;
}

#caller-phone {
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

#caller-details {
  font-size: 11px;
  color: #888;
  line-height: 1.5;
}

#caller-actions {
  margin-top: 8px;
}

#caller-actions.hidden {
  display: none;
}

#btn-view-record {
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #1565c0;
  background: #e3f2fd;
  border: 1px solid #bbdefb;
  border-radius: 4px;
  cursor: pointer;
}

#btn-view-record:hover {
  background: #bbdefb;
}

/* ── Recent calls ── */
#recent-calls {
  background: #fff;
  margin-top: 8px;
  border-top: 1px solid #e0e0e0;
}

#recent-calls-header {
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #999;
  border-bottom: 1px solid #f0f0f0;
}

.no-calls {
  padding: 16px 14px;
  text-align: center;
  color: #bbb;
  font-size: 12px;
}

.recent-call-item {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid #f5f5f5;
  gap: 10px;
}

.recent-call-item:last-child {
  border-bottom: none;
}

.recent-call-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
}

.recent-call-icon.call-in {
  color: #1565c0;
}

.recent-call-icon.call-out {
  color: #c62828;
}

.recent-call-info {
  flex: 1;
  min-width: 0;
}

.recent-call-name {
  font-size: 12px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-call-meta {
  font-size: 10px;
  color: #999;
}

.recent-call-btn {
  background: none;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
}

.recent-call-btn:hover {
  background: #f5f5f5;
}

/* ── Error / toast messages ── */
.error-msg {
  padding: 8px 14px;
  background: #ffebee;
  color: #c62828;
  font-size: 12px;
  text-align: center;
}

.toast-msg {
  padding: 8px 14px;
  background: #e8f5e9;
  color: #2e7d32;
  font-size: 12px;
  text-align: center;
}

.error-msg.hidden,
.toast-msg.hidden {
  display: none;
}
