/* ═══════════════════════════════════════════════════════════════
   AstraMaster — Dashboard Layout (Profile / Chat / Admin)
   ═══════════════════════════════════════════════════════════════ */

/* ─── Dashboard Shell ───────────────────────────────────────────── */
.dash-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - var(--header-h));
  background: var(--border-soft);
}

/* ─── Sidebar Nav ───────────────────────────────────────────────── */
.dash-sidebar {
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}

.dash-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all .2s;
  position: relative;
}
.dash-nav__item:hover {
  background: var(--border-soft);
  color: var(--midnight);
}
.dash-nav__item.active {
  background: var(--midnight);
  color: var(--white);
}
.dash-nav__item svg { flex-shrink: 0; }

.dash-nav__badge {
  margin-left: auto;
  background: var(--yellow);
  color: var(--midnight);
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  line-height: 1.4;
}

.dash-nav__sep {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.dash-nav__item--danger { color: #dc2626; }
.dash-nav__item--danger:hover { background: #fef2f2; color: #dc2626; }

/* ─── Header extras ─────────────────────────────────────────────── */
.notif-dot {
  position: relative;
  background: var(--yellow);
  color: var(--midnight);
  font-size: .68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  line-height: 1.4;
}
.header-avatar { cursor: pointer; }

/* ─── Main Content Area ─────────────────────────────────────────── */
.dash-main {
  padding: 36px 40px 60px;
  overflow-x: hidden;
}

.dash-page-header {
  margin-bottom: 28px;
}
.dash-page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--midnight);
  letter-spacing: -.025em;
}
.dash-page-sub {
  font-size: .9rem;
  color: var(--text-muted);
  font-weight: 300;
  margin-top: 4px;
}

/* ─── Profile ───────────────────────────────────────────────────── */
.profile-top {
  overflow: visible;
  margin-bottom: 24px;
}
.profile-top__cover {
  height: 140px;
  background: var(--midnight);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  position: relative;
  overflow: hidden;
}
.profile-top__cover-ph {
  position: absolute;
  inset: 0;
  opacity: .3;
}

.profile-top__body {
  padding: 0 28px 24px;
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}

.profile-top__avatar-wrap {
  position: relative;
  margin-top: -44px;
  flex-shrink: 0;
}
.profile-avatar {
  width: 88px;
  height: 88px;
  border: 4px solid var(--white);
  box-shadow: var(--shadow);
}
.avatar-edit-btn {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--midnight);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid var(--white);
  transition: background .2s;
}
.avatar-edit-btn:hover { background: var(--powder); }

.profile-top__info {
  flex: 1;
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.profile-top__name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--midnight);
  letter-spacing: -.02em;
}
.profile-top__role {
  font-size: .875rem;
  color: var(--text-muted);
  font-weight: 300;
}
.profile-top__meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.profile-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .8rem;
  color: var(--text-secondary);
  font-weight: 400;
}
.profile-top__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 16px;
  margin-left: auto;
}

/* Profile sections */
.profile-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
  align-items: start;
}
.profile-section { padding: 24px; }
.profile-section__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--midnight);
  margin-bottom: 18px;
}
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Skills */
.skills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.skill-tag {
  padding: 5px 14px;
  background: var(--powder-soft);
  border: 1.5px solid var(--powder);
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 500;
  color: var(--midnight);
}
.skill-add {
  padding: 5px 14px;
  border: 1.5px dashed var(--border);
  border-radius: 20px;
  font-size: .82rem;
  color: var(--text-muted);
  background: none;
  cursor: pointer;
  transition: all .2s;
}
.skill-add:hover { border-color: var(--midnight); color: var(--midnight); }

