
:root {
  --bg-main: #0a0d14;
  --bg-card: #111622;
  --bg-card-hover: #161c2b;
  --bg-input: #1a2233;
  --border-color: #232d42;
  --border-accent: #2d3b55;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --color-primary: #10b981;
  --color-primary-hover: #059669;
  --color-primary-glow: rgba(16, 185, 129, 0.2);
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  --color-info: #06b6d4;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* AUTH OVERLAY */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, #162032 0%, #0a0d14 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}

.brand-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--color-primary-glow);
  color: var(--color-primary);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 9999px;
  margin-bottom: 12px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.auth-brand h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.auth-brand p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.auth-error {
  margin-top: 14px;
  padding: 10px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--color-danger);
  border-radius: var(--radius-sm);
  color: #fca5a5;
  font-size: 0.85rem;
  text-align: center;
}

.auth-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 24px;
}

/* LAYOUT */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-nav {
  height: 64px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-mark {
  width: 38px;
  height: 38px;
  background: var(--color-primary-glow);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--color-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  display: block;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
}

.status-indicator.online {
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.status-indicator.offline {
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.status-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: var(--bg-card-hover);
  color: #fff;
  border-color: var(--text-muted);
}

/* TABS BAR */
.tabs-bar {
  display: flex;
  gap: 8px;
  padding: 12px 24px;
  background: rgba(17, 22, 34, 0.6);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-card);
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--color-primary);
  border-color: var(--border-accent);
}

/* CONTENT CONTAINER */
.content-container {
  flex: 1;
  padding: 24px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.grid-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
}

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

/* CARDS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.card-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body {
  padding: 24px;
}

/* FORMS */
.form-group {
  margin-bottom: 20px;
  position: relative;
}

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

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

input[type="text"],
input[type="password"],
input[type="tel"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

textarea {
  resize: vertical;
}

.form-help {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 6px;
}

.call-banner-info {
  display: flex;
  gap: 12px;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 24px;
  font-size: 0.85rem;
  color: #a5f3fc;
}

.info-icon {
  flex-shrink: 0;
  color: var(--color-info);
}

/* CONTACT DROPDOWN */
.contact-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  max-height: 220px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.contact-item {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.85rem;
}

.contact-item:hover {
  background: var(--bg-card-hover);
  color: var(--color-primary);
}

.contact-item .c-num {
  font-family: var(--font-mono);
  color: var(--text-dim);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #042f2e;
}

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

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

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
}

.btn-call {
  width: 100%;
  padding: 16px;
  font-size: 1.05rem;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-call:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

.btn-hangup {
  width: 100%;
  padding: 14px;
  background: var(--color-danger);
  color: #fff;
  border-radius: var(--radius-md);
  border: none;
  font-weight: 700;
  cursor: pointer;
}

.btn-hangup:hover {
  background: #dc2626;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* MONITOR */
.monitor-body {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.empty-state {
  color: var(--text-dim);
  padding: 24px;
}

.empty-icon {
  margin-bottom: 12px;
  color: var(--text-dim);
}

.active-call-content {
  width: 100%;
}

.target-contact h4 {
  font-size: 1.35rem;
  color: #fff;
}

.target-phone {
  font-family: var(--font-mono);
  color: var(--color-primary);
  font-size: 1.1rem;
  margin-top: 4px;
}

.timer-display {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 700;
  color: #fff;
  margin: 16px 0;
}

.live-step {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.badge-status {
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-status.idle {
  background: var(--bg-input);
  color: var(--text-dim);
}

.badge-status.calling {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.badge-status.in_progress {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.badge-status.completed {
  background: rgba(6, 182, 212, 0.2);
  color: #38bdf8;
}

.badge-status.failed {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* PULSE ANIMATION */
.call-pulse-animation {
  position: relative;
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wave {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: var(--color-primary);
  opacity: 0.6;
  animation: pulse 2s infinite ease-out;
}

.wave:nth-child(2) {
  animation-delay: 0.6s;
}

.wave:nth-child(3) {
  animation-delay: 1.2s;
}

@keyframes pulse {
  0% { transform: scale(0.5); opacity: 0.8; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* TABLES */
.calls-table-wrapper {
  overflow-x: auto;
}

.calls-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.calls-table th {
  text-align: left;
  padding: 12px 16px;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.calls-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.calls-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.loading-td {
  text-align: center;
  padding: 30px !important;
  color: var(--text-dim);
}

/* CALL DETAIL */
.audio-player-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
}

.audio-player-box h4 {
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.custom-audio-player {
  width: 100%;
  outline: none;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section h4 {
  font-size: 0.95rem;
  color: #fff;
  margin-bottom: 12px;
  border-left: 3px solid var(--color-primary);
  padding-left: 8px;
}

.rich-text-content {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 0.9rem;
  white-space: pre-wrap;
  line-height: 1.6;
}

.transcript-chat-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  max-height: 350px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.4;
}

.chat-bubble.agent {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  align-self: flex-start;
}

.chat-bubble.client {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  align-self: flex-end;
}

.bubble-sender {
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 4px;
  display: block;
}

.chat-bubble.agent .bubble-sender { color: #34d399; }
.chat-bubble.client .bubble-sender { color: #60a5fa; }

/* CONFIG RADIO GROUP */
.form-card-sub {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
}

.form-card-sub h4 {
  font-size: 1rem;
  margin-bottom: 16px;
  color: #fff;
}

.radio-group {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.875rem;
}

.save-status-msg {
  color: var(--color-primary);
  font-size: 0.85rem;
  font-weight: 600;
  margin-left: 14px;
}

/* FOOTER */
.app-footer {
  text-align: center;
  padding: 24px;
  font-size: 0.8rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  margin-top: auto;
}

.footer-sep {
  margin: 0 8px;
}
