﻿.instagram-dashboard{
  display:grid;
  grid-template-columns: 360px 1fr;
  height:calc(100vh - 120px);
  gap:24px;
}

.instagram-sidebar{
  background:rgba(255,255,255,0.72);
  border-radius:28px;
  padding:18px;
  backdrop-filter:blur(20px);
  border:1px solid rgba(255,255,255,0.5);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.instagram-post-list{
  overflow-y:auto;
  display:flex;
  flex-direction:column;
  gap:14px;
  padding-right:6px;
}

.instagram-sidebar-header{
  font-size:1.1rem;
  font-weight:700;
  color:var(--headline-text);
  margin-bottom:18px;
}

.instagram-sidebar-post{
  display:flex;
  gap:14px;
  padding:12px;
  border-radius:18px;
  cursor:pointer;
  transition:0.25s ease;
  background:rgba(255,255,255,0.5);
  border:1px solid rgba(255,255,255,0.5);
}

.instagram-sidebar-post:hover{
  transform:translateY(-2px);
  background:rgba(225,29,72,0.06);
}

.instagram-sidebar-post.active{
  border:1px solid rgba(225,29,72,0.3);
  background:rgba(225,29,72,0.08);
}

.sidebar-post-image{
  width:82px;
  height:82px;
  border-radius:16px;
  object-fit:cover;
  flex-shrink:0;
}

.sidebar-post-content{
  flex:1;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}

.sidebar-post-caption{
  font-size:0.92rem;
  color:var(--headline-text);
  line-height:1.5;
  display:-webkit-box;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

.sidebar-post-meta{
  display:flex;
  gap:14px;
  margin-top:10px;
  font-size:0.85rem;
  color:var(--muted-text);
}

.instagram-viewer{
  background:rgba(255,255,255,0.72);
  border-radius:28px;
  padding:24px;
  backdrop-filter:blur(20px);
  border:1px solid rgba(255,255,255,0.5);
  overflow:hidden;
}

.instagram-view-content{
  height:100%;
  display:grid;
  grid-template-columns: 1fr 420px;
  gap:24px;
}

.viewer-image{
  width:100%;
  height:100%;
  object-fit:cover;
  border-radius:24px;
  background:#eee;
}

.viewer-info{
  display:flex;
  flex-direction:column;
  height:100%;
}

.viewer-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  margin-bottom:18px;
}

.viewer-stats{
  display:flex;
  gap:12px;
  color:var(--muted-text);
}

.viewer-caption{
  line-height:1.7;
  color:var(--body-text);
  margin-bottom:20px;
}

.viewer-comments-section{
  overflow-y:auto;
  display:flex;
  flex-direction:column;
  gap:12px;
  padding-right:4px;
}

.viewer-comment{
  background:rgba(255,255,255,0.6);
  border-radius:16px;
  padding:14px;
  border:1px solid rgba(255,255,255,0.5);
}

.viewer-comment-user{
  font-weight:700;
  margin-bottom:6px;
  color:var(--headline-text);
}

.viewer-comment-text{
  line-height:1.6;
  margin-bottom:8px;
}

.viewer-comment-meta{
  font-size:0.8rem;
  color:var(--muted-text);
}

.instagram-dashboard{
  display:grid;
  grid-template-columns:340px 1fr;
  gap:14px;
  height:calc(100vh - 230px);
  min-height:430px;
}

/* SIDEBAR */

.instagram-sidebar{
  background:#ffffff;
  border-radius:22px;
  overflow:hidden;
  border:1px solid rgba(0,0,0,0.06);
  display:flex;
  flex-direction:column;
  height:100%;
}

.instagram-sidebar-header{
  padding:14px 16px;
  font-size:1rem;
  font-weight:700;
  border-bottom:1px solid rgba(0,0,0,0.06);
  background:#f8fafc;
}

.instagram-post-list{
  overflow-y:auto;
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.instagram-sidebar-post{
  display:flex;
  align-items:center;
  gap:12px;
  padding:11px 12px;
  border-radius:14px;
  cursor:pointer;
  transition:0.2s ease;
  border:1px solid var(--zg-border-soft);
  background:var(--zg-surface-card);
}

.instagram-sidebar-post:hover{
  background:rgba(225,29,72,0.06);
}

.instagram-sidebar-post.active{
  background:rgba(225,29,72,0.08);
  border-color:rgba(225,29,72,0.3);
}

.sidebar-post-image{
  width:62px;
  height:62px;
  border-radius:12px;
  object-fit:cover;
  flex-shrink:0;
}

.sidebar-post-content{
  flex:1;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}

.sidebar-post-caption{
  font-size:12px;
  line-height:1.35;
  color:#0f172a;
  display:-webkit-box;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

.sidebar-post-meta{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:7px;
  font-size:11px;
  color:#64748b;
}

/* VIEWER */

.instagram-viewer{
  background:#ffffff;
  border-radius:18px;
  border:1px solid rgba(0,0,0,0.06);
  overflow:hidden;
  padding:14px;
  height:100%;
}

.instagram-view-content{
  display:grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap:14px;
  height:100%;
  min-height:0;
}

.viewer-image{
  width:100%;
  height:100%;
  object-fit:cover;
  border-radius:20px;
  background:#f1f5f9;
}

.viewer-info{
  display:flex;
  flex-direction:column;
  min-height:0;
}

.viewer-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  margin-bottom:18px;
}

.viewer-username{
  font-size:14px;
  font-weight:700;
  color:#0f172a;
}

.viewer-date{
  margin-top:0;
  color:#64748b;
  font-size:12px;
  line-height:1.35;
  white-space:nowrap;
}

.viewer-stats{
  display:flex;
  gap:14px;
  font-size:14px;
  color:#475569;
}

.viewer-caption{
  font-size:14px;
  line-height:1.7;
  color:#334155;
  margin-bottom:16px;
  padding-bottom:16px;
  border-bottom:1px solid rgba(0,0,0,0.06);
}

.viewer-comments-section{
  flex:1;
  overflow-y:auto;
  display:flex;
  flex-direction:column;
  gap:12px;
  padding-right:4px;
}

.viewer-comment{
  background:#f8fafc;
  border-radius:14px;
  padding:10px 12px;
}

.viewer-comment-user{
  font-weight:700;
  color:#0f172a;
  margin-bottom:0;
  font-size:13px;
}

.viewer-comment-text{
  font-size:13px;
  line-height:1.45;
  color:#334155;
  margin-bottom:0;
}

.viewer-comment-meta{
  font-size:12px;
  color:#64748b;
}

.sidebar-post-caption{
  overflow:hidden;
  text-overflow:ellipsis;
  word-break:break-word;
  overflow-wrap:anywhere;
  white-space:normal;
  max-width:100%;
  display:-webkit-box;
  -webkit-box-orient:vertical;
}

.viewer-comments-panel{
  background:#ffffff;
  border-radius:16px;
  border:1px solid rgba(0,0,0,0.06);
  display:flex;
  flex-direction:column;
  min-height:0;
  overflow:hidden;
}

.viewer-comments-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px 14px;
  border-bottom:1px solid rgba(0,0,0,0.06);
  background:#f8fafc;
}

.viewer-comments-title{
  font-size:1rem;
  font-weight:700;
  color:#0f172a;
}

.post-comment-btn{
  border:1px solid rgba(225,29,72,0.22);
  background:rgba(225,29,72,0.08);
  color:var(--primary);
  min-height:38px;
  padding:0 14px;
  border-radius:12px;
  cursor:pointer;
  font-weight:700;
  font-size:14px;
  transition:background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.post-comment-btn:hover{
  background:rgba(225,29,72,0.14);
  border-color:rgba(225,29,72,0.32);
  transform:translateY(-1px);
}

.post-comment-btn:disabled{
  cursor:not-allowed;
  opacity:0.65;
  transform:none;
}

.post-comment-form{
  display:flex;
  align-items:flex-end;
  gap:10px;
  padding:10px 12px;
  border-top:1px solid rgba(0,0,0,0.06);
  background:#ffffff;
  flex-shrink:0;
}

.post-comment-input{
  width:100%;
  flex:1;
  min-width:0;
  min-height:42px;
  height:42px;
  border:1px solid #dbe4ee;
  border-radius:14px;
  padding:11px 12px;
  resize:none;
  overflow:hidden;
  color:#334155;
  background:#ffffff;
  font:inherit;
  font-size:14px;
  line-height:18px;
  display:block;
}

.post-comment-input:focus{
  outline:none;
  border-color:rgba(225,29,72,0.38);
  box-shadow:0 0 0 3px rgba(225,29,72,0.1);
}

.post-comment-actions{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  flex-shrink:0;
}

.post-comment-actions .post-comment-btn,
.post-comment-actions .post-comment-suggest{
  white-space:nowrap;
}

.post-comment-suggest{
  min-height:38px;
  padding:0 14px;
  border:1px solid #cbd5e1;
  border-radius:12px;
  background:#f8fafc;
  color:#475569;
  cursor:pointer;
  font-size:14px;
  font-weight:800;
  transition:background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.post-comment-suggest:hover{
  background:#e2e8f0;
  border-color:#94a3b8;
  transform:translateY(-1px);
}

.post-comment-suggest:disabled{
  cursor:not-allowed;
  opacity:0.65;
  transform:none;
}

.viewer-comments-section{
  flex:1;
  overflow-y:auto;
  padding:10px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.viewer-post-panel{
  background:#ffffff;
  border-radius:16px;
  border:1px solid rgba(0,0,0,0.06);
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:10px;
  font-size:14px;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  overscroll-behavior:contain;
}

.viewer-image{
  width:100%;
  max-height:300px;
  border-radius:14px;
  object-fit:cover;
  flex-shrink:0;
}

.viewer-comment{
  background:#f8fafc;
  border-radius:14px;
  padding:10px 12px;
  border:1px solid rgba(0,0,0,0.05);
  display:flex;
  align-items:flex-start;
  gap:8px;
}

.viewer-comment-body{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.comment-avatar-wrap{
  width:34px;
  height:34px;
  flex:0 0 34px;
  border-radius:50%;
  overflow:hidden;
  background:rgba(225,29,72,0.12);
}

.comment-avatar-wrap.small{
  width:26px;
  height:26px;
  flex-basis:26px;
}

.comment-avatar,
.comment-avatar-initials{
  width:100%;
  height:100%;
}

.comment-avatar{
  display:block;
  object-fit:cover;
}

.comment-avatar-initials{
  display:none;
  place-items:center;
  color:var(--primary);
  font-size:11px;
  font-weight:800;
  background:rgba(225,29,72,0.12);
}

.viewer-comment-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.viewer-comment-top-right{
  display:flex;
  align-items:center;
  gap:6px;
}

.viewer-comment-actions{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:8px;
}

.viewer-comment-reply-actions{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  margin-top:6px;
}

.comment-like-control{
  display:flex;
  align-items:center;
  gap:6px;
}

.comment-like-btn{
  border:1px solid rgba(225,29,72,0.16);
  background:#ffffff;
  color:var(--primary);
  padding:5px 9px;
  border-radius:10px;
  cursor:pointer;
  font-size:12px;
  font-weight:700;
}

.comment-like-btn:hover,
.comment-like-btn.liked{
  background:rgba(225,29,72,0.08);
  color:var(--primary);
  border-color:rgba(225,29,72,0.28);
}

.comment-like-count{
  color:#64748b;
  font-size:12px;
  font-weight:700;
  min-width:1ch;
}

.viewer-comment-replies{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-left:10px;
}

.viewer-comment-reply{
  background:#ffffff;
  border:1px solid rgba(225,29,72,0.12);
  border-left:3px solid rgba(225,29,72,0.35);
  border-radius:10px;
  padding:7px 8px;
  display:flex;
  align-items:flex-start;
  gap:8px;
}

.viewer-comment-reply-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:4px;
}

.comment-menu{
  position:relative;
  display:flex;
  align-items:center;
}

.comment-menu-btn{
  width:26px;
  height:24px;
  border:none;
  border-radius:8px;
  background:transparent;
  color:#64748b;
  cursor:pointer;
  font-size:16px;
  font-weight:700;
  line-height:1;
}

.comment-menu-btn:hover,
.comment-menu.open .comment-menu-btn{
  background:rgba(225,29,72,0.08);
  color:var(--primary);
}

.comment-menu-list{
  display:none;
  position:absolute;
  top:28px;
  right:0;
  z-index:10;
  width:max-content;
  min-width:0;
  padding:0;
  border:1px solid rgba(0,0,0,0.08);
  border-radius:6px;
  background:#ffffff;
  box-shadow:0 12px 30px rgba(15,23,42,0.12);
  overflow:hidden;
}

.comment-menu.open .comment-menu-list{
  display:block;
}

.comment-menu-delete{
  border:none;
  border-radius:0;
  background:transparent;
  color:var(--primary);
  cursor:pointer;
  padding:5px 8px;
  text-align:left;
  font-size:12px;
  font-weight:700;
  white-space:nowrap;
}

.comment-menu-delete:hover{
  background:rgba(225,29,72,0.08);
}

.comment-menu-delete:disabled{
  cursor:not-allowed;
  opacity:0.65;
}

.viewer-comment-reply-user{
  color:#0f172a;
  font-size:12px;
  font-weight:700;
}

.viewer-comment-reply-meta{
  color:#64748b;
  font-size:11px;
  white-space:nowrap;
}

.viewer-comment-reply-text{
  color:#334155;
  font-size:12px;
  line-height:1.45;
}

.reply-comment-btn{
  border:1px solid rgba(225,29,72,0.16);
  background:#ffffff;
  color:var(--primary);
  padding:5px 9px;
  border-radius:10px;
  cursor:pointer;
  font-size:12px;
  font-weight:700;
}

.reply-comment-btn:hover{
  background:rgba(225,29,72,0.08);
  color:var(--primary);
  border-color:rgba(225,29,72,0.28);
}

.reply-box{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:8px;
}

.instagram-comment-reply-input{
  width:100%;
  min-height:90px;
  border:1px solid #dbe4ee;
  border-radius:14px;
  padding:12px;
  resize:none;
  overflow:hidden;
  background:#ffffff;
  color:#334155;
  font:inherit;
  font-size:13px;
  line-height:1.45;
}

.instagram-comment-reply-input:focus{
  outline:none;
  border-color:rgba(225,29,72,0.38);
  box-shadow:0 0 0 3px rgba(225,29,72,0.1);
}

.instagram-reply-controls{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:8px;
}

.instagram-reply-action{
  min-height:34px;
  padding:0 13px;
  border-radius:10px;
  cursor:pointer;
  font-size:13px;
  font-weight:700;
  transition:background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.instagram-reply-action:hover{
  transform:translateY(-1px);
}

.instagram-reply-action:disabled{
  cursor:not-allowed;
  opacity:0.65;
  transform:none;
}

.instagram-reply-suggest{
  border:1px solid #cbd5e1;
  background:#f8fafc;
  color:#475569;
}

.instagram-reply-suggest:hover{
  background:#e2e8f0;
  border-color:#94a3b8;
}

.instagram-reply-send{
  border:1px solid rgba(225,29,72,0.22);
  background:rgba(225,29,72,0.08);
  color:var(--primary);
}

.instagram-reply-send:hover{
  background:rgba(225,29,72,0.14);
  border-color:rgba(225,29,72,0.32);
}

.instagram-reply-cancel{
  border:1px solid #cbd5e1;
  background:#f8fafc;
  color:#475569;
}

.instagram-reply-cancel:hover{
  background:#e2e8f0;
  border-color:#94a3b8;
}

/* Responsive post workspace */
.post-comment-form{
  display:grid;
  grid-template-columns:minmax(0, 1fr);
  align-items:stretch;
  gap:10px;
  padding:12px 14px;
}

.post-comment-input{
  min-height:72px;
  height:auto;
  max-height:130px;
  overflow-y:auto;
  padding:12px 14px;
}

.post-comment-actions{
  width:100%;
  flex-wrap:wrap;
}

.post-comment-actions .post-comment-suggest{
  margin-right:auto;
}

.post-comment-actions .post-comment-btn,
.post-comment-actions .post-comment-suggest{
  min-height:42px;
}

.viewer-post-panel{
  padding:14px;
  gap:14px;
}

.viewer-image{
  display:block;
  width:100%;
  height:auto;
  max-height:none;
  aspect-ratio:4 / 5;
  object-fit:contain;
  object-position:center;
  border:1px solid var(--zg-border-soft);
  border-radius:14px;
  background:var(--zg-neutral-100);
}

.viewer-image.is-video{
  aspect-ratio:9 / 16;
  max-height:min(72vh, 720px);
  margin-inline:auto;
  background:var(--zg-neutral-900);
}

.sidebar-post-image{
  object-fit:contain;
  object-position:center;
  background:var(--zg-neutral-100);
}

.sidebar-post-image.is-video{
  background:var(--zg-neutral-900);
}

.viewer-info{
  gap:14px;
}

.viewer-top{
  display:grid;
  grid-template-columns:minmax(0, 1fr);
  gap:8px;
  align-items:start;
  margin:0;
}

.viewer-top > div:first-child{
  display:flex;
  flex-wrap:wrap;
  align-items:baseline;
  gap:4px 8px;
}

.viewer-stats{
  display:flex;
  flex-wrap:wrap;
  gap:8px 16px;
}

.viewer-stats span{
  min-width:0;
  overflow-wrap:anywhere;
}

.viewer-caption{
  margin:0;
  padding:14px 0 0;
  overflow-wrap:anywhere;
}

@media (max-width:1400px){
  .instagram-dashboard{
    grid-template-columns:minmax(240px, 290px) minmax(0, 1fr);
  }

  .instagram-view-content{
    grid-template-columns:minmax(0, 1fr) minmax(290px, 36%);
  }
}

@media (max-width:1180px){
  .instagram-dashboard{
    grid-template-columns:minmax(0, 1fr);
    grid-template-rows:auto minmax(520px, 1fr);
    height:auto;
    min-height:calc(100vh - 230px);
  }

  .instagram-sidebar{
    height:auto;
  }

  .instagram-post-list{
    display:grid;
    grid-auto-flow:column;
    grid-auto-columns:minmax(230px, 280px);
    overflow-x:auto;
    overflow-y:hidden;
    padding:10px;
  }

  .instagram-viewer{
    min-height:620px;
  }
}

@media (max-width:900px){
  .instagram-viewer{
    min-height:0;
    overflow:visible;
  }

  .instagram-view-content{
    grid-template-columns:minmax(0, 1fr);
    height:auto;
  }

  .viewer-comments-panel{
    min-height:520px;
  }

  .viewer-post-panel{
    order:-1;
    overflow:visible;
  }

  .viewer-image{
    width:min(100%, 480px);
    margin-inline:auto;
  }
}

@media (max-width:560px){
  .post-comment-actions{
    display:grid;
    grid-template-columns:1fr;
  }

  .post-comment-actions .post-comment-suggest{
    margin-right:0;
  }

  .viewer-top{
    grid-template-columns:1fr;
  }

  .viewer-stats{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
}
