/* MarkdUp App Styles — matches landing page design language */

:root {
  --black: #0a0a0a;
  --white: #f5f0eb;
  --gold: #c9a227;
  --gold-dim: #8a6e1a;
  --red: #c0392b;
  --grey: #2a2a2a;
  --grey-light: #888;
  --grey-dark: #1a1a1a;
  --font-main: 'Space Grotesk', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --success: #27ae60;
  --error: #c0392b;
}

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

body {
  font-family: var(--font-main);
  background: var(--black);
  color: var(--white);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* === NAV === */
.app-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--grey);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--white);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-logo .mark { color: var(--gold); }

.nav-links {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.nav-links a, .nav-links button {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-light);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: 2px;
  background: none;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-links a:hover, .nav-links button:hover {
  color: var(--white);
  border-color: var(--grey);
}

.nav-links a.active {
  color: var(--gold);
  border-color: var(--gold-dim);
}

.nav-links .btn-gold {
  color: var(--black);
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 500;
}

.nav-links .btn-gold:hover {
  background: var(--gold-dim);
  border-color: var(--gold-dim);
  color: var(--white);
}

/* === LAYOUT === */
.app-content {
  position: relative;
  z-index: 1;
  padding: 96px 2rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* === PAGE HEADER === */
.page-header {
  margin-bottom: 3rem;
}

.page-header h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.page-header h1 .gold { color: var(--gold); }

.page-header p {
  color: var(--grey-light);
  font-size: 1rem;
}

/* === FORMS === */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--grey-dark);
  border: 1px solid var(--grey);
  border-radius: 3px;
  color: var(--white);
  font-family: var(--font-main);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-group select option {
  background: var(--grey-dark);
  color: var(--white);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--grey-light);
  margin-top: 0.3rem;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 2rem;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid var(--grey);
  border-radius: 3px;
  background: transparent;
  color: var(--white);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn:hover {
  border-color: var(--gold-dim);
  color: var(--gold);
}

.btn-primary {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--black);
}

.btn-primary:hover {
  background: #d4ad2e;
  border-color: #d4ad2e;
  color: var(--black);
}

.btn-danger {
  border-color: var(--red);
  color: var(--red);
}

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

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

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

/* === CARDS === */
.card {
  background: var(--grey-dark);
  border: 1px solid var(--grey);
  border-radius: 3px;
  padding: 2rem;
}

/* === AUTH FORMS === */
.auth-container {
  max-width: 420px;
  margin: 4rem auto;
}

.auth-container h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.auth-container .subtitle {
  color: var(--grey-light);
  margin-bottom: 2rem;
}

.auth-container .auth-switch {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--grey-light);
  font-size: 0.9rem;
}

.auth-container .auth-switch a {
  color: var(--gold);
  text-decoration: none;
}

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

/* === ALERTS === */
.alert {
  padding: 0.85rem 1rem;
  border-radius: 3px;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  border: 1px solid;
}

.alert-error {
  background: rgba(192, 57, 43, 0.1);
  border-color: var(--red);
  color: #e74c3c;
}

.alert-success {
  background: rgba(39, 174, 96, 0.1);
  border-color: var(--success);
  color: #2ecc71;
}

/* === VAULT GRID === */
.vault-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.filter-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.filter-btn {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--grey);
  border-radius: 2px;
  background: transparent;
  color: var(--grey-light);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover { border-color: var(--gold-dim); color: var(--white); }
.filter-btn.active { border-color: var(--gold); color: var(--gold); background: rgba(201, 162, 39, 0.08); }

.works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1px;
  background: var(--grey);
  border: 1px solid var(--grey);
}

.work-card {
  background: var(--black);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.work-card:hover {
  background: var(--grey-dark);
}

.work-card-image {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  background: var(--grey);
}

.work-card-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--grey);
  font-family: var(--font-mono);
  font-size: 2rem;
  color: var(--gold-dim);
}

