:root {
  --bg-color: #f0f2f5;
  --panel-bg: #ffffff;
  --border-color: #e4e6eb;
  --text-primary: #050505;
  --text-secondary: #65676b;
  
  --fb-blue: #1877f2;
  --fb-blue-hover: #166fe5;
  --fb-button-active: #135ec4;
  --fb-green: #31a24c;
  --fb-red: #f02849;
  --fb-red-hover: #d2203f;
  --fb-dark-button: #e4e6eb;
  --fb-dark-button-hover: #d8dadf;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-lg: 16px;
  --radius-md: 8px;
  --transition: all 0.2s ease-in-out;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-x: hidden;
  position: relative;
}

/* Blur Background Mesh Effects */
.background-effects {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

.blob {
  position: absolute;
  width: 550px;
  height: 550px;
  border-radius: 50%;
  filter: blur(160px);
  opacity: 0.04;
  animation: pulse-blobs 16s infinite alternate;
}

.blob-purple {
  background: var(--fb-blue);
  top: -15%;
  left: -15%;
}

.blob-cyan {
  background: var(--fb-green);
  bottom: -15%;
  right: -15%;
  animation-delay: 6s;
}

@keyframes pulse-blobs {
  0% { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.15) translate(60px, 40px); }
}

/* Header Navbar (Facebook navbar style) */
.header {
  height: 56px;
  background-color: var(--panel-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.logo {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -1.2px;
  color: var(--fb-blue);
  user-select: none;
  cursor: pointer;
}

.server-status {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--fb-dark-button);
  padding: 6px 12px;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.status-dot {
  width: 7px;
  height: 7px;
  background-color: var(--fb-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--fb-green);
  animation: blink 2s infinite;
}

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

/* Container */
.container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 32px 16px;
}

/* Facebook Cards */
.fb-card {
  width: 100%;
  max-width: 440px;
  background-color: var(--panel-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 24px 30px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: var(--transition);
}

.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

.text-center {
  text-align: center;
}

/* Typographies */
.fb-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.25;
  margin-bottom: 8px;
}

.fb-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.4;
  font-weight: 400;
}

/* Forms and Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.form-group label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.fb-grid-row {
  display: flex;
  gap: 16px;
}

/* Text Input & Dropdowns (Facebook dark inputs) */
input[type="text"], select {
  width: 100%;
  background-color: var(--fb-dark-button);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 14px;
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition);
}

input[type="text"]::placeholder {
  color: #72767d;
}

input[type="text"]:focus, select:focus {
  border-color: var(--fb-blue);
  background-color: var(--panel-bg);
}

.select-wrapper {
  position: relative;
  width: 100%;
}

.select-wrapper::after {
  content: "▼";
  font-size: 9px;
  color: var(--text-secondary);
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

select {
  appearance: none;
  padding-right: 32px;
  cursor: pointer;
}

/* Facebook styled Buttons */
.btn {
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

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

.btn-fb-blue:hover {
  background-color: var(--fb-blue-hover);
}

.btn-fb-blue:active {
  background-color: var(--fb-button-active);
}

.btn-fb-flat {
  background-color: var(--fb-dark-button);
  color: var(--text-primary);
}

.btn-fb-flat:hover {
  background-color: var(--fb-dark-button-hover);
}

.btn-secondary {
  width: 100%;
  margin-top: 10px;
}

/* Messenger Calling / Ringing UI */
.messenger-avatar-outer {
  width: 120px;
  height: 120px;
  margin: 10px auto;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.messenger-avatar-main {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background-color: var(--fb-blue);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 5;
  box-shadow: 0 4px 15px rgba(24, 119, 242, 0.4);
}

.messenger-call-icon {
  width: 32px;
  height: 32px;
}

.messenger-avatar-pulse-1, .messenger-avatar-pulse-2 {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1.5px solid rgba(24, 119, 242, 0.4);
  animation: messenger-pulse 2.2s infinite ease-out;
}

.messenger-avatar-pulse-2 {
  animation-delay: 1.1s;
}

@keyframes messenger-pulse {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.3); opacity: 0; }
}

.fb-card-title {
  font-size: 20px;
  font-weight: 700;
  margin-top: 8px;
}

.fb-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  padding: 0 10px;
}

/* Messenger Call Panel */
.call-panel-fb {
  max-width: 560px;
  padding: 24px;
}

.messenger-call-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 8px;
}

.messenger-live-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--fb-green);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: rgba(69, 189, 98, 0.08);
  padding: 4px 10px;
  border-radius: 12px;
}

.live-dot {
  width: 6px;
  height: 6px;
  background-color: var(--fb-green);
  border-radius: 50%;
  display: inline-block;
  animation: live-blink 1s infinite alternate;
}

@keyframes live-blink {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}

.messenger-timer {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--fb-dark-button);
  padding: 4px 10px;
  border-radius: 6px;
}

.messenger-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 16px 0;
}

