/* memories.mleach.dev — Styles */

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

:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --surface-hover: #1a2744;
  --primary: #e94560;
  --primary-hover: #d63851;
  --text: #eee;
  --text-muted: #999;
  --border: #2a2a4a;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

body.overlay-open {
  overflow: hidden;
}

/* Override shared header for dark theme */
.mleach-header {
  background: var(--surface) !important;
  border-bottom-color: var(--border) !important;
}
.mleach-header a { color: var(--primary) !important; }
.mleach-header .mleach-nav a.current { color: var(--text) !important; }
.mleach-header .mleach-user span { color: var(--text) !important; }
.mleach-header .mleach-hamburger { color: var(--text) !important; }
.mleach-mobile-menu { background: var(--surface) !important; border-bottom-color: var(--border) !important; }
.mleach-mobile-menu a { color: var(--primary) !important; }
.mleach-mobile-menu a.current { color: var(--text) !important; }
.mleach-mobile-menu .divider { border-top-color: var(--border) !important; }

/* Layout */
.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
}

.page-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 2rem;
}

.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.6em 1.2em;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

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

.btn-small {
  padding: 0.3em 0.7em;
  font-size: 0.85rem;
}

.btn-danger {
  background: #c0392b;
  color: white;
}
.btn-danger:hover { background: #a93226; }

.btn-icon {
  padding: 0.4em 0.6em;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-icon:hover { background: var(--surface-hover); }

/* Page header */
.page-header {
  padding: 1.5rem 0 1rem;
}
.page-header h1 {
  font-size: 1.8rem;
}
.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Album list (index) */
.album-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}

.album-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s;
  border: 1px solid var(--border);
}
.album-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.album-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}
.album-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}
.album-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

section h2 {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

/* Album page header */
.album-header {
  padding: 1rem 0;
}
.album-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.header-actions {
  display: flex;
  gap: 0.4rem;
}
.album-header h1 {
  font-size: 1.5rem;
}
.album-description {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.back-link:hover { color: var(--text); }

/* Action bar */
.action-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.filters {
  display: flex;
  gap: 0.25rem;
}

.type-filters {
  border-left: 1px solid var(--border);
  padding-left: 0.75rem;
}

.filter-btn {
  padding: 0.3em 0.7em;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--primary); color: var(--text); }
.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.sort-select {
  margin-left: auto;
  padding: 0.3em 0.6em;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
}

/* Post grid */
.post-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 480px) {
  .post-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 768px) {
  .post-grid { grid-template-columns: repeat(4, 1fr); }
}

.post-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.1s;
  border: 1px solid var(--border);
}
.post-card:hover {
  transform: scale(1.02);
}

.post-media {
  aspect-ratio: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
}
.post-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.post-media-audio {
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
}
.audio-icon {
  font-size: 2rem;
}
.post-media-text {
  padding: 1rem;
  font-size: 0.9rem;
  overflow: hidden;
}
.post-media-text p {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-text-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
}

.like-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.2em;
  padding: 0.2em 0.3em;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
}
.like-btn:hover { color: var(--primary); }
.like-btn.liked { color: var(--primary); }
.like-btn .heart { font-size: 1.1em; }

.comment-count {
  color: var(--text-muted);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem 0;
}
.page-info {
  color: var(--text-muted);
  font-size: 0.9rem;
}

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

/* Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.overlay-modal {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 600px;
  width: 100%;
  position: relative;
  padding: 2.5rem 1.5rem 1.5rem;
  margin: auto 0;
}

@media (max-width: 480px) {
  .overlay {
    padding: 1rem 0.5rem;
  }
  .overlay-modal {
    max-width: 100%;
    width: 100%;
    border-radius: var(--radius);
    padding: 1rem;
    box-sizing: border-box;
  }
}

.overlay-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.3em 0.5em;
  z-index: 10;
  line-height: 1;
}
.overlay-close:hover { color: var(--text); background: var(--surface-hover); }

.overlay-media {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  cursor: pointer;
}

.overlay-media-link {
  display: block;
  margin-bottom: 1rem;
}
.overlay-media-link .overlay-media {
  margin-bottom: 0;
}

.overlay-audio {
  width: 100%;
  margin-bottom: 1rem;
}

.overlay-text {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  white-space: pre-wrap;
}

.overlay-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.overlay-author {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Comments */
.overlay-comments {
  margin-bottom: 1rem;
}

.no-comments {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

.comment {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.comment:last-child { border-bottom: none; }

.comment-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}
.comment-header strong {
  color: var(--text);
}
.comment-time {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.comment-delete {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.2em;
}
.comment-delete:hover { color: var(--primary); }

.comment-text {
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

.comment-form {
  display: flex;
  gap: 0.5rem;
  min-width: 0;
}
.comment-input {
  flex: 1;
  min-width: 0;
  padding: 0.5em 0.7em;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}
.comment-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* New post form */
.new-post-modal h2 {
  margin-bottom: 1rem;
  color: var(--text);
}

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

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
}
.upload-area:hover { border-color: var(--primary); }

.upload-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
}
.upload-icon {
  font-size: 2rem;
}

.upload-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
}
.file-name {
  color: var(--text);
}

textarea, input[type="text"], input[type="email"] {
  width: 100%;
  padding: 0.6em 0.8em;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}
textarea:focus, input:focus {
  outline: none;
  border-color: var(--primary);
}

.char-count {
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* Admin page */
.admin-page .admin-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.form-row label {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.form-row input, .form-row textarea, .form-row select {
  width: 100%;
}
.form-row select {
  padding: 0.5em;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
}

.section-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.inline-form input {
  flex: 1;
}

.member-row, .link-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.link-row code {
  font-size: 0.8rem;
  background: var(--bg);
  padding: 0.2em 0.5em;
  border-radius: var(--radius-sm);
  word-break: break-all;
}
.link-expires {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-left: auto;
}
.link-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.copy-link {
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.empty-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.5rem 0;
}

/* Toasts */
#toasts {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  padding: 0.6em 1.2em;
  border-radius: var(--radius);
  font-size: 0.9rem;
  animation: slideUp 0.2s ease;
  pointer-events: auto;
}
.toast-success { background: #27ae60; color: white; }
.toast-error { background: #c0392b; color: white; }
.toast-info { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.toast-exit { opacity: 0; transition: opacity 0.3s; }

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

/* Loading */
.loading-small {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

.error {
  color: var(--primary);
}
