/* ============================================
   Portal — Client Dashboard Styles
   Dark theme matching the landing page design.
   ============================================ */

:root {
  --bg-primary: #0a0a0f;
  --bg-card: #12121a;
  --bg-card-hover: #1a1a25;
  --bg-input: #1a1a25;
  --border: #2a2a3a;
  --text-primary: #f0f0f5;
  --text-secondary: #8888aa;
  --text-muted: #5a5a7a;
  --accent: #6c5ce7;
  --accent-hover: #7c6cf7;
  --accent-glow: rgba(108, 92, 231, 0.15);
  --success: #00d68f;
  --warning: #f5a623;
  --danger: #ff4757;
  --info: #3498db;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}

/* ---- Navigation ---- */

.portal-nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.portal-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 2rem;
}

.portal-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.portal-logo span { color: var(--accent); }

.portal-nav-links {
  display: flex;
  gap: 0.25rem;
}

.portal-nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.portal-nav-links a:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.portal-nav-links a.active {
  color: var(--accent);
  background: var(--accent-glow);
}

.portal-nav-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.portal-user-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.portal-signout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.portal-signout:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* ---- Page Layout ---- */

.portal-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.portal-header {
  margin-bottom: 2rem;
}

.portal-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.portal-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ---- Cards ---- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
}

/* ---- Grid Layouts ---- */

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
}

.grid-full {
  grid-column: 1 / -1;
}

/* ---- Usage Bar ---- */

.usage-card {
  padding: 2rem;
}

.usage-numbers {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
}

.usage-used {
  font-size: 2.5rem;
  font-weight: 800;
}

.usage-total {
  font-size: 1rem;
  color: var(--text-secondary);
}

