/**
 * AudioCall Styles
 * Minimalistic, responsive design for mobile devices
 */

/* ============================================
   BASE STYLES
   ============================================ */

:root {
  --primary-color: #4A90E2;
  --primary-dark: #357ABD;
  --success-color: #27AE60;
  --warning-color: #F39C12;
  --danger-color: #E74C3C;
  --text-primary: #2C3E50;
  --text-secondary: #7F8C8D;
  --bg-light: #FFFFFF;
  --bg-gray: #F5F7FA;
  --border-color: #E1E8ED;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--text-primary);
  background: var(--bg-gray);
}

/* ============================================
   CONTAINER
   ============================================ */

.container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  max-width: 100%;
}

/* ============================================
   HEADER
   ============================================ */

.header {
  text-align: center;
  margin-bottom: 40px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.logo .icon {
  font-size: 48px;
}

.header h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
}

.subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* ============================================
   SECTIONS
   ============================================ */

.section {
  background: var(--bg-light);
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 480px;
  text-align: center;
}

.section.hidden {
  display: none;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  outline: none;
  font-family: inherit;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--bg-gray);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: #E8EEF2;
}

.btn-text {
  background: transparent;
  color: var(--text-secondary);
  padding: 12px 20px;
}

.btn-text:hover:not(:disabled) {
  color: var(--primary-color);
}

.btn-large {
  padding: 18px 40px;
  font-size: 18px;
  width: 100%;
  max-width: 300px;
}

/* ============================================
   STATUS MESSAGES
   ============================================ */

.status-message {
  margin: 20px 0;
}

.status-message h2 {
  font-size: 22px;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.status-detail {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Spinner */
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   CALL LINK
   ============================================ */

.link-container {
  margin: 32px 0;
}

.label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.link-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}

.link-box input {
  flex: 1;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Courier New', monospace;
  background: var(--bg-gray);
  color: var(--text-primary);
  text-align: center;
}

.copy-icon {
  font-size: 18px;
}

.copy-status {
  color: var(--success-color);
  font-size: 14px;
  margin-top: 8px;
}

.copy-status.hidden {
  display: none;
}

/* ============================================
   ERRORS
   ============================================ */

.error-message {
  margin: 20px 0;
}

.error-icon {
  font-size: 56px;
  display: block;
  margin-bottom: 16px;
}

.error-message h2 {
  font-size: 22px;
  margin-bottom: 12px;
  color: var(--danger-color);
}

.error-message p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* ============================================
   CALL PAGE
   ============================================ */

.call-page {
  justify-content: flex-start;
  padding-top: 60px;
}

.call-info {
  margin: 20px 0;
}

.call-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.call-info h2 {
  font-size: 24px;
  margin-bottom: 12px;
}

.call-info p {
  color: var(--text-secondary);
  font-size: 15px;
}

/* Active call header */
.call-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.call-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-secondary);
  animation: pulse 2s ease-in-out infinite;
}

.status-dot.connected {
  background: var(--success-color);
}

.status-dot.disconnected {
  background: var(--warning-color);
}

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

.call-timer {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* Call content */
.call-content {
  margin: 40px 0;
}

/* Audio indicator */
.audio-indicator {
  position: relative;
  margin-bottom: 32px;
}

.microphone-icon {
  font-size: 72px;
  margin-bottom: 16px;
}

.audio-waves {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  height: 40px;
  margin-bottom: 16px;
}

.audio-waves span {
  width: 4px;
  background: var(--primary-color);
  border-radius: 2px;
  animation: wave 1s ease-in-out infinite;
}

.audio-waves span:nth-child(1) { animation-delay: 0s; height: 20px; }
.audio-waves span:nth-child(2) { animation-delay: 0.1s; height: 30px; }
.audio-waves span:nth-child(3) { animation-delay: 0.2s; height: 40px; }
.audio-waves span:nth-child(4) { animation-delay: 0.3s; height: 30px; }
.audio-waves span:nth-child(5) { animation-delay: 0.4s; height: 20px; }

@keyframes wave {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.5); }
}

/* Quality indicator */
.quality-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 24px 0;
}

.quality-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.quality-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 20px;
}

.quality-bars .bar {
  width: 6px;
  background: var(--border-color);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.quality-bars .bar:nth-child(1) { height: 8px; }
.quality-bars .bar:nth-child(2) { height: 12px; }
.quality-bars .bar:nth-child(3) { height: 16px; }
.quality-bars .bar:nth-child(4) { height: 20px; }
.quality-bars .bar:nth-child(5) { height: 24px; }

.quality-bars .bar.active.good {
  background: var(--success-color);
}

.quality-bars .bar.active.fair {
  background: var(--warning-color);
}

.quality-bars .bar.active.poor {
  background: var(--danger-color);
}

.quality-text {
  font-size: 14px;
  font-weight: 600;
}

/* Connection statistics */
.connection-stats {
  display: flex;
  justify-content: space-around;
  margin-top: 24px;
  padding: 16px;
  background: var(--bg-gray);
  border-radius: 8px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

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

.stat-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* Control buttons */
.call-controls {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.control-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 80px;
  height: 80px;
  border: none;
  border-radius: 50%;
  background: var(--bg-gray);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

.control-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
}

.control-btn:active {
  transform: scale(0.95);
}

.control-btn.muted {
  background: var(--danger-color);
  color: white;
}

.control-btn.end-call {
  background: var(--danger-color);
  color: white;
}

.control-btn.end-call:hover {
  background: #C0392B;
}

.btn-icon {
  font-size: 28px;
}

.btn-label {
  font-size: 11px;
  font-weight: 500;
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
  margin-top: 40px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

.tech-info {
  margin-top: 8px;
  font-size: 12px;
  opacity: 0.7;
}

/* ============================================
   RESPONSIVENESS
   ============================================ */

@media (min-width: 768px) {
  .link-box {
    flex-direction: row;
  }

  .link-box input {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 16px;
  }

  .section {
    padding: 32px 24px;
  }

  .header h1 {
    font-size: 28px;
  }

  .logo .icon {
    font-size: 40px;
  }

  .btn-large {
    font-size: 16px;
    padding: 16px 32px;
  }

  .call-controls {
    gap: 12px;
  }

  .control-btn {
    width: 70px;
    height: 70px;
  }

  .btn-icon {
    font-size: 24px;
  }

  .btn-label {
    font-size: 10px;
  }
}

/* ============================================
   UTILITIES
   ============================================ */

.hidden {
  display: none !important;
}

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

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

/* ============================================
   DARK THEME (optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #E8E9ED;
    --text-secondary: #A0A4A8;
    --bg-light: #1E2228;
    --bg-gray: #15171A;
    --border-color: #2C3038;
  }

  .link-box input {
    background: #15171A;
    color: var(--text-primary);
  }

  .control-btn {
    background: #2C3038;
    color: var(--text-primary);
  }

  .connection-stats {
    background: #15171A;
  }
}
