/* InstagramGirls.me — Instagram-style */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #fafafa;
  --surface: #fff;
  --border: #dbdbdb;
  --text: #262626;
  --text2: #8e8e8e;
  --accent: #e1306c;
  --accent2: #833ab4;
  --blue: #0095f6;
  --radius: 4px;
  --nav-h: 60px;
}

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

a { color: inherit; text-decoration: none; }
img { display: block; width: 100%; }

/* NAV */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--surface); border-bottom: 1px solid var(--border);
  height: var(--nav-h);
}
.nav__inner {
  max-width: 975px; margin: 0 auto; height: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; gap: 16px;
}
.nav__logo {
  font-size: 22px; font-weight: 700; letter-spacing: -0.5px;
  background: linear-gradient(45deg, var(--accent2), var(--accent), #f77737);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; white-space: nowrap;
}
.nav__search {
  flex: 1; max-width: 268px;
  position: relative;
}
.nav__search input {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 14px 8px 36px;
  font-size: 14px; color: var(--text); outline: none;
  transition: border-color .2s;
}
.nav__search input:focus { border-color: #a8a8a8; background: #fff; }
.nav__search svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text2); pointer-events: none;
}
.search-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,.1); overflow: hidden; display: none; z-index: 200;
}
.search-dropdown.open { display: block; }
.search-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; cursor: pointer; transition: background .15s;
}
.search-item:hover { background: var(--bg); }
.search-item img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.search-item__name { font-weight: 600; font-size: 14px; }
.search-item__user { font-size: 12px; color: var(--text2); }

/* WRAPPER */
.wrap { max-width: 975px; margin: 0 auto; padding: 20px 16px 40px; }

/* HOME — profile grid */
.profiles-header { margin-bottom: 24px; }
.profiles-header h1 { font-size: 20px; font-weight: 700; }
.profiles-header p  { font-size: 14px; color: var(--text2); margin-top: 4px; }

.profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.profile-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  overflow: hidden;
}
.profile-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }

