/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep:    #0b0b14;
  --bg-main:    #10101e;
  --bg-card:    #16162a;
  --bg-card2:   #1c1c33;
  --sidebar:    #0d0d1f;
  --border:     #252540;
  --text:       #e2e8f0;
  --text-muted: #8892a4;
  --accent:     #6366f1;
  --accent-h:   #4f46e5;
  --green:      #10b981;
  --orange:     #f59e0b;
  --red:        #ef4444;
  --blue:       #3b82f6;
  --purple:     #8b5cf6;
  --ig-grad:    linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 4px 24px rgba(0,0,0,.4);
}

html, body { height: 100%; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-main);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-h); }

svg { fill: currentColor; vertical-align: middle; }

/* ─── Layout ────────────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.logo-b {
  width: 32px; height: 32px;
  background: var(--ig-grad);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff;
  flex-shrink: 0;
}

.logo-text {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .5px;
  background: var(--ig-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  transition: all .15s;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-item:hover {
  color: var(--text);
  background: var(--bg-card2);
}

.nav-item.active {
  color: var(--text);
  background: var(--bg-card2);
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}

.sidebar-footer {
  padding: 12px 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-info { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }

.user-avatar {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}

.user-details { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.logout-btn {
  color: var(--text-muted);
  display: flex; align-items: center;
  padding: 6px;
  border-radius: 6px;
  flex-shrink: 0;
}
.logout-btn:hover { color: var(--red); background: rgba(239,68,68,.1); }
.logout-btn svg { width: 18px; height: 18px; }

/* ─── Main Content ──────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

/* ─── Page Header ───────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
}

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); color: #fff; }

.btn-secondary { background: var(--bg-card2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); background: var(--bg-card2); }
.btn-ghost.btn-danger:hover { color: var(--red); border-color: var(--red); background: rgba(239,68,68,.08); }

.btn-instagram { background: var(--ig-grad); color: #fff; font-weight: 600; }
.btn-instagram:hover { opacity: .9; color: #fff; }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-full { width: 100%; }

/* ─── Alerts ────────────────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 500;
}

.alert-success { background: rgba(16,185,129,.12); color: #34d399; border: 1px solid rgba(16,185,129,.25); }
.alert-error   { background: rgba(239,68,68,.12);  color: #f87171;  border: 1px solid rgba(239,68,68,.25); }
.alert-info    { background: rgba(59,130,246,.12); color: #60a5fa;  border: 1px solid rgba(59,130,246,.25); }

/* ─── Badges ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green  { background: rgba(16,185,129,.15); color: #34d399; }
.badge-blue   { background: rgba(59,130,246,.15);  color: #60a5fa; }
.badge-orange { background: rgba(245,158,11,.15);  color: #fbbf24; }
.badge-red    { background: rgba(239,68,68,.15);   color: #f87171; }
.badge-gray   { background: rgba(156,163,175,.15); color: #9ca3af; }

/* ─── Auth ──────────────────────────────────────────────────────────────────── */
.auth-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-deep);
  padding: 24px;
}

.auth-container { width: 100%; max-width: 380px; }

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}

.auth-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 24px;
  justify-content: center;
}

.auth-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.auth-subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.auth-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 16px;
}

/* ─── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
textarea,
select {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border .15s;
  width: 100%;
}

input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 100px; }

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

/* ─── File Upload ───────────────────────────────────────────────────────────── */
.file-upload {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  padding: 24px;
  transition: border .15s;
  cursor: pointer;
}

.file-upload:hover { border-color: var(--accent); }
.file-upload input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
  padding: 0; border: none; background: none;
}

.file-upload-content { pointer-events: none; }
.file-upload-content p { margin: 8px 0 4px; font-size: 13px; color: var(--text-muted); }
.file-hint { font-size: 11px; color: var(--text-muted); }

/* ─── Connect Card ──────────────────────────────────────────────────────────── */
.connect-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 32px;
  text-align: center;
  max-width: 480px;
  margin: 40px auto;
}

.connect-icon { margin-bottom: 20px; }
.connect-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.connect-card p { color: var(--text-muted); margin-bottom: 24px; }

/* ─── Profile Card ──────────────────────────────────────────────────────────── */
.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.profile-left { display: flex; align-items: center; gap: 16px; }

