/* ==========================================================================
   EDD Hold Dashboard Stylesheet (/app)
   Inherits design tokens and base typography from /css/main.css
   ========================================================================== */

/* Custom Scrollbar to match sand theme */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-sm);
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Base resets & layout overrides */
body {
  background-color: var(--bg);
  background-image: none; /* remove cyber background gradients */
  min-height: 100vh;
}

body::before, body::after {
  display: none; /* disable floating cybersecurity glow balls */
}

/* ── Header ──────────────────────────────── */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
}

.system-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 99px;
  color: var(--success);
  box-shadow: var(--shadow);
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--success);
  border-radius: 50%;
  display: inline-block;
  animation: pulse-dot-success 2s infinite;
}

@keyframes pulse-dot-success {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(45, 106, 79, 0.4);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(45, 106, 79, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(45, 106, 79, 0);
  }
}

/* ── Hero Section ────────────────────────── */
.hero {
  text-align: center;
  margin-bottom: 48px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.5vw, 48px);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 12px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.hero p {
  font-size: 16px;
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Global Stats Banner ─────────────────── */
.stats-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.blue {
  background: var(--accent-soft);
  color: var(--accent-hover);
  border: 1px solid var(--border-light);
}

.stat-icon.green {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid var(--success-soft);
}

.stat-icon.purple {
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #e9e3ff;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── Search Container ────────────────────── */
.search-container {
  position: relative;
  max-width: 560px;
  margin: 0 auto 40px;
}

.search-input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface);
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--ink);
  outline: none;
  transition: all .15s;
  box-shadow: var(--shadow);
}

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

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(196, 134, 42, 0.08);
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Supported Lines Directory ───────────── */
.directory-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 12px;
}

.directory-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
}

.directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 64px;
}

.agency-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: all .15s;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.agency-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent);
  opacity: 0;
  transition: all .15s;
}

.agency-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(26, 39, 68, 0.08);
}

.agency-card:hover::before {
  opacity: 1;
}

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

.agency-state {
  display: inline-block;
  padding: 2px 8px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.agency-rate {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--success);
  background: var(--success-soft);
  padding: 2px 8px;
  border-radius: 4px;
}

.agency-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
  line-height: 1.3;
}

.agency-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.lang-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  background: #fef3c7;
  color: #92400e;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-body);
  letter-spacing: .03em;
  vertical-align: middle;
}

.agency-description {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-bottom: 20px;
  flex-grow: 1;
}

.agency-specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 20px;
}

.spec-item {
  display: flex;
  flex-direction: column;
}

.spec-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.spec-lbl {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.agency-price {
  display: flex;
  flex-direction: column;
}

.price-val {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.price-lbl {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Checkout Dialog Modal ───────────────── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(26, 39, 68, 0.4);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: all .25s ease-out;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 520px;
  width: 90%;
  position: relative;
  box-shadow: 0 12px 36px rgba(26, 39, 68, 0.12);
  transform: translateY(16px);
  transition: all .25s ease-out;
  color: var(--ink);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  transition: color .15s;
}

.close-btn:hover {
  color: var(--ink);
}

#modal-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

#modal-desc {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 10px;
  line-height: 1.5;
}

#modal-specs {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.alert-banner {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.alert-banner.warning {
  background: #fffbeb;
  border-color: #fef3c7;
}

.alert-banner.warning .alert-icon {
  color: #d97706;
}

.alert-banner.warning .alert-text {
  color: #b45309;
}

.alert-icon {
  color: var(--accent);
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

.alert-text {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  outline: none;
  transition: all .15s;
}

.form-input:focus {
  border-color: var(--accent);
  background: var(--surface);
}

/* Tier Selector Grid */
.tier-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.tier-option {
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all .15s;
  position: relative;
  background: var(--surface);
}

.tier-option:hover {
  border-color: var(--border);
}

.tier-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.tier-option.selected.priority {
  border-color: #7c3aed;
  background: #f5f3ff;
}

.tier-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
}

.tier-option.selected .tier-badge {
  border-color: var(--accent);
  background: var(--accent);
}

.tier-option.selected.priority .tier-badge {
  border-color: #7c3aed;
  background: #7c3aed;
}

.tier-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.tier-option.selected.priority .tier-name {
  color: #7c3aed;
}

.tier-price {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.tier-option.selected.priority .tier-price {
  color: #7c3aed;
}

.tier-details {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

/* Advanced settings in modal */
.advanced-ivr-group {
  margin-top: 24px;
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
}

.advanced-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.advanced-toggle-btn:hover { color: var(--accent); }
.advanced-toggle-btn svg { transition: transform 0.2s ease; }

.advanced-ivr-group .form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.advanced-tag {
  font-size: 10px;
  color: var(--accent-hover);
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: 4px;
}

.ivr-input {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg);
}

.form-help {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 6px;
  line-height: 1.4;
}

/* Stripe branding box */
.stripe-badge-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow);
}