.usage-bar-track {
  width: 100%;
  height: 12px;
  background: var(--bg-input);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.usage-bar-fill {
  height: 100%;
  border-radius: 6px;
  background: var(--accent);
  transition: width 0.5s ease;
}

.usage-bar-fill.warning { background: var(--warning); }
.usage-bar-fill.danger { background: var(--danger); }

.usage-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ---- Badges ---- */

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-starter { background: rgba(52, 152, 219, 0.15); color: var(--info); }
.badge-pro { background: var(--accent-glow); color: var(--accent); }
.badge-multi { background: rgba(0, 214, 143, 0.15); color: var(--success); }

/* ---- Outcome Badges ---- */

.outcome-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.outcome-booked { background: rgba(0, 214, 143, 0.15); color: var(--success); }
.outcome-callback { background: rgba(52, 152, 219, 0.15); color: var(--info); }
.outcome-message { background: rgba(245, 166, 35, 0.15); color: var(--warning); }
.outcome-transfer { background: var(--accent-glow); color: var(--accent); }
.outcome-hungup { background: rgba(255, 71, 87, 0.1); color: var(--text-muted); }
.outcome-spam { background: rgba(255, 71, 87, 0.15); color: var(--danger); }

/* ---- Tables ---- */

.portal-table {
  width: 100%;
  border-collapse: collapse;
}

.portal-table th {
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.portal-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.portal-table tr:hover td {
  background: var(--bg-card-hover);
}

.portal-table .caller-name {
  font-weight: 600;
}

.portal-table .caller-phone {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ---- Call Detail (expandable row) ---- */

.call-detail {
  display: none;
  padding: 1rem;
  background: var(--bg-input);
  border-radius: 8px;
  margin: 0.5rem 0;
}

.call-detail.open { display: block; }

.call-detail-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.call-detail-text {
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

/* ---- Quick Action Cards ---- */

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s;
}

.action-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.action-card-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.action-card-label {
  font-size: 0.9rem;
  font-weight: 500;
}

/* ---- Stat Cards ---- */

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ---- Buttons ---- */

.btn-portal {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

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

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

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

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

.login-oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

.btn-oauth {
  width: 100%;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-oauth:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.btn-apple {
  background: #000;
  color: #fff;
}

.btn-apple:hover {
  background: #1a1a1a;
}

.btn-microsoft {
  background: #2f2f2f;
  color: #fff;
}

.btn-microsoft:hover {
  background: #3a3a3a;
}

.btn-google {
  background: white;
  color: #333;
}

.btn-google:hover {
  background: #f0f0f0;
}

/* ---- Login Page ---- */

.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 3rem;
  text-align: center;
  max-width: 440px;
  width: 100%;
}

.login-logo {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.login-logo span { color: var(--accent); }

.login-subtitle {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.login-hint {
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  text-align: center;
}

.login-back {
  margin-top: 1.5rem;
  font-size: 0.85rem;
}

.login-back a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.login-back a:hover {
  color: var(--accent);
}

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 1rem;
  min-height: 1.2em;
}

/* ---- Empty States ---- */

.portal-empty {
  text-align: center;
  padding: 4rem 2rem;
}

.portal-empty h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.portal-empty p {
  color: var(--text-secondary);
}

/* ---- Account Info List ---- */

.info-list {
  list-style: none;
}

.info-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.info-list li:last-child { border-bottom: none; }

.info-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.info-value {
  font-weight: 500;
  font-size: 0.9rem;
}

/* ---- Connection Status ---- */

.status-connected { color: var(--success); }
.status-disconnected { color: var(--text-muted); }

/* ---- Line Selector ---- */

.line-selector {
  display: none;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.line-pill {
  padding: 0.4rem 1rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.line-pill:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.line-pill.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

.line-pill-phone {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-left: 0.25rem;
}

/* ---- Lines Overview Cards ---- */

.lines-overview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.line-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
}

.line-card-label {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.line-card-phone {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.line-card-calls {
  font-size: 1.25rem;
  font-weight: 700;
}

.line-card-status {
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: 0.25rem;
}

.line-busy { color: var(--warning); }
.line-normal { color: var(--success); }
.line-quiet { color: var(--text-muted); }
.line-inactive { color: var(--danger); }

/* ---- Plans Page ---- */

.plans-hero {
  text-align: center;
  margin-bottom: 3rem;
}

.plans-hero h1 {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.plans-hero p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.2s, border-color 0.2s;
}

.plan-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.plan-card-featured {
  border-color: var(--accent);
  box-shadow: 0 0 30px rgba(108, 92, 231, 0.15);
}

.plan-popular {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.3rem 1rem;
  border-radius: 20px;
}

.plan-badge {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1.25rem;
  width: fit-content;
}

.plan-price {
  margin-bottom: 0.5rem;
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

.plan-amount {
  font-size: 2.5rem;
  font-weight: 800;
}

.plan-period {
  font-size: 1rem;
  color: var(--text-secondary);
}

.plan-setup {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.plan-setup-note {
  color: var(--success);
  font-weight: 500;
}

.plan-features {
  list-style: none;
  flex: 1;
  margin-bottom: 1.5rem;
}

.plan-features li {
  position: relative;
  padding: 0.4rem 0 0.4rem 1.5rem;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.plan-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 700;
}

.btn-plan {
  width: 100%;
  padding: 0.85rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 10px;
  text-align: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-plan-starter {
  background: var(--info);
  color: white;
}

.btn-plan-starter:hover { background: #2980b9; }

.btn-plan-pro {
  background: var(--accent);
  color: white;
}

.btn-plan-pro:hover { background: var(--accent-hover); }

.btn-plan-multi {
  background: var(--success);
  color: #0a0a0f;
}

.btn-plan-multi:hover { background: #00c07f; }

.plan-overage {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

.plans-footer {
  text-align: center;
  padding: 2rem 1rem;
}

.plans-footer p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  max-width: 600px;
  margin: 0 auto 0.5rem;
  line-height: 1.6;
}

.plans-guarantee {
  color: var(--success) !important;
  font-weight: 500;
}

.plans-loading {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 15, 0.9);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  gap: 1rem;
}

.plans-loading p {
  color: var(--text-secondary);
  font-size: 1rem;
}

.plans-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ---- Plans: How It Works ---- */

.plans-how-it-works {
  margin-bottom: 2rem;
}

.plans-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.plans-step {
  text-align: center;
  flex: 1;
  max-width: 200px;
}

.plans-step-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 800;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
}

.plans-step-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.plans-step-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.plans-step-arrow {
  color: var(--text-muted);
  font-size: 1.25rem;
  font-weight: 700;
}

/* ---- Booking Modal ---- */

.book-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 15, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 1rem;
}

.book-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  max-width: 480px;
  width: 100%;
  text-align: center;
  position: relative;
}

.book-modal-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.book-modal-card h2 span {
  color: var(--accent);
}

.book-modal-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.75rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.book-modal-close:hover {
  color: var(--text-primary);
}

.book-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.book-option {
  flex-direction: column;
  padding: 1.25rem;
  gap: 0.25rem;
}

.book-option-icon {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.book-option-sub {
  font-size: 0.8rem;
  font-weight: 400;
  opacity: 0.8;
}

/* ---- Approved State ---- */

.approved-banner {
  background: rgba(0, 214, 143, 0.08);
  border: 1px solid rgba(0, 214, 143, 0.25);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

.approved-banner-inner {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  max-width: 700px;
  margin: 0 auto;
}

.approved-banner-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--success);
  color: #0a0a0f;
  font-weight: 800;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.approved-banner strong {
  font-size: 1rem;
  display: block;
  margin-bottom: 0.25rem;
}

.approved-banner strong span {
  color: var(--accent);
}

.approved-banner p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
}

.plan-card-approved {
  border-color: var(--success) !important;
  box-shadow: 0 0 30px rgba(0, 214, 143, 0.15);
}

.plan-card-dimmed {
  opacity: 0.4;
  pointer-events: none;
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
  .portal-nav-inner { padding: 0 1rem; }
  .portal-nav-links { display: none; }
  .portal-page { padding: 1rem; }
  .grid-2, .grid-3, .plans-grid { grid-template-columns: 1fr; }
  .usage-used { font-size: 2rem; }
  .line-selector { overflow-x: auto; flex-wrap: nowrap; }
  .plans-hero h1 { font-size: 1.75rem; }
  .plan-amount { font-size: 2rem; }
  .plans-steps { flex-direction: column; }
  .plans-step-arrow { transform: rotate(90deg); }
  .book-modal-card { padding: 1.5rem; }
}
