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

:root {
  --bg-gradient: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
  --card-bg: rgba(30, 41, 59, 0.85);
  --card-border: rgba(255, 255, 255, 0.08);
  --dialer-bg: rgba(15, 23, 42, 0.65);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-primary: #0284c7;
  --accent-primary-hover: #0369a1;
  --accent-green: #10b981;
  --accent-green-hover: #059669;
  --accent-red: #ef4444;
  --accent-red-hover: #dc2626;
  --accent-amber: #f59e0b;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-main: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Main Container */
.phone-app-wrapper {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Card Container */
.phone-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-main);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Top Status Header */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--accent-amber);
  box-shadow: 0 0 10px var(--accent-amber);
  transition: var(--transition);
  display: inline-block;
}

.status-dot.green, .ui.green.circular.label {
  background-color: var(--accent-green) !important;
  box-shadow: 0 0 10px var(--accent-green) !important;
}

.status-dot.orange, .ui.orange.circular.label {
  background-color: var(--accent-amber) !important;
  box-shadow: 0 0 10px var(--accent-amber) !important;
}

.status-dot.red, .ui.red.circular.label {
  background-color: var(--accent-red) !important;
  box-shadow: 0 0 10px var(--accent-red) !important;
}

#output-lbl {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.env-badge {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Agent Login Row */
.agent-auth-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.custom-input {
  width: 100%;
  height: 40px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 0 14px;
  font-size: 0.92rem;
  color: var(--text-primary);
  font-family: inherit;
  transition: var(--transition);
}

.custom-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.25);
  background: rgba(15, 23, 42, 0.85);
}

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

.custom-input::placeholder {
  color: var(--text-muted);
}

.auth-btn-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Buttons */
.app-btn {
  height: 38px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  user-select: none;
}

.app-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.app-btn-primary {
  background: var(--accent-primary);
  color: #fff;
}
.app-btn-primary:hover:not(:disabled) {
  background: var(--accent-primary-hover);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.app-btn-success {
  background: var(--accent-green);
  color: #fff;
}
.app-btn-success:hover:not(:disabled) {
  background: var(--accent-green-hover);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.app-btn-danger {
  background: var(--accent-red);
  color: #fff;
}
.app-btn-danger:hover:not(:disabled) {
  background: var(--accent-red-hover);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

/* Dialer Section */
.dialer-card {
  background: var(--dialer-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Number Display Input Inside Table */
#dialer_table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 6px;
  margin: 0;
}

#dialer_table tr td {
  padding: 0;
  margin: 0;
  text-align: center;
}

#call-to {
  position: relative;
  width: 100%;
}

#call-to input {
  width: 100%;
  height: 48px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 0 16px;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  text-align: center;
  font-family: inherit;
  transition: var(--transition);
}

#call-to input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.25);
}

#call-to input::-webkit-outer-spin-button,
#call-to input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#call-to input[type=number] {
  -moz-appearance: textfield;
}

#call-to input::placeholder {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: normal;
}

/* Keypad Number Buttons */
.dialer_num_tr td {
  width: 33.33%;
  height: 46px;
}

.dialer_num {
  width: 100%;
  height: 46px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  -webkit-user-select: none;
}

.dialer_num:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.dialer_num:active {
  transform: scale(0.96);
  background: rgba(2, 132, 199, 0.3) !important;
  border-color: var(--accent-primary);
}

.dialer_del_td {
  width: 100%;
  height: 46px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.dialer_del_td:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

.dialer_del_td:active {
  transform: scale(0.96);
}

.dialer_del_td img {
  opacity: 0.8;
  transition: var(--transition);
}

.dialer_del_td:hover img {
  opacity: 1;
}

/* Call Actions Controls Row */
.action-controls-row td {
  padding-top: 4px;
}

.action-controls-row .app-btn {
  width: 100%;
  height: 44px;
  font-size: 0.9rem;
}

/* Dimmer / Loader */
.ui.dimmer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.ui.active.dimmer {
  display: flex !important;
}

.ui.loader {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Responsive Fitting */
@media (max-width: 480px) {
  .phone-app-wrapper {
    padding: 8px;
    gap: 10px;
  }
  .phone-card {
    padding: 14px;
    gap: 12px;
  }
  .dialer_num {
    height: 42px;
    font-size: 1.15rem;
  }
  #call-to input {
    height: 42px;
    font-size: 1.15rem;
  }
}