/* ============================================================
   EYAF — Edo You Are Fantastic
   ============================================================ */

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

:root {
  --purple:       #7c3aed;
  --purple-light: #a78bfa;
  --purple-dark:  #5b21b6;
  --gold:         #f59e0b;
  --gold-light:   #fde68a;
  --red:          #ef4444;
  --bg:           #faf5ff;
  --surface:      #ffffff;
  --surface2:     #f3f0ff;
  --border:       #e5e1f0;
  --text:         #1e1b2e;
  --text2:        #6b7280;
  --private-bg:   #fdf4ff;
  --private-border: #d8b4fe;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 2px 12px rgba(124,58,237,0.10);
  --max-w:        680px;
  --header-h:     56px;
  --tab-h:        48px;
  --composer-h:   auto;
}

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

/* ---- Utility ---- */
.hidden { display: none !important; }
.screen { min-height: 100vh; display: flex; flex-direction: column; }

/* ---- Logo ---- */
.eyaf-logo {
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.logo-letter { color: var(--purple); }
.logo-dot    { color: var(--gold); }
.logo-letter.sm { font-size: 1.3rem; }
.logo-dot.sm    { font-size: 1.3rem; }
.logo-tagline {
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text2);
  margin-bottom: 20px;
}

/* ---- Name entry ---- */
#screen-name {
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  min-height: 100dvh;
}

.name-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 40px 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow);
  text-align: center;
}

.name-intro {
  color: var(--text2);
  font-size: 0.95rem;
  margin-bottom: 28px;
  line-height: 1.6;
}

.name-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.name-form label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text2);
}

.name-form input, textarea, #edit-text {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.2s;
  outline: none;
  font-family: inherit;
}
.name-form input:focus, textarea:focus, #edit-text:focus {
  border-color: var(--purple);
}

/* ---- Buttons ---- */
.btn-primary {
  background: var(--purple);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 22px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  font-family: inherit;
}
.btn-primary:hover { background: var(--purple-dark); }
.btn-primary:active { transform: scale(0.97); }

.btn-ghost {
  background: transparent;
  color: var(--purple);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s;
}
.btn-ghost:hover { border-color: var(--purple); }

.btn-danger {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 22px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn-sm { padding: 5px 10px; font-size: 0.8rem; }

.btn-icon {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  line-height: 1;
}
.btn-icon:hover { background: var(--surface2); }

/* ---- Header ---- */
.app-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-logo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  font-weight: 900;
}

.header-logo-letters { display: flex; align-items: center; gap: 1px; }

.header-tagline {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text2);
  letter-spacing: 0.04em;
  white-space: nowrap;
  line-height: 1;
}
.header-user { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--text2); }

.admin-badge {
  background: var(--gold-light);
  color: #92400e;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---- Tabs ---- */
.tab-bar {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--header-h);
  z-index: 9;
}

.tab {
  flex: 1;
  height: var(--tab-h);
  border: none;
  background: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  font-family: inherit;
}
.tab.active {
  color: var(--purple);
  border-bottom-color: var(--purple);
  font-weight: 700;
}

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

/* ---- Messages feed ---- */
.messages-feed {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
  padding-bottom: 220px;
}

.feed-loading {
  text-align: center;
  color: var(--text2);
  padding: 40px;
  font-size: 0.95rem;
}

/* Message bubble */
.message-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  position: relative;
}

.message-bubble.private {
  background: var(--private-bg);
  border-color: var(--private-border);
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.meta-name {
  font-weight: 700;
  color: var(--purple);
  font-size: 0.95rem;
}

.meta-country {
  font-size: 0.8rem;
  color: var(--text2);
  background: var(--surface2);
  padding: 1px 8px;
  border-radius: 99px;
}

.meta-time {
  font-size: 0.78rem;
  color: var(--text2);
  margin-left: auto;
}

.meta-private {
  font-size: 0.75rem;
  color: #7e22ce;
  background: #f3e8ff;
  padding: 1px 8px;
  border-radius: 99px;
  font-weight: 600;
}

.message-text {
  font-size: 1rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-edited {
  font-size: 0.75rem;
  color: var(--text2);
  font-style: italic;
  margin-top: 4px;
}

/* Message attachment */
.message-attachment {
  margin-top: 10px;
}

.attachment-img {
  max-width: 100%;
  max-height: 320px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  object-fit: cover;
  display: block;
}

.attachment-video {
  max-width: 100%;
  border-radius: var(--radius-sm);
  display: block;
}

/* Message actions */
.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: flex-end;
}

.btn-msg-action {
  font-size: 0.78rem;
  border: none;
  background: none;
  color: var(--text2);
  cursor: pointer;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  transition: background 0.15s;
}
.btn-msg-action:hover { background: var(--surface2); color: var(--text); }
.btn-msg-action.delete { color: var(--red); }
.btn-msg-action.delete:hover { background: #fee2e2; }

/* ---- Composer ---- */
.composer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 16px 14px;
  z-index: 10;
}

.composer > * + * { margin-top: 8px; }

.composer-privacy { display: flex; align-items: center; }

.privacy-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text2);
}

.privacy-toggle input { display: none; }

.privacy-label {
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--surface2);
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
  user-select: none;
}

.privacy-toggle input:checked ~ .privacy-label {
  background: #ecfdf5;
  color: #065f46;
}

.privacy-toggle input:not(:checked) ~ .privacy-label {
  background: #f3e8ff;
  color: #6b21a8;
}

.composer-row textarea {
  resize: none;
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.95rem;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.composer-send { margin-left: auto; }

.attachment-preview {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.attachment-preview img,
.attachment-preview video {
  max-height: 80px;
  border-radius: 6px;
}

/* ---- Moments grid ---- */
.moments-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
}

.moment-thumb {
  aspect-ratio: 1;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background: var(--surface2);
}

.moment-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}

.moment-thumb:hover img { transform: scale(1.04); }

.moment-thumb .private-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 10px;
  height: 10px;
  background: var(--purple);
  border-radius: 50%;
  border: 1.5px solid white;
}

.moment-video-badge {
  position: absolute;
  bottom: 5px;
  left: 5px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 6px;
}

/* ---- Lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content img,
.lightbox-content video {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.3); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

/* ---- Modals ---- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}

.modal-card h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--purple);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  justify-content: flex-end;
}

/* ---- Video recorder ---- */
.recorder-preview {
  width: 100%;
  border-radius: var(--radius-sm);
  background: #000;
  margin-bottom: 12px;
}

.recorder-timer {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--red);
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.recorder-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.recorder-result-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

/* ---- Admin ---- */
.admin-feed {
  padding-bottom: 40px !important;
}

.visitors-list {
  padding: 16px;
  max-width: var(--max-w);
  margin: 0 auto;
}

.visitor-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.visitor-name { font-weight: 600; }
.visitor-country { color: var(--text2); }
.visitor-time { color: var(--text2); font-size: 0.8rem; margin-left: auto; }

/* ---- Error ---- */
.error-msg {
  color: var(--red);
  font-size: 0.85rem;
  background: #fee2e2;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

/* ---- Responsive ---- */
@media (min-width: 600px) {
  .composer {
    max-width: var(--max-w);
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius) var(--radius) 0 0;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}