/* Portfolio */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.portfolio-item {
  aspect-ratio: 4/3;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  cursor: pointer;
}
.portfolio-item__overlay {
  position: absolute;
  inset: 0;
  background: rgba(19,36,65,.7);
  display: flex;
  align-items: flex-end;
  padding: 10px;
  opacity: 0;
  transition: opacity .2s;
}
.portfolio-item:hover .portfolio-item__overlay { opacity: 1; }
.portfolio-item__overlay span {
  font-size: .78rem;
  font-weight: 700;
  color: var(--white);
}
.portfolio-item--add {
  border: 2px dashed var(--border);
  background: var(--border-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: .78rem;
  transition: all .2s;
  aspect-ratio: 4/3;
}
.portfolio-item--add:hover { border-color: var(--midnight); color: var(--midnight); }

/* Profile stats */
.profile-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.profile-stat {
  background: var(--white);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.profile-stat__n {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--midnight);
}
.profile-stat__l {
  font-size: .75rem;
  color: var(--text-muted);
  font-weight: 300;
  text-align: center;
}

/* ─── Chat ──────────────────────────────────────────────────────── */
.chat-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  flex: 1;
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}

/* Conversation list */
.chat-list {
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-list__header {
  padding: 20px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.chat-list__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--midnight);
}
.chat-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.chat-search .form-input { height: 36px; font-size: .85rem; }

.conv-list {
  flex: 1;
  overflow-y: auto;
}
.conv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background .15s;
  border-bottom: 1px solid var(--border-soft);
}
.conv-item:hover { background: var(--border-soft); }
.conv-item--active { background: var(--powder-soft); }

.conv-item__body { flex: 1; min-width: 0; }
.conv-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.conv-item__name {
  font-size: .875rem;
  font-weight: 600;
  color: var(--midnight);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-item__time { font-size: .72rem; color: var(--text-muted); font-weight: 300; flex-shrink: 0; }
.conv-item__bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.conv-item__last {
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 300;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-unread {
  background: var(--midnight);
  color: var(--white);
  font-size: .7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* Chat window */
.chat-window {
  display: flex;
  flex-direction: column;
  background: var(--border-soft);
  overflow: hidden;
}

.chat-win__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-win__name  { font-size: .95rem; font-weight: 700; color: var(--midnight); }
.chat-win__status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 300;
}
.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}

/* Messages */
.chat-win__messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-order-card {
  background: var(--white);
  border: 1.5px solid var(--powder);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 8px;
  align-self: center;
  width: 100%;
  max-width: 480px;
}
.chat-order-card__header {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.chat-order-card__title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--midnight);
  margin-bottom: 4px;
}
.chat-order-card__meta { font-size: .8rem; color: var(--text-muted); font-weight: 300; }

.chat-date-sep {
  text-align: center;
  font-size: .75rem;
  color: var(--text-muted);
  font-weight: 300;
  position: relative;
  margin: 8px 0;
}
.chat-date-sep::before, .chat-date-sep::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 36%;
  height: 1px;
  background: var(--border);
}
.chat-date-sep::before { left: 0; }
.chat-date-sep::after  { right: 0; }

/* Message bubbles */
.msg { display: flex; align-items: flex-end; gap: 8px; }
.msg--out { flex-direction: row-reverse; }
.msg__avatar { flex-shrink: 0; }

.msg__bubble {
  max-width: 62%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: .875rem;
  line-height: 1.6;
  position: relative;
}
.msg__bubble p { color: inherit; }
.msg__bubble--in {
  background: var(--white);
  color: var(--text-primary);
  border-bottom-left-radius: var(--radius-xs);
  box-shadow: var(--shadow-xs);
}
.msg__bubble--out {
  background: var(--midnight);
  color: var(--white);
  border-bottom-right-radius: var(--radius-xs);
}

.msg__time {
  display: block;
  font-size: .68rem;
  margin-top: 6px;
  opacity: .55;
}

.msg__file {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--border-soft);
  border-radius: var(--radius-sm);
  font-size: .78rem;
  color: var(--midnight);
  font-weight: 500;
}
.msg__file-size { margin-left: auto; font-weight: 300; color: var(--text-muted); font-size: .72rem; }

/* Chat input */
.chat-win__input {
  padding: 16px 20px;
  background: var(--white);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--border-soft);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 6px 6px 6px 14px;
}
.chat-attach-btn {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: color .2s;
  flex-shrink: 0;
}
.chat-attach-btn:hover { color: var(--midnight); }
.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: .9rem;
  color: var(--text-primary);
  outline: none;
  resize: none;
  line-height: 1.5;
  max-height: 120px;
}
.chat-input::placeholder { color: var(--text-muted); font-weight: 300; }

