/* ══════════════════════════════════════════════════════════
   DASHBOARD
   ══════════════════════════════════════════════════════════ */

/* ── App Top Bar ───────────────────────────────────────── */
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-height);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-center {
  flex: 1;
  max-width: 480px;
  margin: 0 32px;
}

.topbar-center .search-box {
  width: 100%;
}

.topbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--text-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.topbar-btn:hover {
  color: var(--text-1);
  background: var(--bg-3);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid var(--border);
}

/* ── Dashboard Content ─────────────────────────────────── */
.dashboard {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 32px;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.dashboard-header h1 {
  font-size: 1.75rem;
}

.dashboard-header p {
  margin-top: 4px;
}

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.filter-tabs {
  display: flex;
  gap: 4px;
}

.filter-tab {
  padding: 6px 16px;
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-tab:hover {
  color: var(--text-1);
  background: var(--bg-3);
}

.filter-tab.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.filter-actions {
  display: flex;
  gap: 8px;
}

/* ── Projects Grid ─────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.project-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
}

.project-card:hover {
  border-color: var(--border-light);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.project-cover {
  height: 160px;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 12px;
}

.project-genre-badge {
  padding: 4px 10px;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  color: #fff;
}

.project-info {
  padding: 20px;
}

.project-info h3 {
  font-size: 1.0625rem;
  margin-bottom: 6px;
}

.project-info>p {
  font-size: 0.8125rem;
  margin-bottom: 14px;
  line-height: 1.5;
}

.project-description {
  font-size: 0.8125rem;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--text-2);
}

.project-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-4);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-lg {
  height: 6px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.progress-text {
  font-size: 0.75rem;
  color: var(--text-2);
  font-weight: 600;
}

/* ── New Project Card ──────────────────────────────────── */
.project-card-new {
  border-style: dashed;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.project-card-new:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* ── Project Status Badges ─────────────────────────────── */
.project-status-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 8px;
  font-size: 0.625rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(8px);
  color: #fff;
}

.badge-draft {
  background: rgba(100, 100, 120, .6);
}

.badge-progress {
  background: rgba(59, 130, 246, .7);
}

.badge-completed {
  background: rgba(34, 197, 94, .7);
}

.badge-hold {
  background: rgba(245, 158, 11, .7);
}

.badge-trash {
  background: rgba(239, 68, 68, .7);
}

/* ── Project Edit Button on Card ───────────────────────── */
.project-edit-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(8px);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s, background .2s;
}

.project-card:hover .project-edit-btn {
  opacity: 1;
}

.project-edit-btn:hover {
  background: rgba(0, 0, 0, .7);
}

/* ── Trashed Project Card ──────────────────────────────── */
.project-card-trashed {
  opacity: .75;
  border-style: dashed;
  border-color: var(--danger);
}

.project-card-trashed:hover {
  opacity: 1;
}

/* ── Project Edit Modal ────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.modal-body label {
  display: block;
  font-size: .8rem;
  color: var(--text-2);
  margin-bottom: 5px;
  font-weight: 500;
}

.new-project-inner {
  text-align: center;
  padding: 32px;
}

.new-project-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--text-2);
  transition: all var(--transition);
}

.new-project-icon i {
  width: 24px;
  height: 24px;
}

.project-card-new:hover .new-project-icon {
  background: var(--accent-soft);
  color: var(--accent);
}

.new-project-inner h3 {
  margin-bottom: 4px;
}

/* ── Lang Switcher ────────────────────────────────────────── */
.lang-switcher {
  position: relative;
}

.lang-switcher-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  height: 36px;
  border: 1px solid transparent;
  background: none;
  color: var(--text-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  font-family: var(--font);
}

.lang-switcher-btn:hover {
  color: var(--text-1);
  background: var(--bg-3);
  border-color: var(--border-light);
}

.lang-switcher-btn i,
.lang-switcher-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.lang-switcher-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  background: var(--bg-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1100;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: dropdownFade 0.15s ease;
}

.lang-switcher-dropdown:not(.open) {
  display: none !important;
}

.lang-switcher-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font);
  transition: background var(--transition), color var(--transition);
  text-align: left;
}

.lang-switcher-item:hover {
  background: var(--bg-3);
  color: var(--text-1);
}

.lang-switcher-item.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.lang-switcher-item-name {
  flex: 1;
}

.lang-switcher-item-code {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.06em;
  margin-left: 8px;
}

.lang-switcher-item.active .lang-switcher-item-code {
  color: var(--accent);
}

/* ── Mobile ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-topbar {
    padding: 8px 12px;
    height: auto;
    min-height: var(--topbar-height);
    flex-wrap: nowrap;
    gap: 8px;
  }
  .topbar-center {
    display: none;
  }
  .topbar-right {
    gap: 4px;
    flex-shrink: 0;
  }
  .topbar-btn {
    width: 32px;
    height: 32px;
  }
  .avatar {
    width: 32px;
    height: 32px;
  }
  .lang-switcher-label {
    display: none;
  }
  .dashboard {
    padding: 24px 16px;
  }
  .dashboard-header {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .dashboard-header .btn {
    width: 100%;
    justify-content: center;
  }
  .user-dropdown {
    right: 0;
    left: auto;
    min-width: 200px;
  }
}
