/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  line-height: 1.5;
  font-family: inherit;
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: #2a3038;
  color: var(--text);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { color: var(--text); }

.btn-sm {
  padding: 0.2rem 0.5rem;
  font-size: 0.8125rem;
}

.btn-block { width: 100%; justify-content: center; }

/* === Forms === */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: var(--text);
}

.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 129, 247, 0.15);
}

textarea.form-control { resize: vertical; }

.form-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  display: block;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.form-check-input, input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

/* === Cards === */
.repo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.15s;
}

.repo-card:hover { border-color: var(--accent); }

.repo-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
  flex-wrap: wrap;
}

.repo-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--accent);
}

.repo-description {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.repo-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

/* === Badges === */
.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success { background: rgba(63,185,80,0.15); color: var(--success); border: 1px solid rgba(63,185,80,0.3); }
.badge-warning { background: rgba(210,153,34,0.15); color: var(--warning); border: 1px solid rgba(210,153,34,0.3); }
.badge-danger  { background: rgba(248,81,73,0.15); color: var(--danger); border: 1px solid rgba(248,81,73,0.3); }
.badge-muted   { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }

/* === Auth pages === */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 3rem 1rem;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 420px;
}

.auth-title {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.auth-links {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* === Settings sections === */
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.settings-section h2 {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
}

.danger-zone {
  border-color: rgba(248, 81, 73, 0.4);
}

.danger-zone h2 { color: var(--danger); }

.danger-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* === Data table === */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th, .data-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.data-table th {
  color: var(--text-muted);
  font-weight: 500;
  background: var(--surface);
}

.data-table tr:hover td { background: var(--surface2); }

/* === Collaborators === */
.collaborator-user {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
}

.avatar-sm {
  width: 24px;
  height: 24px;
}

.avatar-md {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

/* === User directory (Explore > Users) === */
.user-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 0.75rem;
}

.user-card {
  display: flex;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  color: var(--text);
  transition: border-color 0.15s;
}

.user-card:hover { border-color: var(--accent); text-decoration: none; color: var(--text); }

.user-card-info { min-width: 0; }

.user-card-name {
  font-weight: 600;
  font-size: 0.9375rem;
}

.user-card-username {
  font-size: 0.8125rem;
  margin-bottom: 0.25rem;
}

.user-card-bio {
  font-size: 0.8125rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.user-card-meta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.8125rem;
  margin-top: 0.25rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-read {
  background: var(--surface2);
  color: var(--text-muted);
}

.badge-write {
  background: rgba(63, 185, 80, 0.15);
  color: #3fb950;
}

.badge-group {
  background: rgba(88, 166, 255, 0.15);
  color: #58a6ff;
  margin-right: 0.4rem;
}

.collaborator-add-form {
  margin-top: 1.25rem;
  align-items: flex-end;
}

.collaborator-search {
  position: relative;
  min-width: 260px;
}

.collaborator-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 0.25rem;
  max-height: 220px;
  overflow-y: auto;
}

.collaborator-results.open { display: block; }

.collaborator-result-item {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.collaborator-result-item:hover {
  background: var(--surface2);
}

/* === Profile === */
.profile-header {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  align-items: flex-start;
}

.avatar-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  flex-shrink: 0;
}

.profile-info h1 { margin-bottom: 0.125rem; }

.profile-company-country {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* === Issues === */
.issues-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
}

.issues-filter {
  display: flex;
  gap: 0.25rem;
}

.issues-filter a {
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
}

.issues-filter a.active, .issues-filter a:hover { background: var(--surface2); color: var(--text); }

.issue-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

.issue-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
}

.issue-item:last-child { border-bottom: none; }

.issue-state {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.state-open { color: var(--success); }
.state-closed { color: var(--danger); }

.issue-title {
  font-weight: 500;
  display: block;
  margin-bottom: 0.25rem;
}

.issue-meta { font-size: 0.8125rem; color: var(--text-muted); }

/* === Issue detail === */
.issue-detail-header {
  margin-bottom: 1.5rem;
}

.issue-detail-header h1 { font-size: 1.375rem; margin-bottom: 0.5rem; }

.issue-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-right: 0.5rem;
}

.timeline { display: flex; flex-direction: column; gap: 1rem; }

.timeline-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.timeline-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
  text-transform: uppercase;
}

.timeline-body {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.timeline-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.markdown-body { padding: 0.875rem; }

.issue-comment-form { margin-top: 1.5rem; }

/* === Clone box === */
.clone-url-box {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.clone-input {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  width: 420px;
  max-width: 100%;
}

/* === Editor toolbar === */
.editor-toolbar {
  display: flex;
  gap: 0.25rem;
  padding: 0.375rem 0.5rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
}

.editor-toolbar + .editor-textarea {
  border-radius: 0 0 var(--radius) var(--radius);
}

.editor-btn {
  padding: 0.2rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

/* === Mobile responsive === */
@media (max-width: 600px) {
  .auth-card { padding: 1.25rem; }
  .profile-header { flex-direction: column; }
  .issues-header { flex-direction: column; align-items: flex-start; }
  .data-table { font-size: 0.8125rem; }
  .data-table th, .data-table td { padding: 0.5rem 0.5rem; }
}
