/* ============================================================
   Product Consultation Web App — Main Stylesheet
   Theme: Clean light theme with clear call-state sections
   ============================================================ */

/* ---- Reset & base ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #f5f7fa;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #1a202c;
  --color-text-muted: #718096;
  --color-primary: #3182ce;
  --color-primary-hover: #2b6cb0;
  --color-accept: #38a169;
  --color-accept-hover: #2f855a;
  --color-reject: #e53e3e;
  --color-reject-hover: #c53030;
  --color-share: #3182ce;
  --color-share-hover: #2b6cb0;
  --color-end: #e53e3e;
  --color-end-hover: #c53030;
  --color-status-idle: #a0aec0;
  --color-status-active: #38a169;
  --color-badge-connecting: #d69e2e;
  --color-badge-connected: #38a169;
  --color-badge-sharing: #3182ce;
  --color-badge-ended: #718096;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.12);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

html, body {
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 24px 16px;
}

/* ---- App shell ---- */
.app-header {
  width: 100%;
  max-width: 640px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.app-header__logo {
  width: 36px;
  height: 36px;
  background: var(--color-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
}

.app-header__title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
}

.app-header__subtitle {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 1px;
}

/* ---- Card ---- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  width: 100%;
  max-width: 640px;
}

/* ---- Idle section ---- */
#idle-section {
  text-align: center;
}

.idle__icon {
  font-size: 3rem;
  margin-bottom: 16px;
  line-height: 1;
}

.idle__heading {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.idle__subtext {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

/* Status indicator */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-status-idle);
  flex-shrink: 0;
  transition: background 0.3s;
}

.status-dot--active {
  background: var(--color-status-active);
  box-shadow: 0 0 0 3px rgba(56, 161, 105, 0.25);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(56, 161, 105, 0.25); }
  50%       { box-shadow: 0 0 0 6px rgba(56, 161, 105, 0.1); }
}

/* ---- Incoming call section ---- */
#incoming-section {
  text-align: center;
}

.incoming__icon {
  font-size: 3rem;
  margin-bottom: 16px;
  animation: ring 0.6s ease-in-out infinite alternate;
}

@keyframes ring {
  from { transform: rotate(-10deg); }
  to   { transform: rotate(10deg); }
}

.incoming__heading {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.incoming__caller {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.incoming__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ---- In-call section ---- */
#incall-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.incall__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.incall__title {
  font-size: 1rem;
  font-weight: 600;
}

/* Call status badge */
.call-status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #fefcbf;
  color: #744210;
}

.call-status-badge[data-status="connected"] {
  background: #c6f6d5;
  color: #22543d;
}

.call-status-badge[data-status="sharing"] {
  background: #bee3f8;
  color: #2a4365;
}

.call-status-badge[data-status="ended"] {
  background: #e2e8f0;
  color: #4a5568;
}

/* ---- Video grid ---- */
.incall__video-grid {
  position: relative;
  background: #0d1117;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

/* Remote video — fills the whole grid area */
.incall__video-remote {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Placeholder shown when no remote video yet */
.incall__video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4a5568;
  font-size: 0.9rem;
  pointer-events: none;
}

.incall__video-placeholder.hidden {
  display: none;
}

/* Local cam — picture-in-picture, top-right corner */
.incall__video-local {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.3);
  background: #1a202c;
  display: block;
}

.incall__video-local.cam-off {
  display: none;
}

/* Screen share preview strip */
.incall__preview-wrapper {
  position: relative;
  background: #1a202c;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.incall__preview-label {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 999px;
  pointer-events: none;
}

#local-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* In-call controls */
.incall__controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* Accept — green */
.btn--accept {
  background: var(--color-accept);
  color: #fff;
  flex: 1;
  max-width: 180px;
}
.btn--accept:hover { background: var(--color-accept-hover); }

/* Reject — red */
.btn--reject {
  background: var(--color-reject);
  color: #fff;
  flex: 1;
  max-width: 180px;
}
.btn--reject:hover { background: var(--color-reject-hover); }

/* Toggle buttons (cam / mic) — green when on, grey when off */
.btn--toggle {
  flex: 1;
  background: var(--color-accept);
  color: #fff;
}
.btn--toggle:hover { filter: brightness(0.9); }

.btn--toggle[data-active="false"] {
  background: #718096;
  color: #fff;
}
.btn--toggle[data-active="false"]:hover { background: #4a5568; }

/* Showcase — brown/warm */
.btn--showcase {
  background: var(--color-bg);
  color: #6D4C41;
  border: 1px solid #BCAAA4;
  flex: 1;
}
.btn--showcase:hover {
  background: #EFEBE9;
  border-color: #6D4C41;
}

/* Share — blue */
.btn--share {
  background: var(--color-share);
  color: #fff;
  flex: 1;
}
.btn--share:hover { background: var(--color-share-hover); }

.btn--share[data-sharing="true"] {
  background: #2d3748;
}
.btn--share[data-sharing="true"]:hover {
  background: #1a202c;
}

/* End call — red */
.btn--end {
  background: var(--color-end);
  color: #fff;
  flex: 1;
}
.btn--end:hover { background: var(--color-end-hover); }

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .card {
    padding: 24px 16px;
  }

  .incoming__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn--accept,
  .btn--reject {
    max-width: none;
  }

  .incall__controls {
    flex-direction: column;
  }
}
