:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --border-color: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-green: #10b981;
  --accent-green-hover: #059669;
  --accent-red: #ef4444;
  --accent-red-hover: #dc2626;
  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --accent-amber: #f59e0b;
  --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
}

body {
  background: radial-gradient(circle at top, #1e293b 0%, #0f172a 100%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 15px;
}

.container {
  width: 100%;
  max-width: 980px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  padding: 16px 24px;
  border-radius: 16px;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
}

.header-title span {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  background: #334155;
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.status-badge .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #64748b;
  display: inline-block;
}

.status-badge.registered {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.status-badge.registered .dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.status-badge.connecting {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.status-badge.connecting .dot {
  background: #f59e0b;
  animation: pulse 1s infinite alternate;
}

.status-badge.error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.status-badge.error .dot {
  background: #ef4444;
}

@keyframes pulse {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

/* Main Grid */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
}

@media (max-width: 800px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  flex-direction: column;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #e2e8f0;
}

/* Form Styles */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

input[type="text"],
input[type="password"],
input[type="number"] {
  width: 100%;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.btn {
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-blue-hover);
}

.btn-success {
  background: var(--accent-green);
  color: #fff;
}
.btn-success:hover {
  background: var(--accent-green-hover);
}

.btn-danger {
  background: var(--accent-red);
  color: #fff;
}
.btn-danger:hover {
  background: var(--accent-red-hover);
}

.btn-secondary {
  background: #334155;
  color: #e2e8f0;
}
.btn-secondary:hover {
  background: #475569;
}

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

/* Call Interface */
.phone-display {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 18px;
  text-align: center;
  position: relative;
}

.call-status-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.call-timer {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-green);
  margin-bottom: 6px;
}

.dial-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

#dialNumber {
  font-size: 1.6rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 1px;
  background: transparent;
  border: none;
  color: #fff;
  padding-right: 35px;
}
#dialNumber:focus {
  box-shadow: none;
}

.btn-backspace {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  font-size: 1.1rem;
  border-radius: 6px;
}
.btn-backspace:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Dialpad Grid */
.dialpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.dial-btn {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.dial-btn:hover {
  background: var(--bg-card-hover);
  border-color: #475569;
  transform: translateY(-1px);
}

.dial-btn:active {
  transform: scale(0.96);
  background: #3b82f6;
  border-color: #3b82f6;
}

.dial-btn .number {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.dial-btn .letters {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 1.5px;
}

/* Call Actions */
.call-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

/* Active In-Call Controls */
.incall-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

.control-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #334155;
  color: #fff;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

.control-btn:hover {
  background: #475569;
}

.control-btn.active {
  background: var(--accent-red);
  border-color: var(--accent-red);
}

/* Incoming Call Modal / Banner */
.incoming-call-box {
  display: none;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(59, 130, 246, 0.2));
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  text-align: center;
  animation: bounce 1.5s infinite;
}

.incoming-call-box.active {
  display: block;
}

.incoming-caller {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin: 6px 0 14px 0;
}

.incoming-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
}

/* Tip / Notice for Issabel SSL */
.issabel-tip {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.82rem;
  color: #fde68a;
  line-height: 1.5;
  margin-top: 12px;
}

.issabel-tip a {
  color: #60a5fa;
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}

/* Logs Box */
.logs-card {
  margin-top: 10px;
}

.logs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.logs-container {
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  height: 180px;
  overflow-y: auto;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.8rem;
  line-height: 1.4;
  display: flex;
  flex-direction: column-reverse;
}

.log-entry {
  padding: 3px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.log-entry .time {
  color: #64748b;
  margin-right: 8px;
}

.log-entry.info { color: #94a3b8; }
.log-entry.success { color: #34d399; }
.log-entry.warn { color: #fbbf24; }
.log-entry.error { color: #f87171; }
.log-entry.sip { color: #818cf8; }

.btn-small {
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 6px;
}
