/* ================================================================
   user-styles.css — Auto In-Vitro User System
   Dashboard, Project Editor, Admin Panel, Auth Forms
   Matches McGheeLabWebsite user-styles.css patterns exactly
   ================================================================ */

/* ─── Global select styling ─────────────────────────────────── */
select {
  background: var(--surface, #121620);
  color: var(--text, #eef2f7);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  padding: .5rem .6rem;
  font-family: inherit;
  font-size: .9rem;
}
select option {
  background: var(--surface, #121620);
  color: var(--text, #eef2f7);
}
select:focus {
  outline: none;
  border-color: var(--accent, #f186c1);
  box-shadow: 0 0 0 3px rgba(241,134,193,.2);
}

/* ─── Auth Page ──────────────────────────────────────────────── */
.user-auth-page {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 1rem;
  min-height: 50vh;
}

.auth-cards-row {
  display: flex;
  gap: 2rem;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
  width: 100%;
  max-width: 900px;
}

.auth-card {
  background: var(--surface, #121620);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius, 12px);
  padding: 2rem;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow, 0 10px 30px rgba(0,0,0,.25));
}

.auth-card h2 {
  margin: 0 0 .5rem;
  color: var(--text, #eef2f7);
}

.auth-subtitle {
  color: var(--muted, #a8b3c7);
  margin-bottom: 1.5rem;
}

.auth-form .form-group {
  margin-bottom: 1rem;
}

.auth-error {
  background: rgba(185,28,28,.15);
  color: #fca5a5;
  padding: .75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: .9rem;
}

/* ─── Forms (shared) ─────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.form-group label {
  font-weight: 600;
  font-size: .875rem;
  color: var(--text, #eef2f7);
}

.form-group input,
.form-group textarea,
.form-group select {
  padding: .6rem .75rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  font-size: .95rem;
  font-family: inherit;
  background: rgba(255,255,255,.04);
  color: var(--text, #eef2f7);
  transition: border-color .15s;
}

.form-group select option {
  background: var(--surface, #121620);
  color: var(--text, #eef2f7);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent, #f186c1);
  box-shadow: 0 0 0 3px rgba(241,134,193,.2);
}

/* Page-level text colors */
.dashboard-page,
.story-editor-page,
.admin-page,
.user-auth-page {
  color: var(--text, #eef2f7);
}

.dash-card h3,
.editor-header h2,
.admin-page h2 {
  color: var(--text, #eef2f7);
}

.form-status {
  margin-top: .75rem;
  padding: .5rem .75rem;
  border-radius: 6px;
  font-size: .875rem;
}

.form-status.success {
  background: rgba(22,101,52,.2);
  color: #86efac;
}

.form-status.error {
  background: rgba(185,28,28,.15);
  color: #fca5a5;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .6rem 1.25rem;
  border: none;
  border-radius: 6px;
  font-size: .9rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s, filter .15s;
  text-decoration: none;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent, #f186c1);
  color: #031a16;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.15);
}

.btn-secondary {
  background: var(--surface-2, #1a2030);
  color: var(--text, #eef2f7);
  border: 1px solid rgba(255,255,255,.1);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255,255,255,.08);
}

.btn-danger {
  background: rgba(185,28,28,.15);
  color: #fca5a5;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(185,28,28,.25);
}

.btn-small {
  padding: .35rem .75rem;
  font-size: .8rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  background: var(--surface-2, #1a2030);
  color: var(--text, #eef2f7);
  cursor: pointer;
  font-size: 1rem;
  transition: background .15s;
}

.btn-icon:hover {
  background: rgba(255,255,255,.08);
}

/* ─── Dashboard ──────────────────────────────────────────────── */
.dashboard-page {
  padding: 1.5rem 1rem;
  max-width: 1000px;
  margin: 0 auto;
  overflow: hidden;
  box-sizing: border-box;
}

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

.dash-header h2 {
  margin: 0;
}

.profile-alert {
  background: rgba(251,191,36,.12);
  border: 1px solid rgba(251,191,36,.3);
  color: #fbbf24;
  padding: .75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: .9rem;
}
.profile-alert strong { display: block; margin-bottom: .25rem; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  max-width: 100%;
  overflow: hidden;
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.dash-card {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius, 12px);
  padding: 1.5rem;
  box-shadow: var(--shadow, 0 10px 30px rgba(0,0,0,.25));
  min-width: 0;
  overflow: hidden;
}

.dash-card-full {
  grid-column: 1 / -1;
}

.dash-card h3 {
  margin: 0 0 1rem;
}

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

.card-head h3 {
  margin: 0;
}

.card-head-actions {
  display: flex;
  gap: .35rem;
  align-items: center;
}

/* Profile */
.profile-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profile-photo-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.profile-photo-preview {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2, #1a2030);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-placeholder {
  font-size: .75rem;
  color: var(--muted, #a8b3c7);
  text-align: center;
}

.upload-label {
  cursor: pointer;
}

/* Stories/Projects list */
.stories-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.story-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .75rem;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 8px;
  gap: .5rem;
}

.story-item-info {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}

.story-item-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text, #eef2f7);
}

.story-item-actions {
  display: flex;
  gap: .35rem;
  flex-shrink: 0;
}

.empty-state {
  color: var(--muted, #a8b3c7);
  text-align: center;
  padding: 2rem 1rem;
}

.loading-text {
  color: var(--muted, #a8b3c7);
  text-align: center;
}

.error-text {
  color: #fca5a5;
}

.hint {
  color: var(--muted, #a8b3c7);
  font-size: .85rem;
  margin: 0;
}

/* ─── Status Badges ──────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 9999px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-draft    { background: rgba(255,255,255,.06); color: var(--muted, #a8b3c7); }
.status-pending  { background: rgba(234,179,8,.15); color: #fde68a; }
.status-published { background: rgba(34,197,94,.15); color: #86efac; }
.status-active   { background: rgba(34,197,94,.15); color: #86efac; }
.status-used     { background: rgba(255,255,255,.04); color: rgba(168,179,199,.5); }
.status-expired  { background: rgba(185,28,28,.15); color: #fca5a5; }

/* ─── Project Editor ────────────────────────────────────────── */
.story-editor-page {
  padding: 1.5rem 1rem;
  max-width: 800px;
  margin: 0 auto;
}

.editor-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.editor-header h2 {
  margin: 0;
}

.story-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.story-form h3 {
  margin: 1rem 0 0;
  color: var(--text, #eef2f7);
}

/* Section blocks */
.sections-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.section-block {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  padding: 1rem;
  background: rgba(255,255,255,.02);
}

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

.section-label {
  font-weight: 600;
  font-size: .875rem;
  color: var(--muted, #a8b3c7);
}

.section-controls {
  display: flex;
  gap: .25rem;
}

.section-media-area {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-top: .5rem;
}

.media-upload-zone {
  border: 2px dashed rgba(255,255,255,.15);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-upload-zone:hover,
.media-upload-zone.drag-over {
  border-color: var(--accent, #f186c1);
  background: rgba(241,134,193,.06);
}

.upload-hint {
  color: var(--muted, #a8b3c7);
  font-size: .85rem;
  margin: 0;
}

.section-img-preview {
  max-width: 100%;
  max-height: 240px;
  border-radius: 6px;
  object-fit: contain;
}

.image-progress,
.media-progress {
  font-size: .85rem;
  color: var(--accent, #f186c1);
}

/* Editor actions bar */
.editor-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,.08);
}

/* ─── Admin Panel ────────────────────────────────────────────── */
.admin-page {
  padding: 1.5rem 1rem;
  max-width: 1000px;
  margin: 0 auto;
}

.admin-page h2 {
  margin: 0 0 1rem;
}

.admin-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid rgba(255,255,255,.08);
  padding-bottom: 0;
  overflow-x: auto;
}

.tab-btn {
  padding: .5rem 1.25rem;
  border: none;
  background: none;
  font-size: .9rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted, #a8b3c7);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text, #eef2f7);
}

.tab-btn.active {
  color: var(--accent, #f186c1);
  border-bottom-color: var(--accent, #f186c1);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Admin tables */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.admin-table th {
  text-align: left;
  padding: .5rem .75rem;
  border-bottom: 2px solid rgba(255,255,255,.08);
  font-weight: 600;
  color: var(--muted, #a8b3c7);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.admin-table td {
  padding: .6rem .75rem;
  border-bottom: 1px solid rgba(255,255,255,.04);
  vertical-align: middle;
}

.admin-table tr.row-used td {
  opacity: .5;
}

.role-select {
  padding: .3rem .5rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 4px;
  font-size: .85rem;
  font-family: inherit;
  background: rgba(255,255,255,.04);
  color: var(--text, #eef2f7);
}

.role-select option {
  background: var(--surface, #121620);
}

/* Invitation form */
.inv-form-section {
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.inv-form-section h3 {
  margin: 0 0 .75rem;
}

.inline-form {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.inline-form input,
.inline-form select {
  padding: .5rem .6rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  font-size: .85rem;
  font-family: inherit;
  background: rgba(255,255,255,.04);
  color: var(--text, #eef2f7);
}

.inline-form select option {
  background: var(--surface, #121620);
}

.inline-form input[type="email"] {
  min-width: 180px;
}

.copy-row {
  display: flex;
  gap: .5rem;
  margin-top: .5rem;
}

.copy-row input {
  flex: 1;
  padding: .5rem .75rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  font-size: .85rem;
  font-family: monospace;
  background: rgba(255,255,255,.04);
  color: var(--text, #eef2f7);
}

/* Pending projects */
.pending-card {
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.pending-info strong {
  font-size: 1.05rem;
  color: var(--text, #eef2f7);
}

.pending-author {
  color: var(--muted, #a8b3c7);
  font-size: .85rem;
  margin-left: .5rem;
}

.pending-sections {
  margin: .75rem 0;
}

.pending-section-preview {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  margin-bottom: .5rem;
}

.pending-section-preview p {
  flex: 1;
  font-size: .85rem;
  color: var(--muted, #a8b3c7);
  margin: 0;
}

.pending-section-preview img {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.pending-actions {
  display: flex;
  gap: .5rem;
  margin-top: .75rem;
}

/* ─── Projects Grid (public page) ───────────────────────────── */
.projects-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
}

.project-card {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius, 12px);
  box-shadow: var(--shadow, 0 10px 30px rgba(0,0,0,.25));
  overflow: hidden;
}

.project-card .thumb {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
}

.project-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.project-card-body {
  padding: 1.25rem;
}

.project-card-body h2 {
  margin: 0 0 .25rem;
  font-size: 1.1rem;
}

.project-card-body > p {
  margin: .25rem 0;
}

.project-section {
  margin-top: .75rem;
}

.project-section img {
  max-width: 100%;
  border-radius: 8px;
  margin-top: .5rem;
}

/* ─── Team Grid ─────────────────────────────────────────────── */
.team-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.person {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius, 12px);
  box-shadow: var(--shadow, 0 10px 30px rgba(0,0,0,.25));
  padding: 1.5rem;
  text-align: center;
}

.person img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 50%;
  margin: 0 auto 12px;
  display: block;
}

.person .photo-placeholder {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--surface-2, #1a2030);
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
}

.person h3 {
  margin: 0 0 .25rem;
}

.person .role {
  color: var(--muted, #a8b3c7);
  font-size: .9rem;
  margin-bottom: .5rem;
}

.person p {
  font-size: .9rem;
  color: var(--muted, #a8b3c7);
  margin: 0;
}

/* ─── Desktop Nav ───────────────────────────────────────────── */
.desktop-nav {
  display: none;
}

@media (min-width: 769px) {
  .desktop-nav {
    display: block;
  }

  .desktop-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 4px;
    align-items: center;
  }

  .desktop-nav a {
    display: block;
    padding: 8px 14px;
    border-radius: 8px;
    white-space: nowrap;
    color: var(--muted);
    transition: background .15s, color .15s;
    font-size: .9rem;
  }

  .desktop-nav a:hover {
    background: rgba(255,255,255,.06);
    color: var(--text);
    text-decoration: none;
  }

  .desktop-nav a[aria-current="page"] {
    background: rgba(241,134,193,.12);
    color: var(--text);
  }

  .hamburger {
    display: none;
  }
}

/* ─── Header User Button ────────────────────────────────────── */
.header-user-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  transition: background .15s;
}

.header-user-btn:hover {
  background: rgba(255,255,255,.06);
  text-decoration: none;
}

.header-user-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.header-user-name {
  font-size: .85rem;
  font-weight: 600;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Bottom Tabs (Mobile) ──────────────────────────────────── */
.bottom-tabs {
  display: none;
}

@media (max-width: 768px) {
  .bottom-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    background: rgba(10,14,22,.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255,255,255,.08);
    z-index: 300;
    padding: 6px 0 env(safe-area-inset-bottom, 0);
  }

  .tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 12px;
    color: var(--muted);
    text-decoration: none;
    font-size: .7rem;
    background: none;
    border: none;
    cursor: pointer;
    transition: color .15s;
  }

  .tab-item svg {
    width: 22px;
    height: 22px;
  }

  .tab-item[aria-current="page"],
  .tab-item.active {
    color: var(--accent);
  }

  .page {
    padding-bottom: 80px;
  }

  .site-footer {
    padding-bottom: 80px;
  }

  .desktop-nav,
  .header-user-btn {
    display: none;
  }
}

/* ─── Group Sheet (Mobile More Menu) ─────────────────────────── */
.group-sheet {
  position: fixed;
  inset: 0;
  z-index: 350;
  pointer-events: none;
}

.group-sheet[aria-hidden="false"] {
  pointer-events: auto;
}

.group-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
  opacity: 0;
  transition: opacity .2s;
}

.group-sheet[aria-hidden="false"] .group-sheet-backdrop {
  opacity: 1;
}

.group-sheet-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 12px 20px 24px;
  transform: translateY(100%);
  transition: transform .25s ease;
}

.group-sheet[aria-hidden="false"] .group-sheet-content {
  transform: translateY(0);
}

.group-sheet-handle {
  width: 36px;
  height: 4px;
  background: rgba(255,255,255,.2);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.group-sheet ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.group-sheet a {
  display: block;
  padding: 12px;
  border-radius: 10px;
  color: var(--text);
  font-size: 1rem;
}

.group-sheet a:hover {
  background: rgba(255,255,255,.06);
  text-decoration: none;
}

/* ─── Container ─────────────────────────────────────────────── */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 32px);
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 600px) {
  .inline-form {
    flex-direction: column;
  }

  .inline-form input,
  .inline-form select {
    width: 100%;
  }

  .admin-table {
    font-size: .8rem;
  }

  .admin-table th,
  .admin-table td {
    padding: .4rem .5rem;
  }

  .story-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .story-item-actions {
    width: 100%;
  }
}