/* ─── Admin ─────────────────────────────────────────────────────── */
.admin-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.admin-stat-card {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-stat-card__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-stat-card__icon svg { width: 20px; height: 20px; }
.admin-stat-card__value {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--midnight);
  letter-spacing: -.02em;
  line-height: 1;
}
.admin-stat-card__label { font-size: .8rem; color: var(--text-muted); font-weight: 300; }
.admin-stat-card__trend {
  font-size: .78rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}
.trend-up   { color: #16a34a; }
.trend-down { color: #dc2626; }

/* Chart placeholder */
.chart-ph {
  background: var(--border-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  padding: 20px 24px 12px;
  height: 180px;
  position: relative;
  overflow: hidden;
}
.chart-bar {
  flex: 1;
  border-radius: 4px 4px 0 0;
  background: var(--powder-soft);
  border: 1px solid var(--powder);
  transition: background .2s;
  position: relative;
}
.chart-bar:hover { background: var(--powder-light); }
.chart-bar--active { background: var(--midnight); border-color: var(--midnight); }
.chart-bar--active:hover { background: var(--midnight); }
.chart-label {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: .7rem;
  color: var(--text-muted);
  font-weight: 300;
  white-space: nowrap;
}

/* Data grid / table */
.data-grid-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.data-grid {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  font-size: .875rem;
}
.data-grid thead { background: var(--midnight); }
.data-grid th {
  padding: 14px 18px;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  color: rgba(255,255,255,.7);
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}
.data-grid th:first-child { border-radius: var(--radius-lg) 0 0 0; }
.data-grid th:last-child  { border-radius: 0 var(--radius-lg) 0 0; }
.data-grid td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-primary);
  vertical-align: middle;
}
.data-grid tr:last-child td { border-bottom: none; }
.data-grid tbody tr { transition: background .15s; }
.data-grid tbody tr:hover { background: var(--border-soft); }

/* Grid cell helpers */
.grid-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.grid-user__name { font-weight: 600; font-size: .875rem; }
.grid-user__meta { font-size: .75rem; color: var(--text-muted); font-weight: 300; }

/* Status badges */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.status-active  { background: rgba(34,197,94,.1);  color: #15803d; }
.status-active::before  { background: #22c55e; }
.status-pending { background: rgba(234,179,8,.12); color: #854d0e; }
.status-pending::before { background: #eab308; }
.status-blocked { background: rgba(239,68,68,.1);  color: #b91c1c; }
.status-blocked::before { background: #ef4444; }
.status-done    { background: var(--powder-soft);  color: var(--midnight); }
.status-done::before    { background: var(--powder); }

/* Grid action buttons */
.grid-actions { display: flex; gap: 6px; }
.grid-btn {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--white);
  cursor: pointer;
  transition: all .15s;
}
.grid-btn:hover { border-color: var(--midnight); color: var(--midnight); }
.grid-btn--danger:hover { border-color: #dc2626; color: #dc2626; }

/* Toolbar above table */
.grid-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.grid-toolbar__left { display: flex; align-items: center; gap: 10px; }
.grid-toolbar__right { display: flex; align-items: center; gap: 10px; }
.grid-search-wrap { position: relative; }
.grid-search-wrap .form-input {
  height: 38px;
  width: 240px;
  padding-left: 40px;
  font-size: .875rem;
}
.grid-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

/* Онлайн-точка в списке диалогов */
.conv-online-dot {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #fff;
}

/* Responsive */
@media (max-width: 1024px) {
  .admin-stats-row  { grid-template-columns: repeat(2, 1fr); }
  .profile-grid     { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .dash-layout      { grid-template-columns: 1fr; }
  /* dash-sidebar hidden state handled by responsive.css via transform */
  .chat-layout      { grid-template-columns: 1fr; }
  .chat-list        { display: none; }
}
@media (max-width: 768px) {
  .dash-main        { padding: 20px 16px 40px; }
  .admin-stats-row  { grid-template-columns: 1fr 1fr; }
  .profile-stats    { grid-template-columns: repeat(2, 1fr); }
}