.work-card-info {
  padding: 1.2rem;
}

.work-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  letter-spacing: -0.01em;
}

.work-card-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--grey-light);
  letter-spacing: 0.05em;
  display: flex;
  gap: 1rem;
}

.work-card-meta .medium-tag {
  color: var(--gold-dim);
  text-transform: uppercase;
}

/* === WORK DETAIL === */
.work-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.work-detail-image {
  width: 100%;
  border: 1px solid var(--grey);
  border-radius: 3px;
  object-fit: cover;
}

.work-detail-placeholder {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--grey);
  border: 1px solid var(--grey);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 4rem;
  color: var(--gold-dim);
}

.work-fields {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.work-field {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--grey);
  padding: 0.75rem 0;
}

.work-field-label { color: var(--gold-dim); text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.1em; }
.work-field-value { color: var(--white); text-align: right; max-width: 60%; }

/* === PROFILE === */
.profile-header {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--grey);
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold-dim);
  flex-shrink: 0;
}

.profile-avatar-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--grey);
  border: 2px solid var(--gold-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--gold-dim);
  flex-shrink: 0;
}

.profile-info h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.profile-info .alias {
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.profile-info .crew {
  color: var(--grey-light);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.profile-info .location {
  color: var(--grey-light);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.profile-info .bio {
  color: var(--white);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-top: 1rem;
  max-width: 500px;
}

.profile-stats {
  display: flex;
  gap: 2rem;
  margin-top: 1rem;
}

.profile-stat {
  text-align: center;
}

.profile-stat-num {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
}

.profile-stat-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--grey-light);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.profile-share {
  margin-top: 1rem;
}

.profile-share-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--gold-dim);
  background: var(--grey-dark);
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--grey);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
}

.profile-share-link:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* === PHOTO UPLOAD === */
.photo-upload {
  border: 2px dashed var(--grey);
  border-radius: 3px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.photo-upload:hover {
  border-color: var(--gold-dim);
}

.photo-upload.has-preview {
  padding: 0;
  border-style: solid;
}

.photo-upload input[type="file"] {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  opacity: 0;
  cursor: pointer;
}

.photo-upload-text {
  color: var(--grey-light);
  font-size: 0.9rem;
}

.photo-upload-text .icon {
  display: block;
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--gold-dim);
}

.photo-preview {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  display: block;
}

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  border: 1px solid var(--grey);
  background: var(--grey-dark);
  border-radius: 3px;
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--grey-light);
  margin-bottom: 1.5rem;
}

/* === TOAST === */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.85rem 1.5rem;
  border-radius: 3px;
  font-size: 0.9rem;
  z-index: 200;
  animation: slideIn 0.3s ease;
  border: 1px solid;
}

.toast-success { background: rgba(39, 174, 96, 0.15); border-color: var(--success); color: #2ecc71; }
.toast-error { background: rgba(192, 57, 43, 0.15); border-color: var(--red); color: #e74c3c; }

@keyframes slideIn {
  from { transform: translateY(1rem); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* === LOADING === */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  color: var(--grey-light);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--grey);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 0.75rem;
}

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

/* === BACK LINK === */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--grey-light);
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  transition: color 0.2s;
}

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

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .app-nav { padding: 0 1rem; height: 56px; }
  .app-content { padding: 80px 1rem 3rem; }
  .form-row { grid-template-columns: 1fr; }
  .work-detail { grid-template-columns: 1fr; }
  .profile-header { flex-direction: column; align-items: center; text-align: center; }
  .profile-info .bio { max-width: 100%; }
  .works-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .vault-controls { flex-direction: column; align-items: flex-start; }
  .nav-links { gap: 0.25rem; }
  .nav-links a, .nav-links button { padding: 0.4rem 0.6rem; font-size: 0.65rem; }
}

@media (max-width: 480px) {
  .works-grid { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 1.8rem; }
}
