/* ---------- Account layout ---------- */
.account-page { padding-bottom: 48px; }

.account-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .account-layout { grid-template-columns: 1fr; }
}

/* Sidebar */
.account-sidebar {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.account-user {
  display: flex;
  align-items: center;
  gap: 16px;
}
.account-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 22px -8px rgba(37, 99, 235, .45);
}
.account-user-info h2 {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 4px;
  line-height: 1.2;
}
.account-email {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 8px;
}
.account-email i { margin-right: 5px; }
.account-role {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.account-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.account-nav-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.account-nav-group + .account-nav-group {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.account-nav-label {
  padding: 0 14px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
}
.account-nav button,
.account-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  border: none;
  background: transparent;
  padding: 12px 14px;
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: background .2s, color .2s;
}
.account-nav button i,
.account-nav a i {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(15, 23, 42, .05);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex: 0 0 auto;
  transition: background .2s;
}
.account-nav button:hover,
.account-nav a:hover { color: var(--text); }
.account-nav button.active,
.account-nav button.active:hover,
.account-nav a.active,
.account-nav a.active:hover {
  background: var(--accent-soft);
  color: var(--primary);
}
.account-nav button.active i,
.account-nav a.active i { background: rgba(37, 99, 235, .12); }

.account-logout {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--err);
  font-weight: 600;
  text-decoration: none;
  transition: background .2s;
}
.account-logout:hover { background: rgba(239, 68, 68, .08); }

/* Main area */
.account-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}
.account-panel { display: block; }
.account-panel[hidden] { display: none; }

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

