/* MedicinUp Fake Call — style.css */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

:root {
  --green: #2D9F6E;
  --green-dark: #1A6B4A;
  --red: #FF3B30;
  --text-primary: #1A1A1A;
  --text-secondary: #6B7280;
  --bg-white: #FFFFFF;
  --bg-dark: #1A1A1A;
  --bg-dark-secondary: #2C2C2E;
  --radius-btn: 16px;
  --btn-height: 56px;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-white);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
}

/* ─── Screen management ─── */

#screen-idle,
#screen-calling,
#screen-ended {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: opacity 0.3s ease;
}

.screen-hidden {
  opacity: 0;
  pointer-events: none;
}

/* ─── IDLE SCREEN ─── */

#screen-idle {
  background: var(--bg-white);
  padding: 48px 24px 40px;
  justify-content: space-between;
}

.idle-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  width: 100%;
}

.logo-wrap {
  display: flex;
  justify-content: center;
}

.logo-wrap img {
  height: 36px;
  width: auto;
}

.doctor-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.doctor-avatar {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(45, 159, 110, 0.2);
  flex-shrink: 0;
}

.doctor-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.doctor-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

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

.idle-bottom {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.btn-call {
  width: 100%;
  max-width: 400px;
  height: var(--btn-height);
  background: var(--green);
  color: white;
  border: none;
  border-radius: var(--radius-btn);
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.1px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-call:active {
  background: var(--green-dark);
  transform: scale(0.98);
}

.btn-call svg {
  width: 20px;
  height: 20px;
}

.idle-footer {
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 0.1px;
}

/* ─── CALLING / CONNECTED SCREEN ─── */

#screen-calling {
  background: var(--bg-dark);
  padding: 60px 24px 48px;
  justify-content: space-between;
}

.call-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.call-doctor-avatar {
  width: 250px;
  height: 250px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.call-doctor-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Pulse animation */
.call-doctor-avatar::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(45, 159, 110, 0.4);
  animation: pulse-ring 2s ease-in-out infinite;
}

.call-doctor-avatar::after {
  content: '';
  position: absolute;
  inset: -18px;
  border-radius: 50%;
  border: 2px solid rgba(45, 159, 110, 0.2);
  animation: pulse-ring 2s ease-in-out 0.3s infinite;
}

@keyframes pulse-ring {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.6; }
}

.call-doctor-name {
  font-size: 22px;
  font-weight: 600;
  color: white;
  letter-spacing: -0.2px;
  margin-top: 8px;
}

.call-status {
  font-size: 16px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.65);
  min-height: 24px;
}

.call-timer {
  font-size: 18px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  min-height: 28px;
}

/* Waveform canvas */
#waveform-canvas {
  width: 100%;
  max-width: 320px;
  height: 48px;
  opacity: 0;
  transition: opacity 0.5s ease;
}

#waveform-canvas.visible {
  opacity: 1;
}

/* Call controls */
.call-controls {
  width: 100%;
  max-width: 320px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.ctrl-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, transform 0.1s ease;
}

.ctrl-btn:active {
  transform: scale(0.93);
}

.ctrl-btn-secondary {
  background: var(--bg-dark-secondary);
}

.ctrl-btn-secondary svg {
  color: white;
}

.ctrl-btn-secondary.active {
  background: white;
}

.ctrl-btn-secondary.active svg {
  color: var(--bg-dark);
}

.ctrl-btn-end {
  background: var(--red);
  width: 72px;
  height: 72px;
}

.ctrl-btn-end svg {
  color: white;
  transform: rotate(135deg);
}

.ctrl-label {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 6px;
  text-align: center;
}

.ctrl-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* ─── ENDED OVERLAY ─── */

#screen-ended {
  background: rgba(0, 0, 0, 0.7);
  justify-content: center;
  gap: 24px;
}

.ended-card {
  background: var(--bg-dark-secondary);
  border-radius: 24px;
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: calc(100% - 48px);
  max-width: 360px;
}

.ended-icon {
  width: 56px;
  height: 56px;
  background: rgba(255, 59, 48, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ended-icon svg {
  color: var(--red);
  transform: rotate(135deg);
}

.ended-title {
  font-size: 20px;
  font-weight: 600;
  color: white;
}

.ended-duration {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.55);
}

.btn-redial {
  margin-top: 8px;
  width: 100%;
  height: 52px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease;
}

.btn-redial:active {
  background: var(--green-dark);
}

/* ─── Safe area support (iOS notch/home indicator) ─── */

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #screen-idle { padding-bottom: max(40px, env(safe-area-inset-bottom)); }
  #screen-calling { padding-bottom: max(48px, env(safe-area-inset-bottom)); }
}

/* ─── Tablet/desktop constraint ─── */

@media (min-width: 480px) {
  #screen-idle,
  #screen-calling,
  #screen-ended {
    max-width: 430px;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    width: 100%;
  }
}