.stripe-badge-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stripe-icon-emoji {
  font-size: 20px;
  line-height: 1;
}

.stripe-text-info {
  text-align: left;
}

.stripe-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.stripe-desc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.stripe-pill {
  font-size: 10px;
  background: #635bff;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
}

.payment-details {
  border-top: 1px solid var(--border-light);
  padding-top: 20px;
  margin-top: 20px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}

.summary-row.total {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

/* ── Active Session Console View ─────────── */
.tracker-console {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 16px 0 64px;
}

@media (min-width: 768px) {
  .tracker-console {
    grid-template-columns: 3fr 2fr;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.console-line-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  color: var(--ink);
  margin-bottom: 24px;
}

.pulse-animation-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  position: relative;
}

.pulse-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.pulse-circle-icon {
  font-size: 32px;
}

.wave {
  position: absolute;
  width: 120px;
  height: 120px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  opacity: 0;
  animation: wave-pulse-custom 3s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.wave-2 {
  animation-delay: 1s;
}

.wave-3 {
  animation-delay: 2s;
}

@keyframes wave-pulse-custom {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* Status state color classes */
.pulse-circle.blue {
  background: var(--accent-soft);
  border-color: var(--border);
  box-shadow: 0 0 20px rgba(196,134,42,0.1);
}
.pulse-circle.blue .wave {
  border-color: rgba(196,134,42,0.3);
  box-shadow: 0 0 10px rgba(196,134,42,0.1);
}

.pulse-circle.purple {
  background: #f5f3ff;
  border-color: #e9e3ff;
  box-shadow: 0 0 20px rgba(124,58,237,0.1);
}
.pulse-circle.purple .wave {
  border-color: rgba(124,58,237,0.3);
  box-shadow: 0 0 10px rgba(124,58,237,0.1);
}

.pulse-circle.green {
  background: var(--success-soft);
  border-color: #d1ebd8;
  box-shadow: 0 0 20px rgba(45,106,79,0.1);
}
.pulse-circle.green .wave {
  border-color: rgba(45,106,79,0.3);
  box-shadow: 0 0 10px rgba(45,106,79,0.1);
}

.pulse-circle.red {
  background: #fde8e8;
  border-color: #fbd5d5;
  box-shadow: 0 0 20px rgba(239,68,68,0.1);
}
.pulse-circle.red .wave {
  border-color: rgba(239,68,68,0.3);
  box-shadow: 0 0 10px rgba(239,68,68,0.1);
}

.tracker-status-label {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  color: var(--ink);
  margin-top: 24px;
}

.tracker-status-desc {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

.tracker-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 32px;
  border-top: 1px solid var(--border-light);
  padding-top: 24px;
}

.tracker-stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.tracker-stat-val {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.tracker-stat-lbl {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.console-actions {
  margin-top: 32px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

#cancel-btn {
  background-color: #c53030;
  color: #ffffff;
  border: none;
}
#cancel-btn:hover {
  background-color: #9b2c2c;
}

/* Event timeline logs */
.console-log-panel h3.panel-header-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 12px;
}

.timeline-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 8px;
}

.timeline-event {
  display: flex;
  gap: 16px;
  position: relative;
}

.timeline-event:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 18px;
  bottom: -26px;
  width: 2px;
  background-color: var(--border-light);
}

.timeline-marker {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--border);
  flex-shrink: 0;
  margin-top: 2px;
  z-index: 2;
  box-shadow: 0 0 0 4px var(--surface);
}

.timeline-marker.active {
  border-color: var(--accent);
  background: var(--accent);
}

.timeline-marker.success {
  border-color: var(--success);
  background: var(--success);
}

.timeline-marker.fail {
  border-color: #ef4444;
  background: #ef4444;
}

.timeline-content {
  display: flex;
  flex-direction: column;
}

.timeline-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.timeline-msg {
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
  margin-top: 2px;
  line-height: 1.4;
}

/* ── App Footer Styling ──────────────────── */
.app-footer {
  margin-top: 80px;
  padding: 40px 0;
  border-top: 1px solid var(--border-light);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color .15s;
}

.footer-links a:hover {
  color: var(--accent);
}

.app-footer .disclaimer {
  max-width: 800px;
  font-size: 11px;
  opacity: 0.7;
}

/* ── Success Modal Styling ────────────────── */
.success-modal-content {
  max-width: 460px;
}

#success-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 12px;
}

.success-subtitle {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin-bottom: 24px;
}

.success-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.success-step-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.success-step-num {
  width: 24px;
  height: 24px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-weight: 700;
  font-size: 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.success-step-text {
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.4;
  margin: 0;
}

/* Responsive Overrides */
@media (max-width: 800px) {
  .tracker-console {
    grid-template-columns: 1fr;
  }
}