/* Stats */
.account-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
@media (max-width: 700px) {
  .account-stats { grid-template-columns: repeat(2, 1fr); }
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s, box-shadow .18s;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.stat-card i {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.stat-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}
.stat-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

/* Quick actions */
.account-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
@media (max-width: 900px) {
  .account-quick-actions { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .account-quick-actions { grid-template-columns: 1fr; }
}
.quick-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.quick-action:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}
.quick-action i {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* Items list */
.account-items {
  list-style: none;
  margin: 0;
  padding: 0;
}
.account-items li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.account-items li:last-child { border-bottom: none; }
.account-items .item-icon,
.account-items .item-thumb {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex: 0 0 auto;
  overflow: hidden;
}
.account-items .item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.account-items .item-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.account-items .item-title {
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-items .item-title:hover { color: var(--accent); }
.account-items .item-meta {
  font-size: 13px;
  color: var(--muted);
}

/* Profile form */
.account-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
@media (max-width: 560px) {
  .account-form-row { grid-template-columns: 1fr; }
}

/* ---------- Floating labels ---------- */
.field.floating {
  position: relative;
  margin-bottom: 16px;
}
.field.floating input,
.field.floating textarea,
.field.floating select {
  width: 100%;
  padding: 18px 14px 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: #fff;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field.floating textarea { resize: vertical; min-height: 120px; padding-top: 22px; }
.field.floating select { appearance: none; -webkit-appearance: none; padding-right: 40px; }
.field.floating input:focus,
.field.floating textarea:focus,
.field.floating select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.field.floating input:focus + label,
.field.floating input:not(:placeholder-shown) + label,
.field.floating textarea:focus + label,
.field.floating textarea:not(:placeholder-shown) + label,
.field.floating select:focus + label {
  top: 8px;
  transform: translateY(0);
  font-size: 11.5px;
  color: var(--primary);
  font-weight: 700;
}
.field.floating label {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: var(--muted);
  pointer-events: none;
  transition: all .2s ease;
}
.field.floating textarea + label { top: 18px; transform: translateY(0); }

/* ---------- Custom file input ---------- */
.file-field { margin-bottom: 18px; }
.file-field input[type='file'] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.file-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 20px;
  border: 2px dashed var(--border);
  border-radius: 18px;
  background: rgba(15, 23, 42, .02);
  cursor: pointer;
  text-align: center;
  transition: border-color .2s, background .2s;
}
.file-label:hover { border-color: var(--primary); background: rgba(37, 99, 235, .04); }
.file-label i { font-size: 34px; color: var(--primary); }
.file-label strong { font-size: 15px; color: var(--text); }
.file-label span { font-size: 13px; color: var(--muted); }
.file-field input[type='file']:focus + .file-label {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.file-preview {
  max-height: 220px;
  border-radius: 14px;
  margin-top: 12px;
  display: none;
  object-fit: cover;
}
.file-preview.is-visible { display: block; }
.gallery-file-names { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.gallery-file-names[hidden] { display: none; }
.gallery-file-names span {
  font-size: 12px;
  background: var(--accent-soft);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 999px;
}

/* ---------- Custom checkbox ---------- */
.checkbox-modern {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 18px;
}
.checkbox-modern input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.checkbox-modern .checkmark {
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color .2s, background .2s;
  flex: 0 0 auto;
}
.checkbox-modern .checkmark::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 12px;
  color: #fff;
  opacity: 0;
  transform: scale(.8);
  transition: opacity .2s, transform .2s;
}
.checkbox-modern input:checked + .checkmark {
  border-color: var(--primary);
  background: var(--primary);
}
.checkbox-modern input:checked + .checkmark::after {
  opacity: 1;
  transform: scale(1);
}
.checkbox-modern input:focus + .checkmark {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

/* ---------- Button loader ---------- */
.btn-glow { position: relative; overflow: hidden; }
.btn-glow .btn-text,
.btn-glow .btn-loader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity .2s, transform .2s;
}
.btn-glow[aria-busy='true'] .btn-text { opacity: 0; transform: translateY(-8px); }
.btn-glow[aria-busy='true'] .btn-loader {
  position: absolute;
  inset: 0;
  opacity: 1;
  transform: translateY(0);
}
.btn-glow .btn-loader { opacity: 0; transform: translateY(8px); }

/* ---------- Мобильная версия кабинета ---------- */
@media (max-width: 900px) {
  .account-page { padding-bottom: 32px; }

  /* Сайдбар: компактная карточка, без «прилипания» */
  .account-sidebar {
    position: static;
    padding: 16px;
    gap: 14px;
  }
  .account-user { gap: 12px; }
  .account-avatar {
    width: 48px;
    height: 48px;
    font-size: 17px;
  }
  .account-user-info h2 { font-size: 16px; }
  .account-email {
    font-size: 12.5px;
    margin-bottom: 6px;
    word-break: break-all;
  }

  /* Навигация: горизонтальная лента чипсов со скроллом */
  .account-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    margin: 0 -16px;
    padding: 2px 16px 8px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .account-nav::-webkit-scrollbar { display: none; }
  .account-nav-group { display: contents; }
  .account-nav-label { display: none; }
  .account-nav button,
  .account-nav a {
    flex: 0 0 auto;
    white-space: nowrap;
    gap: 8px;
    padding: 9px 14px;
    font-size: 13.5px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
  }
  .account-nav button i,
  .account-nav a i {
    width: auto;
    height: auto;
    background: none;
    font-size: 13px;
  }
  .account-nav button.active,
  .account-nav a.active {
    border-color: var(--primary);
  }

  .account-logout {
    margin-top: 0;
    align-self: flex-start;
    padding: 9px 14px;
    font-size: 13.5px;
    border: 1px solid var(--border);
    border-radius: 999px;
  }

  .account-main { gap: 18px; }

  /* Статистика и действия компактнее */
  .account-stats { gap: 10px; margin-bottom: 20px; }
  .stat-card { padding: 14px; border-radius: 14px; gap: 8px; }
  .stat-card i { width: 36px; height: 36px; font-size: 15px; }
  .stat-value { font-size: 22px; }

  .account-quick-actions { gap: 10px; margin-bottom: 20px; }
  .quick-action { padding: 13px; font-size: 13.5px; border-radius: 13px; }
  .quick-action i { width: 34px; height: 34px; font-size: 14px; }

  /* Список материалов: бейдж переносится под текст при нехватке места */
  .account-items li { flex-wrap: wrap; gap: 10px 12px; padding: 12px 0; }
  .account-items .item-icon,
  .account-items .item-thumb { width: 40px; height: 40px; font-size: 16px; }
  .account-items .item-body { flex: 1 1 60%; }
  .account-items .badge { margin-left: auto; }

  .form-card { border-radius: 14px; }
}

@media (max-width: 480px) {
  .account-sidebar { padding: 14px; }
  .account-nav { margin: 0 -14px; padding: 2px 14px 8px; }
  .stat-value { font-size: 20px; }
  .account-items .badge { margin-left: 0; width: 100%; text-align: center; }
}
