/* ── VARIABLES ── */
:root {
  --bg: #efefef;
  --surface: #ffffff;
  --surface2: #f3f4f6;
  --text: #111111;
  --text2: #3d3d3d;
  --muted: #888888;
  --border: #e0e0e0;
  --colcardclr: linear-gradient(180deg, #111111 100%, #ffffff00);
  --placeholder: #d9d9d9;
  --avatar-bg: #c4c4c4;
  --accent: #5ba4f5;
  --accent2: #7c6fef;
  --grad: linear-gradient(135deg, #5ba4f5 0%, #7c6fef 100%);
  --nav-h: 52px;
  --divider: #ebebeb;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea { font-family: inherit; }
a { text-decoration: none; color: inherit; }


/* ── ICONS ── */
img.icon { display: inline-block; vertical-align: middle; pointer-events: none; }

/* ── NAV ── */
:root { --nav-h: 64px; }

#nav {
  position: sticky; top: 0; z-index: 200;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-radius: 0 0 16px 16px;
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 8px;
}

/* Logo */
.nav-logo {
  font-family: 'Inter', sans-serif; font-weight: 900; font-size: 1.5rem; letter-spacing: -.5px;
  background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  flex-shrink: 0; text-decoration: none;
}

/* Nav links */
.nav-links {
  display: flex; align-items: center; justify-content: center;
  flex: 1; gap: 2px;
}
.nav-link {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 10px;
  color: var(--text2); font-size: .85rem; font-weight: 500;
  transition: background .15s, color .15s;
  text-decoration: none; flex-shrink: 0; white-space: nowrap;
}
.nav-link svg { display: block; flex-shrink: 0; }
.nav-label { display: inline; }
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { color: var(--accent); background: rgba(91,164,245,.08); }
.nav-link.active svg path,
.nav-link.active svg circle,
.nav-link.active svg ellipse { stroke: var(--accent); }
.nav-link.active svg [fill="currentColor"] { fill: var(--accent); }

/* Right side */
.nav-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.nav-sep { width: 1px; height: 24px; background: var(--border); flex-shrink: 0; }
.nav-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #f9bcd6, #f07eb8);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; text-decoration: none;
}
.nav-avatar svg { color: #c0487e; stroke: #c0487e; }
.nav-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.logout-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px;
  color: var(--muted); transition: all .15s;
}
.logout-btn:hover { background: var(--bg); color: var(--text); }

/* ── NAV MOBILE (≤ 480px) — icon only, hide labels ── */
@media (max-width: 480px) {
  #nav { padding: 0 12px; gap: 4px; border-radius: 0 0 12px 12px; }
  .nav-logo { font-size: 1.25rem; }
  .nav-label { display: none; }
  .nav-link { padding: 8px; border-radius: 8px; }
  .nav-link svg { width: 18px; height: 18px; }
  .nav-links { gap: 0; }
  .nav-right { gap: 4px; }
  .nav-avatar { width: 30px; height: 30px; }
  .logout-btn { width: 30px; height: 30px; }
}

/* ── PAGE FADE IN ── */
.page-wrap { animation: pgIn .2s ease;  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;  
  display: flex;
  flex-direction: column; 
  gap: 24px;  }
@keyframes pgIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* ── INNER LAYOUT ── */
.inner {
  width: 100%;
  max-width: 1060px;
  padding: 38px 44px;
  min-height: calc(100vh - var(--nav-h));
  
}

@media (max-width: 600px) {
  .inner { padding: 24px 16px; }
}

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(150deg, #d6eeff 0%, #eef4ff 50%, #e2dcff 100%);
}
.login-inner {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; padding: 40px 20px;
}
.login-brand {
  font-family: 'Inter', sans-serif; font-weight: 900; font-size: 3.8rem; letter-spacing: -2px;
  background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 40px;
}
.login-wrap { position: relative; width: 100%; max-width: 860px; height: 480px; }
.login-photo {
  position: absolute; left: 0; top: 0;
  width: 58%; height: 100%;
  object-fit: cover; border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  display: block;
  filter: grayscale(100%);
  transition: filter 0.5s ease;
  animation: fadeInLeft 1.5s ease both;
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateY(-50%) translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }

}

.grayscale-img:hover {
  filter: grayscale(0%);
}

