:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
}

.container {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 0;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

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

.user-email {
  color: var(--gray-600);
  font-size: 1rem;
}

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

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

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

.btn-secondary {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

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

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

.btn-danger:hover {
  background: #dc2626;
}

.btn-google {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
  gap: 0.5rem;
}

.btn-google:hover {
  background: var(--gray-50);
}

.btn-google img {
  width: 18px;
  height: 18px;
}

/* Cards */
.card {
  background: white;
  border-radius: 0.5rem;
  border: 1px solid var(--gray-200);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
}

/* Status badges */
.status {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 9999px;
}

.status-connected {
  background: #d1fae5;
  color: #065f46;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-expired {
  background: #fee2e2;
  color: #991b1b;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 1rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.25rem;
}

.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.375rem;
  transition: border-color 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-hint {
  font-size: 1rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

.form-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.375rem;
  background: white;
  cursor: pointer;
}

/* Connections list */
.connections-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.connection-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  transition: border-color 0.15s;
}

.connection-item:hover {
  border-color: var(--gray-300);
}

.connection-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.connection-name {
  font-weight: 500;
  color: var(--gray-900);
}

.connection-meta {
  font-size: 1rem;
  color: var(--gray-500);
}

.connection-actions {
  display: flex;
  gap: 0.5rem;
}

/* Login page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
}

.login-card h1 {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 0.5rem;
}

.login-card p {
  text-align: center;
  color: var(--gray-600);
  margin-bottom: 2rem;
}

.login-card .btn {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
}

/* Page sections */
.page-header {
  padding: 2rem 0;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 600;
}

.page-subtitle {
  color: var(--gray-600);
  margin-top: 0.25rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-500);
}

.empty-state h3 {
  font-size: 1rem;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

/* Alert messages */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.alert-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Team members */
.team-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.team-member {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--gray-100);
}

.team-member:last-child {
  border-bottom: none;
}

.team-member-email {
  font-size: 1rem;
}

.team-member-owner {
  font-size: 1rem;
  color: var(--gray-500);
}

.team-list-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.team-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--gray-100);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 1rem;
  color: var(--gray-700);
}

.team-role {
  color: var(--gray-500);
}

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.loading {
  display: flex;
  justify-content: center;
  padding: 2rem;
}

/* Code snippet */
.code-snippet {
  background: var(--gray-800);
  color: #e5e7eb;
  padding: 1rem;
  border-radius: 0.5rem;
  font-family: "SF Mono", Monaco, "Courier New", monospace;
  font-size: 1rem;
  overflow-x: auto;
  white-space: pre;
}

/* Hidden utility */
.hidden {
  display: none !important;
}

/* Custom autocomplete dropdown */
.autocomplete-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--gray-300);
  border-top: none;
  border-radius: 0 0 0.375rem 0.375rem;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.autocomplete-dropdown.show {
  display: block;
}

.autocomplete-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 1rem;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background: var(--gray-100);
}

.autocomplete-item-id {
  color: var(--gray-500);
  font-size: 1rem;
}

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

.modal.hidden {
  display: none;
}

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

.modal-content {
  position: relative;
  z-index: 101;
  width: 100%;
  animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Project item in modal */
.project-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: 0.375rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.project-option:hover {
  border-color: var(--primary);
  background: var(--gray-50);
}

.project-option-name {
  font-weight: 500;
}

.project-option-id {
  font-size: 1rem;
  color: var(--gray-500);
}