.profile-pic {
  width: 64px; height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid transparent;
  background: var(--ig-grad);
  background-clip: border-box;
}

.profile-pic-placeholder {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--ig-grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: #fff;
}

.profile-name { font-size: 18px; font-weight: 700; }
.profile-username { color: var(--text-muted); font-size: 13px; }
.profile-bio { color: var(--text-muted); font-size: 12px; margin: 4px 0; max-width: 280px; }

.profile-stats { display: flex; gap: 32px; }

.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat-value { font-size: 20px; font-weight: 700; }
.stat-label { font-size: 11px; color: var(--text-muted); }

/* ─── Metrics Grid ──────────────────────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.metric-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.metric-icon svg { width: 20px; height: 20px; }
.metric-blue   { background: rgba(59,130,246,.15);  color: #60a5fa; }
.metric-purple { background: rgba(139,92,246,.15);  color: #a78bfa; }
.metric-orange { background: rgba(245,158,11,.15);  color: #fbbf24; }
.metric-green  { background: rgba(16,185,129,.15);  color: #34d399; }

.metric-content { display: flex; flex-direction: column; }
.metric-value { font-size: 22px; font-weight: 700; line-height: 1; }
.metric-label { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ─── Quick Actions ─────────────────────────────────────────────────────────── */
.action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.action-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  width: 100%;
  font-family: inherit;
}

.action-card svg { width: 24px; height: 24px; color: var(--accent); }
.action-card:hover { background: var(--bg-card2); border-color: var(--accent); color: var(--text); }
.action-card-danger svg { color: var(--red); }
.action-card-danger:hover { border-color: var(--red); }

/* ─── Posts Grid ────────────────────────────────────────────────────────────── */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.post-image { height: 180px; overflow: hidden; background: var(--bg-deep); }
.post-image img { width: 100%; height: 100%; object-fit: cover; }
.post-image-placeholder { display: flex; align-items: center; justify-content: center; }

.post-body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.post-caption { font-size: 13px; color: var(--text-muted); flex: 1; }
.post-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.post-date { font-size: 11px; color: var(--text-muted); }
.post-error { font-size: 11px; color: var(--red); }
.post-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── Comments / Messages ───────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}

.filter-btn:hover { color: var(--text); background: var(--bg-card2); }
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.comments-list, .messages-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment-card, .message-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border .15s;
}

.comment-replied, .message-replied {
  opacity: .65;
}

.comment-header, .message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.comment-user, .message-user {
  display: flex; align-items: center; gap: 10px;
}

.comment-avatar, .message-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}

.comment-username, .message-username { font-weight: 600; font-size: 13px; display: block; }
.comment-date, .message-date { font-size: 11px; color: var(--text-muted); }

.comment-text { font-size: 13px; margin-bottom: 10px; }

.comment-reply-preview {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  background: var(--bg-deep);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.comment-actions, .message-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.comment-reply-form, .message-reply-form {
  margin-top: 10px;
}

.reply-input-row {
  display: flex;
  gap: 8px;
}

.reply-input-row input {
  flex: 1;
}

/* Messages bubbles */
.message-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  max-width: 75%;
  margin-bottom: 8px;
  line-height: 1.5;
}

.message-bubble.received {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  align-self: flex-start;
}

.message-bubble.sent {
  background: rgba(99,102,241,.2);
  border: 1px solid rgba(99,102,241,.3);
  margin-left: auto;
  text-align: right;
}

/* ─── Empty State ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  grid-column: 1/-1;
}

.empty-state p { margin: 12px 0; }
.empty-hint { font-size: 12px; }
.empty-state .btn { margin-top: 16px; }

/* ─── Modal ─────────────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}

.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
}

.modal-box {
  position: relative; z-index: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%; max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 { font-size: 16px; font-weight: 700; }

.modal-close {
  background: none; border: none;
  color: var(--text-muted); font-size: 22px;
  cursor: pointer; line-height: 1; padding: 0 4px;
}

.modal-close:hover { color: var(--text); }

.modal-form { padding: 24px; display: flex; flex-direction: column; gap: 16px; }

.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ─── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .action-grid  { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 16px; }
  .profile-card { flex-direction: column; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}