.login-card {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  width: 54%;
  background: var(--surface); border-radius: 16px;
  padding: 44px 40px;
  box-shadow: 0 8px 40px rgba(0,0,0,.14);
  display: flex; flex-direction: column; justify-content: center;
  z-index: 2; 
  animation: fadeInRight 1.5s ease both;
}
.login-card h2 {
  font-family: 'Inter', sans-serif; font-weight: 800; font-size: 1.55rem;
  color: var(--text); text-align: center; margin-bottom: 24px;
}
.form-label { font-weight: 600; font-size: .85rem; display: block; margin-bottom: 7px; color: var(--text); }
.form-input {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--surface2); color: var(--text); font-size: .875rem; outline: none; margin-bottom: 16px;
  transition: border-color .15s;
}
.form-input:focus { border-color: var(--accent); }
.btn-login {
  width: 100%; padding: 13px; border-radius: 10px; background: var(--grad); color: #fff;
  font-family: 'Inter', sans-serif; font-weight: 800; font-size: .975rem;
  box-shadow: 0 3px 16px rgba(91,164,245,.3); transition: opacity .15s, transform .1s;
  cursor: pointer;
}
.btn-login:hover { opacity: .9; transform: translateY(-1px); }
.login-sub { text-align: center; margin-top: 18px; color: var(--muted); font-size: .85rem; }
.login-sub a { color: var(--accent); font-weight: 700; }
.copyright { margin-top: 36px; color: var(--muted); font-size: .76rem; }
.login-error {
  background: #fef2f2; border: 1px solid #fecaca; color: #dc2626;
  padding: 10px 14px; border-radius: 8px; font-size: .85rem; margin-bottom: 14px; text-align: center;
}

/* ── LOGOUT SPLASH ── */
.logout-msg {
  text-align: center; color: var(--muted); margin-bottom: 28px; font-size: .9rem;
}
.btn-back-login {
  display: inline-block; width: 100%; padding: 13px; border-radius: 10px;
  background: var(--grad); color: #fff; text-align: center;
  font-family: 'Inter', sans-serif; font-weight: 800; font-size: .975rem;
  box-shadow: 0 3px 16px rgba(91,164,245,.3); transition: opacity .15s;
}
.btn-back-login:hover { opacity: .9; }

/* ── TOPBAR ── */
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; }
.topbar h1 { font-family: 'Inter', sans-serif; font-weight: 900; font-size: 1.9rem; letter-spacing: -.5px; }
.btn-new-post {
  display: flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: 9px;
  background: var(--grad); color: #fff; font-size: .85rem; font-weight: 600;
  box-shadow: 0 2px 12px rgba(91,164,245,.28); transition: opacity .15s, transform .1s;
}
.btn-new-post:hover { opacity: .9; transform: translateY(-1px); }
.topbar-search {
  margin-left: 1rem; display: flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 7px 13px;
  transition: border-color .15s;
}
.topbar-search:focus-within { border-color: var(--accent); }
.topbar-search input { border: none; background: transparent; outline: none; font-size: .85rem; color: var(--text); width: 150px; }
.topbar-search input::placeholder { color: var(--muted); }
.feed-col { display: flex; flex-direction: column; gap: 20px; max-width: 600px; }

/* ── POST CARD ── */
.post-card { background: var(--surface); border: 1px solid var(--border); border-radius: 3px; overflow: hidden; width: 100%; 
  max-width: 600px;}
