@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --background: #fff;
  --foreground: #111;
  --secondary: #666;
  --tertiary: #999;
  --border: #e0e0e0;
  --border-light: #eaeaea;
  --card-bg: #f9f9f9;
  --input-bg: #fff;
  --hover-bg: #f5f5f5;
  --hover-color: #00205B;
}

[data-theme="dark"] {
  --background: #0a0a0a;
  --foreground: #ededed;
  --secondary: #a0a0a0;
  --tertiary: #707070;
  --border: #2a2a2a;
  --border-light: #1a1a1a;
  --card-bg: #141414;
  --input-bg: #1a1a1a;
  --hover-bg: #1f1f1f;
  --hover-color: #003DA5;
}

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

html, body {
  background: var(--background);
  max-width: 100vw;
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  font-family: Inter, sans-serif;
  transition: background-color 0.3s, color 0.3s;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Layout */
.main-container {
  flex-direction: column;
  gap: 4rem;
  min-height: 100vh;
  padding: 4rem;
  display: flex;
  position: relative;
}

@media (min-width: 1024px) {
  .main-container {
    flex-direction: row;
    align-items: flex-start;
  }
}

.content-wrapper {
  z-index: 1;
  flex-direction: column;
  flex: 1 1 0%;
  gap: 4rem;
  display: flex;
  position: relative;
}

/* Graph Section */
.graph-section {
  opacity: 0.85;
  z-index: 1;
  flex-direction: column;
  flex: 1 1 0%;
  gap: 1rem;
  max-width: 600px;
  display: flex;
  position: relative;
}

.network-graph-container {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.network-graph-container canvas {
  width: 100%;
  height: auto;
  display: block;
}

/* Header */
.header-section {
  flex-direction: column;
  gap: 1.5rem;
  max-width: 800px;
  display: flex;
}

.title {
  letter-spacing: -0.02em;
  font-size: 2.5rem;
  font-weight: 500;
}

.description {
  color: var(--secondary);
  flex-direction: column;
  gap: 1rem;
  font-size: 1rem;
  line-height: 1.6;
  display: flex;
}

/* Join Actions */
.join-actions {
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  display: flex;
}

.join-request-btn {
  cursor: pointer;
  background: var(--hover-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1rem;
  font-family: Inter, sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  transition: opacity 0.2s;
}

.join-request-btn:hover {
  opacity: 0.9;
}

.nav-link {
  color: var(--secondary);
  align-items: center;
  gap: 0.35rem;
  font-size: 0.92rem;
  font-weight: 500;
  transition: color 0.2s;
  display: inline-flex;
}

.nav-link:hover {
  color: var(--hover-color);
}

/* Members Table */
.members-table-container {
  width: 100%;
  overflow-x: auto;
}

.members-table {
  border-collapse: collapse;
  text-align: left;
  table-layout: fixed;
  width: 100%;
}

.members-table th {
  color: var(--foreground);
  padding-bottom: 1.5rem;
  padding-right: 1rem;
  font-size: 1.2rem;
  font-weight: 500;
}

.members-table th:first-child { width: 28%; }
.members-table th:nth-child(2) { width: 25%; }
.members-table th:nth-child(3) { width: 27%; }
.members-table th:nth-child(4) { width: 20%; padding-left: 1rem; }

.members-table td {
  color: var(--foreground);
  vertical-align: middle;
  padding: 1rem 1rem 1rem 0;
  font-size: 1rem;
}

.members-table td:nth-child(3) { overflow: hidden; }
.members-table td:nth-child(4) { padding-left: 1rem; padding-right: 2rem; }

.user-cell {
  align-items: center;
  gap: 0.75rem;
  display: flex;
}

.avatar {
  object-fit: cover;
  filter: grayscale(100%);
  border-radius: 50%;
  flex-shrink: 0;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  transition: filter 0.3s;
  overflow: hidden;
  background: var(--border);
}

.members-table tbody tr:hover .avatar {
  filter: grayscale(0%);
}

.site-link {
  color: var(--foreground);
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  transition: opacity 0.2s;
  display: block;
  overflow: hidden;
}

.site-link:hover { color: var(--hover-color); }

.name-link {
  color: var(--foreground);
  text-decoration: none;
  transition: opacity 0.2s;
}

.name-link:hover { color: var(--hover-color); }

/* Social Icons */
.social-icons {
  align-items: center;
  gap: 0.5rem;
  min-height: 20px;
  padding: 0.25rem 0;
  display: flex;
}

.social-icon-link {
  color: var(--foreground);
  flex-shrink: 0;
  justify-content: center;
  align-items: center;
  padding: 0.25rem;
  line-height: 1;
  text-decoration: none;
  transition: opacity 0.2s;
  display: inline-flex;
}

.social-icon-link svg {
  fill: currentcolor;
  width: 16px;
  height: 16px;
  display: block;
}

.social-icon-link:hover { color: var(--hover-color); }

/* Divider */
.projects-section-divider {
  border-top: 1px dashed var(--border);
  margin: 2.5rem 0 1.5rem;
}

.avatar-project {
  border: 1.5px dashed var(--hover-color);
  border-radius: 6px !important;
}

/* Search */
.search-bar-container {
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--secondary);
  border-radius: 8px;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  display: flex;
}

.search-input {
  color: var(--foreground);
  background: transparent;
  border: none;
  outline: none;
  flex: 1 1 0%;
  font-family: Inter, sans-serif;
  font-size: 0.95rem;
}

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

/* Member Chips */
.member-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.member-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: default;
  transition: border-color 0.2s;
}

.member-chip:hover {
  border-color: var(--hover-color);
}

.member-chip-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
}