.profile-card__top {
  position: relative; padding-bottom: 40px;
}
.profile-card__cover {
  height: 90px; overflow: hidden;
  background: linear-gradient(135deg, #833ab4, #e1306c, #f77737);
}
.profile-card:nth-child(6n+1) .profile-card__cover { background: linear-gradient(135deg, #833ab4, #e1306c, #f77737); }
.profile-card:nth-child(6n+2) .profile-card__cover { background: linear-gradient(135deg, #405de6, #5851db, #833ab4); }
.profile-card:nth-child(6n+3) .profile-card__cover { background: linear-gradient(135deg, #f77737, #fd1d1d, #e1306c); }
.profile-card:nth-child(6n+4) .profile-card__cover { background: linear-gradient(135deg, #c13584, #833ab4, #5851db); }
.profile-card:nth-child(6n+5) .profile-card__cover { background: linear-gradient(135deg, #fd1d1d, #f77737, #fcaf45); }
.profile-card:nth-child(6n+6) .profile-card__cover { background: linear-gradient(135deg, #5851db, #405de6, #2a80b9); }

.profile-card__avatar {
  width: 76px; height: 76px; border-radius: 50%;
  border: 4px solid var(--surface); overflow: hidden;
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  background: #eee;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
.profile-card__avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-card__avatar--placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
}

.profile-card__body { padding: 8px 14px 16px; text-align: center; }
.profile-card__name {
  font-size: 14px; font-weight: 700; display: flex; align-items: center;
  justify-content: center; gap: 4px;
}
.profile-card__username { font-size: 12px; color: var(--text2); margin-top: 2px; }

.profile-card__posts { margin-top: 10px; }
.profile-card__posts-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px;
  border-radius: 6px; overflow: hidden;
}
.profile-card__posts-grid img {
  aspect-ratio: 1; object-fit: cover; width: 100%;
}
.profile-card__posts-grid .empty-tile {
  aspect-ratio: 1; background: var(--bg);
}

.badge-verified { color: var(--blue); flex-shrink: 0; }

/* PAGINATION */
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 32px; }
.pagination a, .pagination span {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px; font-size: 14px;
  border: 1px solid var(--border); transition: all .2s;
}
.pagination a:hover { background: var(--bg); }
.pagination .active { background: var(--text); color: #fff; border-color: var(--text); font-weight: 700; }

/* PROFILE PAGE */
.profile-header {
  display: flex; gap: 40px; align-items: flex-start;
  padding: 30px 0 20px; border-bottom: 1px solid var(--border); margin-bottom: 24px;
}
.profile-header__avatar-wrap {
  flex-shrink: 0;
  width: 150px; height: 150px;
  border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  padding: 3px;
}
.profile-header__avatar {
  width: 100%; height: 100%; border-radius: 50%; overflow: hidden;
  background: var(--surface); display: flex; align-items: center; justify-content: center;
}
.profile-header__avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-header__avatar--placeholder {
  font-size: 52px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  border-radius: 50%; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.profile-header__info { flex: 1; }
.profile-header__top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profile-header__username { font-size: 20px; font-weight: 300; }
.profile-header__name {
  margin-top: 16px; font-size: 16px; font-weight: 700;
  display: flex; align-items: center; gap: 6px;
}
.profile-header__bio { margin-top: 8px; font-size: 14px; line-height: 1.5; white-space: pre-line; }
.profile-header__stats {
  display: flex; gap: 32px; margin-top: 16px;
}
.profile-header__stat { text-align: center; }
.profile-header__stat strong { display: block; font-size: 16px; font-weight: 700; }
.profile-header__stat span  { font-size: 13px; color: var(--text2); }

.btn-cta {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--blue); color: #fff; border: none; border-radius: 8px;
  padding: 8px 20px; font-size: 14px; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: opacity .2s;
}
.btn-cta:hover { opacity: .85; }

/* POSTS GRID */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}
.post-tile {
  position: relative; aspect-ratio: 1; overflow: hidden;
  cursor: pointer; background: var(--bg);
}
.post-tile img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .3s;
}
.post-tile:hover img { transform: scale(1.05); }
.post-tile__play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s, background .2s;
  pointer-events: none;
}
.post-tile__play svg { color: #fff; filter: drop-shadow(0 1px 3px rgba(0,0,0,.3)); }
.post-tile:hover .post-tile__play { transform: translate(-50%, -50%) scale(1.15); background: rgba(0,0,0,.7); }

/* SINGLE POST PAGE */
.post-page {
  max-width: 700px; margin: 30px auto; padding: 0 16px;
}
.post-page__card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
}
.post-page__header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.post-page__avatar {
  width: 42px; height: 42px; border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  flex-shrink: 0;
}
.post-page__avatar img { width: 100%; height: 100%; object-fit: cover; }
.post-page__avatar--ph {
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 16px;
}
.post-page__name { font-size: 14px; font-weight: 700; }
.post-page__username { font-size: 12px; color: var(--text2); }

.post-page__image-link {
  display: block; position: relative; cursor: pointer;
}
.post-page__image-link img { width: 100%; max-height: 700px; object-fit: cover; display: block; }
.post-page__play-btn {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(0,0,0,.5); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  transition: transform .25s, background .25s;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
}
.post-page__play-btn svg { margin-left: 4px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.3)); }
.post-page__image-link:hover .post-page__play-btn {
  transform: translate(-50%, -50%) scale(1.15);
  background: rgba(0,0,0,.7);
}
@media (max-width: 480px) {
  .post-page__play-btn { width: 64px; height: 64px; }
  .post-page__play-btn svg { width: 32px; height: 32px; }
}
.post-page__name { font-size: 14px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 4px; }

/* BREADCRUMB */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text2); margin-bottom: 16px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--blue); transition: color .2s; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { color: var(--text2); }

/* BACK LINK */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--text2); margin-bottom: 16px;
  transition: color .2s;
}
.back-link:hover { color: var(--text); }

/* SEO FOOTER */
.seo-footer {
  margin-top: 48px; padding: 32px 0; border-top: 1px solid var(--border);
  color: var(--text2); font-size: 14px; line-height: 1.7;
}
.seo-footer h2 { font-size: 18px; color: var(--text); margin-bottom: 12px; font-weight: 700; }
.seo-footer h3 { font-size: 15px; color: var(--text); margin: 16px 0 8px; font-weight: 600; }
.seo-footer p { margin-bottom: 10px; }
.seo-footer a { color: var(--blue); }
.seo-footer a:hover { text-decoration: underline; }

/* SEO PROFILE TEXT */
.seo-profile-text {
  margin-top: 32px; padding: 24px 0; border-top: 1px solid var(--border);
  color: var(--text2); font-size: 14px; line-height: 1.7;
}
.seo-profile-text h2 { font-size: 16px; color: var(--text); margin-bottom: 10px; font-weight: 700; }
.seo-profile-text a { color: var(--blue); }

/* POST NAVIGATION */
.post-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0; border-top: 1px solid var(--border);
  font-size: 14px; overflow: hidden;
}
.post-nav__link {
  display: flex; align-items: center; gap: 6px;
  padding: 14px 18px;
  color: var(--blue); font-weight: 600; transition: all .2s;
  white-space: nowrap;
}
.post-nav__link:hover {
  background: var(--bg); color: var(--accent);
}
.post-nav__link--disabled {
  display: flex; align-items: center; gap: 6px;
  padding: 14px 18px;
  color: var(--border); pointer-events: none; font-weight: 600;
  white-space: nowrap;
}
.post-nav__count {
  color: var(--text); font-weight: 700; font-size: 14px;
  padding: 8px 14px;
  background: var(--bg); border-radius: 20px;
}

/* MORE POSTS */
.more-posts { margin-top: 24px; }
.more-posts__title { font-size: 14px; font-weight: 600; color: var(--text2); margin-bottom: 12px; }

/* 404 */
.not-found { text-align: center; padding: 80px 20px; }
.not-found h1 { font-size: 80px; font-weight: 800; color: var(--border); }
.not-found p   { font-size: 18px; color: var(--text2); margin-top: 8px; }
.not-found a   { display: inline-block; margin-top: 24px; color: var(--blue); font-weight: 600; }

/* ADMIN */
.admin-nav {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 20px; display: flex; align-items: center; gap: 24px; height: 52px;
}
.admin-nav__brand { font-weight: 800; font-size: 16px; }
.admin-nav a { font-size: 13px; color: var(--text2); padding: 4px 0; border-bottom: 2px solid transparent; }
.admin-nav a:hover, .admin-nav a.active { color: var(--text); border-color: var(--text); }
.admin-nav__logout { margin-left: auto; color: #e33 !important; }

.admin-wrap { max-width: 1100px; margin: 0 auto; padding: 24px 20px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 24px; margin-bottom: 20px;
}
.card h2 { font-size: 18px; margin-bottom: 16px; }

.stats-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.stat-box {
  flex: 1; min-width: 130px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 20px;
  text-align: center;
}
.stat-box__val { font-size: 28px; font-weight: 800; }
.stat-box__lbl { font-size: 12px; color: var(--text2); margin-top: 4px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text2); font-size: 12px; text-transform: uppercase; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; outline: none; background: var(--bg);
  transition: border-color .2s;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--blue); background: #fff; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px;
  border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
  border: none; transition: opacity .2s; }
.btn:hover { opacity: .85; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-danger  { background: #ed4956; color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-success { background: #2ecc71; color: #fff; }

.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-success { background: #d4edda; color: #155724; }
.alert-error   { background: #f8d7da; color: #721c24; }

.admin-login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg);
}
.admin-login-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 40px; width: 360px;
}
.admin-login-box h1 { font-size: 24px; font-weight: 800; text-align: center; margin-bottom: 4px; }
.admin-login-box p  { text-align: center; color: var(--text2); font-size: 13px; margin-bottom: 24px; }

/* MOBILE */
@media (max-width: 768px) {
  .nav__search { display: none; }
  .profiles-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .profile-header { flex-direction: column; align-items: center; text-align: center; gap: 16px; }
  .profile-header__avatar-wrap { width: 100px; height: 100px; }
  .profile-header__stats { gap: 20px; }
  .profile-header__top { justify-content: center; }
  .posts-grid { gap: 2px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-row { flex-direction: column; }
  .admin-nav { overflow-x: auto; gap: 16px; }
}
@media (max-width: 480px) {
  .profiles-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .posts-grid { grid-template-columns: repeat(3, 1fr); }
  .wrap { padding: 12px 10px 40px; }
}