.messenger-peer-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background-color: rgba(255,255,255,0.015);
  border: 1px solid var(--border-color);
  padding: 20px 12px;
  border-radius: 12px;
  position: relative;
}

.avatar-ring-fb {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 2.5px solid #3e4042;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  transition: var(--transition);
}

.avatar-fb {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background-color: var(--fb-dark-button);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  user-select: none;
}

.avatar-fb-accent {
  background-color: var(--fb-blue);
  color: white;
}

/* Green online dot inside avatar badge */
.messenger-online-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background-color: var(--fb-green);
  border: 3px solid var(--panel-bg);
  border-radius: 50%;
  z-index: 2;
}

/* Speaking ring pulse animation */
.avatar-ring-fb.voice-active {
  border-color: var(--fb-green);
  animation: speaking-ring-fb 1.6s infinite ease-out;
}

@keyframes speaking-ring-fb {
  0% { box-shadow: 0 0 0 0px rgba(69, 189, 98, 0.4); }
  60% { box-shadow: 0 0 0 10px rgba(69, 189, 98, 0); }
  100% { box-shadow: 0 0 0 0px rgba(69, 189, 98, 0); }
}

.messenger-peer-name {
  font-size: 16px;
  font-weight: 700;
}

.messenger-peer-meta {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  line-height: 1.3;
}

.messenger-lang-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--fb-blue);
  background-color: rgba(24, 119, 242, 0.08);
  padding: 4px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  margin-top: 4px;
}

/* Messenger style control drawer */
.messenger-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  margin-top: 8px;
}

.btn-messenger-control {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: var(--fb-dark-button);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  padding: 0 !important;
  margin: 0 !important;
  cursor: pointer;
  transition: var(--transition);
}

.control-svg {
  width: 22px !important;
  height: 22px !important;
  flex-shrink: 0 !important;
}

.btn-messenger-control:hover {
  background-color: var(--fb-dark-button-hover);
  transform: scale(1.05);
}

.btn-messenger-control.muted {
  background-color: var(--fb-red);
  color: white;
  border-color: var(--fb-red);
}

.btn-messenger-control.muted:hover {
  background-color: var(--fb-red-hover);
}

.btn-messenger-hangup {
  width: 54px;
  height: 54px;
  background-color: #f02849 !important;
  color: white !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(240, 40, 73, 0.45);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.btn-messenger-hangup:hover {
  background-color: #e01b3c !important;
  transform: scale(1.12) rotate(15deg) !important;
  box-shadow: 0 6px 20px rgba(240, 40, 73, 0.6) !important;
}

.btn-messenger-hangup:active {
  transform: scale(0.92) !important;
}

.glowing-btn-pulse {
  animation: fb-blue-pulse 2s infinite alternate;
}

@keyframes fb-blue-pulse {
  0% { box-shadow: 0 0 0 0px rgba(24, 119, 242, 0.4); }
  100% { box-shadow: 0 0 0 8px rgba(24, 119, 242, 0.1); }
}

/* Dashboard Card and Tabs Layout */
.fb-dashboard-card {
  max-width: 840px !important;
  width: 100%;
}

.fb-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
  gap: 8px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.tab-btn.active {
  color: var(--fb-blue);
  border-bottom-color: var(--fb-blue);
}

.tab-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.view-header {
  margin-bottom: 8px;
}

.view-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.view-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Spreadsheet Table Styling */
.table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: rgba(0, 0, 0, 0.1);
}

.fb-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.fb-table th {
  background-color: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border-color);
}

.fb-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.fb-table tbody tr {
  transition: var(--transition);
}

.fb-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.btn-small {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 6px;
}

/* Direct Calling overlays */
.margin-auto {
  margin: 10px auto;
}

.incoming-call-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.8);
  animation: popup-bounce 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes popup-bounce {
  0% { transform: translate(-50%, -55%) scale(0.9); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.caller-profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background-color: var(--fb-dark-button);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  text-align: left;
  margin: 8px 0;
}

.caller-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--fb-blue);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 18px;
  font-weight: 700;
}

.caller-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.caller-name {
  font-size: 16px;
  font-weight: 700;
}

.caller-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.caller-languages {
  font-size: 11px;
  color: var(--text-secondary);
}

.lang-pill {
  font-weight: 700;
  color: var(--fb-blue);
}

.incoming-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.btn-half {
  flex: 1;
}

.badge-match {
  background-color: rgba(49, 162, 76, 0.1);
  color: var(--fb-green);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  margin-left: 8px;
  display: inline-block;
  vertical-align: middle;
}

.icebreaker-card-fb {
  background-color: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  margin-top: 24px;
  text-align: center;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.icebreaker-header-fb {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--fb-blue);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.icebreaker-icon-fb {
  width: 16px;
  height: 16px;
}

.icebreaker-question {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.4;
  font-style: italic;
}

/* Footer (Facebook copyright styling) */
.fb-footer {
  padding: 16px;
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  background-color: var(--panel-bg);
}
