/* ============================================================
   Redwood Privacy — Company Browser Page Styles
   Light steel theme (same as vault.css — NOT dark)
   ============================================================ */

/* ── Login Gate ──────────────────────────────────────────────── */
.companies-gate {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gate-bg-preview {
  position: absolute;
  inset: 0;
  overflow: hidden;
  filter: blur(6px);
  opacity: 0.35;
  pointer-events: none;
}

.gate-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  width: 100%;
  max-width: 900px;
  gap: var(--space-4);
  padding: var(--space-8) var(--space-4);
  justify-content: center;
  margin-top: 80px;
}

.gate-card {
  height: 180px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
}

.gate-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(237, 241, 247, 0.88);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.gate-content {
  position: relative;
  z-index: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-10) var(--space-8);
  text-align: center;
  max-width: 480px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  animation: scaleIn 0.4s ease both;
}

.gate-lock-icon {
  width: 56px;
  height: 56px;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gate-lock-svg {
  width: 28px;
  height: 28px;
  color: var(--blue-600);
}

.gate-title {
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.gate-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 380px;
}

.gate-ctas {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  margin-top: var(--space-2);
}

.gate-note {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-2);
}

/* ── Main Page ───────────────────────────────────────────────── */
.companies-main {
  padding-top: 24px;
  min-height: 100vh;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

.companies-header {
  padding: var(--space-10) 0 var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.companies-title {
  font-size: var(--text-3xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.companies-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
}

/* ── Toolbar ─────────────────────────────────────────────────── */
.companies-toolbar {
  position: sticky;
  top: 64px;
  z-index: var(--z-above);
  background: rgba(195, 209, 228, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.55);
  padding: var(--space-4) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.search-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 11px 14px 11px 42px;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

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

.filter-row {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
}

.filter-select {
  padding: 8px 32px 8px 12px;
  min-height: 44px;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239ca3af' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color var(--transition-fast);
}

.filter-select:focus {
  outline: none;
  border-color: var(--blue-500);
}

.filter-toggle {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.filter-toggle input[type="checkbox"] {
  width: 24px;
  height: 24px;
  cursor: pointer;
  accent-color: var(--blue-600);
}

/* ── Results ─────────────────────────────────────────────────── */
.results-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
  padding: var(--space-4) 0 var(--space-2);
}

/* ── Company Grid ────────────────────────────────────────────── */
.companies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-4);
  padding-bottom: var(--space-16);
}

/* ── Company Card ────────────────────────────────────────────── */
.company-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
  cursor: pointer;
}

.company-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-default);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.card-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.card-header-info {
  flex: 1;
  min-width: 0;
}

.card-name {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-badges {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  margin-top: 4px;
}

.cat-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.broker-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(234, 88, 12, 0.08);
  color: #c2410c;
  border: 1px solid rgba(234, 88, 12, 0.2);
}

.review-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.1);
  color: #92400e;
  border: 1px solid rgba(245, 158, 11, 0.2);
}


/* ── Card Meter Strip & Concise Summary ──────────────────────── */
.card-meter-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.card-meter-strip .grade-ring-wrap {
  width: 56px;
  height: 56px;
}

.ring-grade-letter {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
}

.card-meter-side {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.card-meter-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.card-meter-score span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 2px;
}

.card-meter-status {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-summary-text {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Card Footer ─────────────────────────────────────────────── */
.card-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

.card-footer-meta {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.card-footer-link {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--blue-600);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap var(--transition-fast);
}

.company-card:hover .card-footer-link {
  gap: var(--space-2);
}

/* ── Empty State ─────────────────────────────────────────────── */
.companies-empty {
  text-align: center;
  padding: var(--space-16) 0;
  color: var(--text-secondary);
  font-size: var(--text-base);
}

/* ── Page Footer ─────────────────────────────────────────────── */
.page-footer {
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-6) 0;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ── Auth Modal (re-use landing styles) ──────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 60, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal-overlay[hidden] { display: none; }

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  animation: scaleIn 0.3s ease both;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: var(--space-1);
  border-radius: var(--radius-md);
  transition: color var(--transition-fast);
  font-size: 20px;
  line-height: 1;
}

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

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-tab {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-body {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .companies-toolbar {
    position: static;
  }
}

@media (max-width: 1200px) {
  /* grid handled by auto-fill */
}

@media (max-width: 900px) {
  .gate-card-grid { grid-template-columns: repeat(2, 220px); }
}

@media (max-width: 600px) {
  .gate-card-grid { grid-template-columns: 1fr; }
  .gate-ctas { flex-direction: column; }
  .filter-row { flex-direction: column; align-items: stretch; }
  .filter-select { width: 100%; }
}