/* ASCII Art Background */
.ascii-art-background {
  z-index: 0;
  pointer-events: none;
  user-select: none;
  opacity: 0.08;
  position: fixed;
  bottom: 5%;
  right: 5%;
  overflow: visible;
}

[data-theme="dark"] .ascii-art-background {
  opacity: 0.08;
}

.ascii-owl {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 16px;
  line-height: 1.05;
  letter-spacing: 0.05em;
  white-space: pre;
  color: #ffffff;
  transform: scale(5);
  transform-origin: center center;
}

/* Template Credit */
.template-credit {
  color: var(--tertiary);
  opacity: 0.7;
  z-index: 2;
  font-size: 0.72rem;
  position: absolute;
  bottom: 1.25rem;
  right: 1.25rem;
}

.template-credit-link {
  color: inherit;
  border-bottom: 1px solid transparent;
  text-decoration: none;
  transition: opacity 0.2s, border-color 0.2s;
}

.template-credit-link:hover {
  opacity: 0.95;
  border-bottom-color: currentcolor;
}

/* Join Modal */
.join-modal-overlay {
  z-index: 50;
  background: rgba(0,0,0,0.55);
  justify-content: center;
  align-items: center;
  padding: 1rem;
  display: flex;
  position: fixed;
  inset: 0;
}

.join-modal-content {
  border: 1px solid var(--border);
  background: var(--background);
  border-radius: 12px;
  width: min(760px, 100%);
  max-height: 90vh;
  padding: 1.5rem;
  overflow-y: auto;
}

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

.join-modal-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.join-modal-close {
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--foreground);
  cursor: pointer;
  border-radius: 6px;
  width: 30px;
  height: 30px;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.join-modal-status {
  text-align: center;
  margin: 0 0 0.9rem;
  font-size: 0.9rem;
}

.join-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  display: grid;
}

.join-input, .join-textarea {
  border: 1px solid var(--border);
  background: var(--input-bg);
  width: 100%;
  color: var(--foreground);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  font-family: Inter, sans-serif;
  font-size: 0.92rem;
}

.join-textarea { resize: vertical; }
.join-input-wide { grid-column: 1 / -1; }

.join-form-actions {
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.9rem;
  display: flex;
}

.join-submit {
  cursor: pointer;
  background: var(--hover-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1rem;
  font-family: Inter, sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  transition: opacity 0.2s;
}

.join-submit:hover { opacity: 0.9; }

.join-cancel-btn {
  border: 1px solid var(--border);
  cursor: pointer;
  background: var(--input-bg);
  color: var(--foreground);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  font-family: Inter, sans-serif;
  font-size: 0.9rem;
}

.join-tip {
  color: var(--secondary);
  margin-top: 0.65rem;
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
  .main-container { gap: 2rem; padding: 2rem; }
  .content-wrapper { gap: 2rem; }
  .title { font-size: 1.8rem; }
  .graph-section { max-width: 100%; }
  .members-table { table-layout: fixed; }
  .members-table th, .members-table td { padding-right: 1rem; font-size: 0.9rem; }
  .members-table th { padding-bottom: 1rem; font-size: 1rem; }
  .ascii-art-background { opacity: 0.025; bottom: -20%; }
  .join-form-grid { grid-template-columns: 1fr; }
  .template-credit { font-size: 0.68rem; bottom: 0.85rem; right: 0.85rem; }
}

@media (max-width: 480px) {
  .main-container { gap: 1.5rem; padding: 1.25rem; }
  .content-wrapper { gap: 1.5rem; }
  .title { font-size: 1.5rem; }
  .description { font-size: 0.9rem; }
  .members-table th:nth-child(3), .members-table td:nth-child(3) { display: none; }
  .members-table th, .members-table td { padding: 0.75rem 0.5rem 0.75rem 0; font-size: 0.85rem; }
  .members-table th { padding-bottom: 0.75rem; font-size: 0.9rem; }
  .avatar { width: 28px; min-width: 28px; height: 28px; min-height: 28px; }
  .user-cell { gap: 0.5rem; }
  .search-bar-container { padding: 0.6rem 0.8rem; }
  .search-input { font-size: 0.9rem; }
  .ascii-art-background { opacity: 0.02; bottom: -15%; right: -30%; }
  .ascii-owl { transform: scale(2.5); }
}
