/* Turkey AI Startups — UI for Cloudflare Pages */

:root {
  --bg: #0f0f12;
  --bg-elevated: #18181c;
  --bg-hover: #222228;
  --border: #2a2a32;
  --text: #e4e4e7;
  --text-muted: #a1a1aa;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --success: #22c55e;
  --warn: #eab308;
  --danger: #ef4444;
  --radius: 8px;
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.tagline {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.auth-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.auth-status {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

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

.btn--sm {
  font-size: 0.8125rem;
  padding: 0.35rem 0.6rem;
}

/* Auth modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.modal-content {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 360px;
}

.modal-content h3 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
}

.modal-content input {
  display: block;
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.modal-content input:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-content button[type="submit"] {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.6rem;
  font: inherit;
  font-size: 0.9375rem;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.modal-content button[type="submit"]:hover {
  background: var(--accent-hover);
}

.auth-error {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  color: var(--danger);
  min-height: 1.2em;
}

.auth-switch {
  margin: 1rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.auth-switch button {
  font: inherit;
  font-size: inherit;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.auth-switch button:hover {
  text-decoration: underline;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

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

/* Main */
.main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 1.5rem;
}

.view {
  display: block;
}

.view[hidden] {
  display: none !important;
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search {
  width: 100%;
  padding: 0.6rem 0.75rem 0.6rem 2.25rem;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s;
}

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

.search:focus {
  border-color: var(--accent);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

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

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

.btn--primary {
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
}

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

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.filters {
  display: flex;
  gap: 0.5rem;
}

.filter-select {
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  outline: none;
}

.filter-select:focus {
  border-color: var(--accent);
}

/* Table */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

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

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

.table th {
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

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

.table tbody tr:last-child td {
  border-bottom: none;
}

.row-empty td {
  color: var(--text-muted);
  font-style: italic;
  padding: 2rem;
  text-align: center;
}

.company-cell {
  font-weight: 500;
  color: var(--text);
}

.company-cell a {
  color: inherit;
  text-decoration: none;
}

.company-cell a:hover {
  color: var(--accent);
  text-decoration: underline;
}

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

.status-badge--active {
  background: rgba(34, 197, 94, 0.2);
  color: var(--success);
}

.status-badge--stale {
  background: rgba(234, 179, 8, 0.2);
  color: var(--warn);
}

.status-badge--blacklisted {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.btn-link {
  font: inherit;
  font-size: 0.875rem;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0;
}

.btn-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.pagination button {
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.pagination button:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination .pagination-info {
  align-self: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0 0.5rem;
}

/* Detail view */
.detail-back {
  margin-bottom: 1rem;
}

.btn {
  font: inherit;
  font-size: 0.9375rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  border: none;
}

.btn--ghost {
  color: var(--text-muted);
  background: transparent;
}

.btn--ghost:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.detail-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.detail-content h2 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.detail-content .meta {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.detail-content .meta a {
  color: var(--accent);
  text-decoration: none;
}

.detail-content .meta a:hover {
  text-decoration: underline;
}

.detail-grid {
  display: grid;
  gap: 1rem;
}

.detail-grid dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0;
}

.detail-grid dd {
  margin: 0;
  font-size: 0.9375rem;
}

.detail-grid dd + dt {
  margin-top: 0.5rem;
}

.detail-content .description {
  margin-top: 1rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Footer */
.footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer p {
  margin: 0;
}