.post-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 12px; border-bottom: 1px solid var(--border); }
.post-ava-wrap {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--avatar-bg); display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.post-ava-wrap svg { color: #666; }
.post-username { font-weight: 700; font-size: .9rem; color: var(--text); }
.post-time { font-size: .76rem; color: var(--muted); margin-top: 1px; }
.post-img-wrap { width: 100%; aspect-ratio: 1; background: var(--placeholder); overflow: hidden; }
.post-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-foot { padding: 10px 16px 14px; }
.post-actions { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.like-btn { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: .875rem; padding: 2px 0; transition: color .15s; }
.like-btn svg { transition: transform .15s; }
.like-btn:hover svg { transform: scale(1.18); }
.like-btn.liked { color: #e05578; }
.like-btn.liked svg { fill: #e05578; stroke: #e05578; }
.comment-btn { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: .875rem; padding: 2px 0; transition: color .15s; }
.comment-btn:hover { color: var(--text); }
.bookmark-btn { margin-left: auto; color: var(--muted); transition: color .15s; padding: 2px; }
.bookmark-btn:hover { color: var(--accent); }
.bookmark-btn.saved { color: var(--accent); }
.bookmark-btn.saved svg { fill: var(--accent); }
.post-caption { font-size: .875rem; line-height: 1.55; color: var(--text); }
.post-caption strong { font-weight: 700; }

/* ── EXPLORE ── */
.explore-head { display: flex; align-items: center; gap: 22px; margin-bottom: 32px; }
.explore-head h1 { font-family: 'Inter', sans-serif; font-weight: 900; font-size: 2.1rem; letter-spacing: -.5px; }
.explore-search {
  display: flex; align-items: center; gap: 8px; flex: 1; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 9px 14px; transition: border-color .15s;
}
.explore-search:focus-within { border-color: var(--accent); }
.explore-search input { border: none; background: transparent; outline: none; font-size: .9rem; color: var(--text); width: 100%; }
.explore-search input::placeholder { color: var(--muted); }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.grid-img { aspect-ratio: 1; width: 100%; object-fit: cover; border-radius: 4px; cursor: pointer; transition: opacity .18s, transform .2s; }
.grid-img:hover { opacity: .82; transform: scale(1.015); }

/* ── COLLECTIONS ── */
.page-head { margin-bottom: 28px; }
.page-head h1 { font-family: 'Inter', sans-serif; font-weight: 900; font-size: 2rem; letter-spacing: -.5px; }
.collections-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.col-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 4px; overflow: hidden;
  cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.06); transition: transform .18s, box-shadow .18s; text-decoration: none; display: block;
}
.col-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.col-card-img { width: 100%; height: 160px; object-fit: cover; background: var(--placeholder); display: block; }
.col-card-body { padding: 12px 14px 14px; }
.col-card-name { font-weight: 700; font-size: .92rem; color: var(--text); margin-bottom: 3px; }
.col-card-count { font-size: .82rem; color: var(--text2); }

/* ── COLLECTION DETAIL ── */
.col-detail-bar { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 26px; }
.col-detail-bar h1 { font-family: 'Inter', sans-serif; font-weight: 900; font-size: 2rem; letter-spacing: -.5px; }
.col-detail-sub { color: var(--muted); font-size: .88rem; margin-top: 3px; }
.btn-back {
  padding: 8px 20px; border-radius: 4px; background: var(--grad); color: #fff; font-weight: 600; font-size: .85rem;
  box-shadow: 0 2px 12px rgba(91,164,245,.25); transition: opacity .15s; text-decoration: none; display: inline-block;
}
.btn-back:hover { opacity: .88; }
.col-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.col-photo { aspect-ratio: 1; border-radius: 4px; overflow: hidden; cursor: pointer; background: var(--placeholder); }
.col-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.col-photo:hover img { transform: scale(1.06); }

/* ── NOTIFICATIONS ── */
.notif-list { max-width: 530px; display: flex; flex-direction: column; gap: 6px; margin-top: 28px; }
.notif-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: 4px;
  padding: 13px 16px; display: flex; align-items: center; gap: 13px; transition: border-color .15s;
}
.notif-item:hover { border-color: var(--accent); }
.notif-ava { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--avatar-bg); }
.notif-body { flex: 1; }
.notif-text { font-size: .875rem; color: var(--text2); line-height: 1.5; }
.notif-text strong { font-weight: 700; color: var(--text); }
.notif-time { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.notif-icon { color: var(--muted); flex-shrink: 0; }

/* ── SETTINGS ── */
.settings-wrap { max-width: 500px; margin-top: 28px; border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.settings-section { background: var(--surface); padding: 28px 30px; }
.settings-section + .settings-section { border-top: 15px solid var(--divider); }
.settings-sec-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.settings-sec-icon {
  width: 42px; height: 42px; border-radius: 50%; background: var(--surface2);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.settings-sec-icon svg { color: var(--text2); }
.settings-sec-title { font-weight: 800; font-size: 1.15rem; color: var(--text); }
.settings-row {
  padding: 11px 0; font-size: .9rem; color: var(--text2); cursor: pointer;
  border-bottom: 1px solid var(--border); transition: color .15s;
}
.settings-row:last-child { border-bottom: none; padding-bottom: 0; }
.settings-row:hover { color: var(--text); }

/* ── PROFILE ── */
.profile-header { display: flex; align-items: flex-start; gap: 24px; margin-bottom: 36px; }
.profile-ava {
  width: 96px; height: 96px; border-radius: 50%; flex-shrink: 0;
  background: var(--avatar-bg); display: flex; align-items: center; justify-content: center;
}
.profile-ava img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.profile-ava svg { color: #555; }
.profile-meta { flex: 1; padding-top: 4px; }
.profile-username { font-weight: 700; font-size: 1.25rem; color: var(--text); margin-bottom: 14px; }
.profile-stats { display: flex; gap: 28px; margin-bottom: 14px; }
.stat-item .stat-val { font-weight: 700; font-size: 1.15rem; color: var(--text); }
.stat-item .stat-label { font-size: .78rem; color: var(--text2); margin-top: 1px; }
.profile-bio { font-size: .875rem; color: var(--text2); line-height: 1.65; max-width: 360px; }
.profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.pgrid-cell { aspect-ratio: 1; border-radius: 3px; background: var(--placeholder); overflow: hidden; cursor: pointer; }
.pgrid-cell img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s, opacity .18s; }
.pgrid-cell:hover img { transform: scale(1.05); opacity: .88; }
.pgrid-cell.empty { cursor: default; }

/* ── LIGHTBOX ── */
#lightbox {
  position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.9);
  backdrop-filter: blur(8px); display: none; align-items: center; justify-content: center;
}
#lightbox.open { display: flex; animation: lbIn .18s ease; }
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
#lb-img { max-width: 88vw; max-height: 84vh; border-radius: 8px; object-fit: contain; box-shadow: 0 24px 80px rgba(0,0,0,.5); transition: opacity .15s; }
.lb-x {
  position: fixed; top: 18px; right: 22px; width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); color: #fff; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.lb-x:hover { background: rgba(255,255,255,.2); }
.lb-arrow {
  position: fixed; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; transition: background .15s;
}
.lb-arrow:hover { background: rgba(255,255,255,.22); }
#lb-prev { left: 18px; } #lb-next { right: 18px; }
#lb-caption { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,.55); font-size: .82rem; }

/* ── NEW POST MODAL ── */
#modal-post {
  position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center;
}
#modal-post.open { display: flex; }
.modal-box {
  background: var(--surface); border-radius: 18px; padding: 34px; width: 100%; max-width: 440px;
  box-shadow: 0 16px 60px rgba(0,0,0,.2); position: relative;
}
.modal-box h3 { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 1.25rem; margin-bottom: 20px; color: var(--text); }
.modal-close-x { position: absolute; top: 14px; right: 16px; font-size: 1.3rem; color: var(--muted); transition: color .15s; }
.modal-close-x:hover { color: var(--text); }
.modal-drop {
  width: 100%; aspect-ratio: 16/10; border-radius: 11px; border: 2px dashed var(--border);
  background: var(--surface2); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 9px; color: var(--muted); cursor: pointer; margin-bottom: 16px; transition: border-color .15s;
}
.modal-drop:hover { border-color: var(--accent); }
.modal-ta {
  width: 100%; height: 76px; padding: 10px 13px; border: 1.5px solid var(--border); border-radius: 9px;
  background: var(--surface2); color: var(--text); resize: none; outline: none; font-size: .875rem;
  margin-bottom: 16px; transition: border-color .15s;
}
.modal-ta:focus { border-color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.btn-cancel { padding: 8px 18px; border-radius: 8px; border: 1.5px solid var(--border); color: var(--text2); font-size: .85rem; transition: all .15s; }
.btn-cancel:hover { border-color: var(--muted); }
.btn-share { padding: 8px 22px; border-radius: 8px; background: var(--grad); color: #fff; font-weight: 600; font-size: .85rem; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }


/* ── MOBILE STACK (≤ 600px) ── */
@media (max-width: 600px) {
  @media (max-width: 740px) {

  #nav {
    flex-direction: column;
    align-items: center;
    height: auto;
    padding: 10px 12px;
    gap: 8px;
  }

  .nav-links {
    order: 3;
  }

  .nav-logo {
    order: 2;
  }

  .nav-right {
    order: 2;
  }

}

  .photo-grid {
    grid-template-columns: 1fr;
  }

  .collections-grid {
    grid-template-columns: 1fr;
  }

  .col-photos {
    grid-template-columns: 1fr;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

}