/* PatientArc Portal — Custom Styles */
:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
}

.nav-bar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-bar .logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--brand);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a,
.nav-links .nav-item {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--brand);
}

/* Dropdown nav */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-trigger {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}

.dropdown-trigger.active {
  color: var(--brand);
  font-weight: 600;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  min-width: 180px;
  z-index: 100;
  display: none;
  padding: 0.35rem 0;
  margin-top: 0.25rem;
  /* Small invisible bridge to prevent gap from closing menu */
  padding-top: 0.5rem;
}

/* Add invisible padding above to prevent gap closing */
.nav-dropdown::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 0.35rem;
  display: none;
}

.nav-dropdown:hover::after {
  display: block;
}

.nav-dropdown:hover .dropdown-menu {
  display: block;
}

.nav-dropdown.open .dropdown-menu {
  display: block;
}

.dropdown-menu a {
  display: block;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  color: var(--text);
  text-decoration: none;
}

.dropdown-menu a:hover {
  background: var(--bg);
  color: var(--brand);
}

.dropdown-menu a.active {
  color: var(--brand);
  border-left: 3px solid var(--brand);
  padding-left: calc(1rem - 3px);
  font-weight: 600;
}

/* Mobile hamburger */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
  padding: 0.25rem;
}

@media (max-width: 768px) {
  .nav-hamburger { display: block; }
  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    gap: 0.75rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    z-index: 99;
  }
  .nav-links.open { display: flex; }
  .nav-dropdown { display: block; }
  .dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    padding-left: 1rem;
    margin-top: 0;
  }
  .nav-dropdown .dropdown-menu { display: none; }
  .nav-dropdown.open .dropdown-menu { display: block; }
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--brand);
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

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

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

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

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

.input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-hot { background: #fef2f2; color: #dc2626; }
.badge-warm { background: #fff7ed; color: #ea580c; }
.badge-nurture { background: #f0fdf4; color: #16a34a; }
.badge-new { background: #eff6ff; color: #2563eb; }
.badge-active { background: #ecfdf5; color: #059669; }
.badge-converted { background: #f0fdf4; color: #16a34a; }

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

th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

tr:hover {
  background: var(--bg);
}

/* Login page specific */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
}

.login-card {
  background: white;
  border-radius: 1rem;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.login-card .subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}

.error-msg {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 0.5rem;
  display: none;
}

.session-list {
  max-height: 500px;
  overflow-y: auto;
}

.session-item {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.session-item:hover {
  background: var(--bg);
}

.session-item .session-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.session-item .session-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.chat-messages {
  max-height: 400px;
  overflow-y: auto;
  padding: 1rem;
}

.chat-bubble {
  max-width: 80%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.chat-bubble.user {
  background: var(--bg);
  margin-left: auto;
  border-bottom-right-radius: 0.25rem;
}

.chat-bubble.assistant {
  background: var(--brand);
  color: white;
  border-bottom-left-radius: 0.25rem;
}

.chat-bubble.staff {
  background: #fbbf24;
  color: #1e293b;
  border-bottom-left-radius: 0.25rem;
}
