/* ============================================================
   Phona WebRTC Phone - Stylesheet
   ============================================================ */

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

:root {
  --bg: #0f1117;
  --surface: #1a1d2e;
  --surface2: #232640;
  --accent: #5b7fff;
  --accent-hover: #7b9bff;
  --red: #ff4e4e;
  --green: #4eff91;
  --text: #e8eaf6;
  --text-muted: #8892b0;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0,0,0,0.5);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen { display: none; width: 100%; }
.screen.active { display: flex; align-items: center; justify-content: center; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  width: 100%;
  max-width: 380px;
}

.phone-card { max-width: 420px; }

h1 { font-size: 2rem; font-weight: 700; color: var(--accent); text-align: center; }
.subtitle { text-align: center; color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.9rem; }

/* Tabs */
.tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; }
.tab {
  flex: 1; padding: 0.5rem; border: none; border-radius: 8px;
  background: var(--surface2); color: var(--text-muted);
  cursor: pointer; font-size: 0.9rem; transition: background 0.2s;
}
.tab.active { background: var(--accent); color: #fff; }
.tab-content { display: none; flex-direction: column; gap: 0.75rem; }
.tab-content.active { display: flex; }

/* Forms */
label { font-size: 0.8rem; color: var(--text-muted); }
input[type="email"], input[type="password"], input[type="text"] {
  width: 100%; padding: 0.65rem 0.9rem;
  background: var(--surface2); border: 1px solid #333;
  border-radius: 8px; color: var(--text); font-size: 0.95rem;
  outline: none; transition: border-color 0.2s;
}
input:focus { border-color: var(--accent); }

.btn-primary {
  padding: 0.75rem; background: var(--accent); color: #fff;
  border: none; border-radius: 8px; font-size: 1rem;
  font-weight: 600; cursor: pointer; transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 0.85rem; padding: 0.3rem 0.5rem;
}
.btn-ghost:hover { color: var(--text); }
.btn-ghost.small { font-size: 0.8rem; margin-top: 1rem; width: 100%; text-align: left; }

.error-msg { color: var(--red); font-size: 0.8rem; }
.hidden { display: none !important; }

/* Phone header */
.phone-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem;
}
.ext-badge {
  background: var(--surface2); padding: 0.25rem 0.6rem;
  border-radius: 99px; font-size: 0.85rem; font-weight: 700;
  color: var(--accent); margin-right: 0.5rem;
}
.status-badge {
  font-size: 0.75rem; padding: 0.2rem 0.5rem; border-radius: 99px;
}
.status-badge.connected { background: rgba(78,255,145,0.15); color: var(--green); }
.status-badge.disconnected { background: rgba(255,78,78,0.15); color: var(--red); }
.status-badge.registered { background: rgba(91,127,255,0.15); color: var(--accent); }

/* Call display */
.call-display {
  text-align: center; padding: 1.5rem 1rem; border-radius: var(--radius);
  background: var(--surface2); margin-bottom: 1rem; min-height: 90px;
}
.call-display.active { background: rgba(78,255,145,0.07); }
.call-display.ringing { background: rgba(91,127,255,0.1); animation: pulse 1s infinite; }
#call-number { font-size: 1.5rem; font-weight: 700; letter-spacing: 2px; }
.call-timer { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.3rem; }

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

/* Dial input */
#dial-input-row { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
#dial-input { flex: 1; }
.btn-call {
  width: 48px; height: 48px; border-radius: 50%; border: none;
  background: var(--green); color: #000; font-size: 1.3rem;
  cursor: pointer; transition: background 0.2s, transform 0.1s;
}
.btn-call:hover { background: #3ddc7a; transform: scale(1.05); }
.btn-call:disabled { background: var(--surface2); color: var(--text-muted); cursor: not-allowed; transform: none; }

/* Dialpad */
.dialpad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem;
  margin-bottom: 1rem;
}
.dial-key {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0.75rem; border-radius: 8px;
  background: var(--surface2); border: none; color: var(--text);
  font-size: 1.2rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s; line-height: 1;
}
.dial-key span { font-size: 0.55rem; color: var(--text-muted); letter-spacing: 1px; margin-top: 2px; }
.dial-key:hover { background: #2e3254; }
.dial-key:active { background: var(--accent); }

/* Call controls */
.call-controls { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.btn-ctrl {
  flex: 1; padding: 0.6rem; border-radius: 8px; border: none;
  background: var(--surface2); color: var(--text);
  font-size: 0.85rem; cursor: pointer; transition: background 0.2s;
}
.btn-ctrl:hover { background: #2e3254; }
.btn-red { background: rgba(255,78,78,0.2); color: var(--red); }
.btn-red:hover { background: var(--red); color: #fff; }
.btn-ctrl.active { background: rgba(255,174,0,0.2); color: #ffae00; }

/* Numbers panel */
.numbers-section { border-top: 1px solid var(--surface2); padding-top: 0.75rem; }
.numbers-panel { margin-top: 0.75rem; }
.numbers-panel h3 { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.numbers-panel ul { list-style: none; margin-bottom: 0.75rem; }
.numbers-panel li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 0.7rem; border-radius: 8px; background: var(--surface2);
  margin-bottom: 0.3rem; font-size: 0.85rem;
}
.numbers-panel li .buy-btn {
  font-size: 0.75rem; padding: 0.2rem 0.5rem;
  background: var(--accent); color: #fff; border: none;
  border-radius: 6px; cursor: pointer;
}

/* Responsive */
@media (max-width: 440px) {
  .card { padding: 1.25rem; border-radius: 0; }
  body { align-items: flex-start; }
}
