@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --bg: #0b1220;
  --surface: rgba(17, 24, 39, 0.88);
  --surface-strong: #111827;
  --text: #e5eefc;
  --muted: #94a3b8;
  --line: rgba(148, 163, 184, 0.16);
  --accent: #14b8a6;
  --accent-strong: #99f6e4;
  --accent-soft: rgba(20, 184, 166, 0.14);
  --danger: #fb7185;
  --shadow: 0 20px 60px rgba(2, 6, 23, 0.45);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    "Inter",
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(20, 184, 166, 0.18), transparent 34%),
    radial-gradient(circle at bottom left, rgba(37, 99, 235, 0.14), transparent 32%),
    linear-gradient(180deg, #020617 0%, #0f172a 52%, #111827 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

img {
  max-width: 100%;
  display: block;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: var(--accent);
}

.stack {
  display: grid;
  gap: 1rem;
}

.stack.compact {
  gap: 0.75rem;
}

.app-shell {
  min-height: 100vh;
}

.login-view,
.dashboard {
  min-height: 100vh;
}

.login-view {
  display: grid;
  place-items: center;
  padding: 2rem;
}

.login-card {
  width: min(100%, 480px);
  padding: 2rem;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 32px;
  background: rgba(15, 23, 42, 0.86);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0.25rem 0 0.5rem;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1;
}

label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.92rem;
}

input,
select {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  color: var(--text);
}

.primary,
.secondary,
.ghost {
  border-radius: 999px;
  padding: 0.8rem 1.2rem;
  transition:
    transform 0.18s ease,
    background-color 0.18s ease;
}

.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.secondary {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.ghost {
  color: var(--text);
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--line);
}

#logoutBtn {
  border-radius: 16px;
  color: #fecaca;
  background: rgba(127, 29, 29, 0.32);
  border: 1px solid rgba(248, 113, 113, 0.28);
}

.danger {
  color: var(--danger);
}

.danger-text {
  color: var(--danger);
}

.primary:hover,
.secondary:hover,
.ghost:hover {
  transform: translateY(-1px);
}

.error-text,
.flash {
  margin: 0;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: rgba(251, 113, 133, 0.12);
  color: var(--danger);
}

.flash {
  margin: 1rem 0 0;
}

.flash.error {
  border: 1px solid rgba(180, 35, 24, 0.18);
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.5rem;
  border-right: 1px solid rgba(148, 163, 184, 0.1);
  background: rgba(2, 6, 23, 0.7);
  backdrop-filter: blur(16px);
  overflow-y: auto;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
}

.brand-icon svg {
  width: 2.45rem;
  height: 2.45rem;
  display: block;
}

.brand-icon svg path:first-child {
  fill: var(--accent);
}

.brand-arrow-stem,
.brand-arrow-head {
  fill: none;
  stroke: var(--surface-strong);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-title {
  margin: 0 0 0.25rem;
  font-size: 2rem;
  line-height: 1.05;
  color: var(--accent);
}

.sidebar-actions {
  margin: 1.25rem 0 1rem;
}

.album-tree {
  display: grid;
  gap: 0.35rem;
}

.tree-node {
  display: grid;
  gap: 0.2rem;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding-left: calc(var(--depth, 0) * 1rem);
}

.tree-toggle,
.tree-spacer {
  flex: 0 0 auto;
  width: 1.2rem;
  height: 1.2rem;
}

.tree-toggle {
  position: relative;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}

.tree-toggle::before {
  content: "";
  position: absolute;
  left: 0.4rem;
  top: 0.28rem;
  width: 0.32rem;
  height: 0.32rem;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.14s ease;
}

.tree-toggle.expanded::before {
  transform: rotate(45deg);
  top: 0.2rem;
}

.tree-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 1;
  padding: 0.8rem 0.9rem;
  border-radius: 16px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.nav-label {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.nav-icon {
  position: relative;
  flex: 0 0 auto;
  width: 0.95rem;
  height: 0.95rem;
  opacity: 0.95;
}

.home-icon::before,
.album-icon::before,
.trash-icon::before,
.account-icon::before,
.users-icon::before,
.users-icon::after {
  content: "";
  position: absolute;
  box-sizing: border-box;
}

.home-icon::before {
  left: 0.1rem;
  top: 0.24rem;
  width: 0.75rem;
  height: 0.58rem;
  border: 1.6px solid currentColor;
  border-top: 0;
  border-radius: 0 0 0.12rem 0.12rem;
}

.home-icon::after {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.02rem;
  width: 0.65rem;
  height: 0.65rem;
  border-top: 1.6px solid currentColor;
  border-left: 1.6px solid currentColor;
  transform: rotate(45deg);
}

.album-icon::before {
  left: 0.08rem;
  top: 0.14rem;
  width: 0.8rem;
  height: 0.64rem;
  border: 1.6px solid currentColor;
  border-radius: 0.12rem;
}

.album-icon::after {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: 0.02rem;
  width: 0.52rem;
  height: 0.22rem;
  border: 1.6px solid currentColor;
  border-bottom: 0;
  border-radius: 0.12rem 0.12rem 0 0;
}

.trash-icon::before {
  left: 0.2rem;
  top: 0.26rem;
  width: 0.55rem;
  height: 0.52rem;
  border: 1.6px solid currentColor;
  border-top: 0;
  border-radius: 0 0 0.12rem 0.12rem;
}

.trash-icon::after {
  content: "";
  position: absolute;
  left: 0.12rem;
  top: 0.1rem;
  width: 0.72rem;
  height: 0.12rem;
  background: currentColor;
  border-radius: 999px;
  box-shadow: 0 -0.12rem 0 -0.03rem currentColor inset;
}

.account-icon::before {
  left: 0.28rem;
  top: 0.06rem;
  width: 0.38rem;
  height: 0.38rem;
  border: 1.6px solid currentColor;
  border-radius: 999px;
}

.account-icon::after {
  content: "";
  position: absolute;
  left: 0.12rem;
  top: 0.5rem;
  width: 0.7rem;
  height: 0.28rem;
  border: 1.6px solid currentColor;
  border-top-left-radius: 0.4rem;
  border-top-right-radius: 0.4rem;
  border-bottom: 0;
}

.users-icon::before {
  left: 0.1rem;
  top: 0.14rem;
  width: 0.28rem;
  height: 0.28rem;
  border: 1.4px solid currentColor;
  border-radius: 999px;
  box-shadow: 0.34rem 0.06rem 0 -0.02rem currentColor;
}

.users-icon::after {
  left: 0.04rem;
  top: 0.52rem;
  width: 0.38rem;
  height: 0.18rem;
  border: 1.4px solid currentColor;
  border-top-left-radius: 0.3rem;
  border-top-right-radius: 0.3rem;
  border-bottom: 0;
  box-shadow: 0.38rem 0.02rem 0 -0.02rem currentColor;
}

.tree-item.active {
  background: rgba(30, 41, 59, 0.95);
  box-shadow: 0 8px 30px rgba(2, 6, 23, 0.3);
}

.tree-item small {
  color: var(--muted);
}

.trash-item {
  margin-top: 0.35rem;
  color: #f87171;
}

.trash-item.active {
  color: #fecaca;
  background: rgba(127, 29, 29, 0.32);
}

.management-panel {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(20, 184, 166, 0.1), rgba(15, 23, 42, 0.78));
}

.management-head h3 {
  margin: 0.15rem 0 0;
}

.management-nav {
  display: grid;
  gap: 0.5rem;
  margin-top: 1rem;
}

.management-item {
  width: 100%;
  padding: 0.85rem 0.95rem;
  border-radius: 16px;
  text-align: left;
  color: var(--accent-strong);
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(20, 184, 166, 0.08);
}

.management-item.active {
  background: rgba(15, 118, 110, 0.14);
  border-color: rgba(15, 118, 110, 0.18);
}

.admin-panel {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(15, 23, 42, 0.82);
}

.admin-panel-main {
  margin-top: 1.25rem;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 1.25rem;
  align-items: start;
}

.info-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.7);
}

.info-card p {
  margin: 0.75rem 0 0;
  color: var(--muted);
}

.panel-header h3,
.section-head h3 {
  margin: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.85rem;
}

.user-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.user-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.9rem;
  border-radius: 18px;
  background: rgba(30, 41, 59, 0.75);
}

.user-card p {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.main-panel {
  padding: 1.5rem;
}

.topbar {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.search-wrap {
  flex: 1;
  min-width: 0;
}

#createRootAlbumBtn {
  border-radius: 16px;
  flex: 0 0 auto;
}

.topbar-actions,
.workspace-actions,
.dialog-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.workspace {
  margin-top: 1rem;
  padding: 1.5rem;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 30px;
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.workspace-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.workspace-head h2 {
  margin: 0.15rem 0 0;
  font-size: clamp(1.7rem, 2vw, 2.4rem);
}

.breadcrumb {
  margin: 0;
  color: var(--muted);
}

.dropzone {
  margin: 1.5rem 0;
  padding: 1.5rem;
  border: 1.5px dashed rgba(20, 184, 166, 0.28);
  border-radius: 24px;
  background: rgba(15, 23, 42, 0.55);
  text-align: center;
}

.dropzone.disabled {
  opacity: 0.55;
}

.dropzone.is-dragging {
  background: rgba(15, 118, 110, 0.12);
  border-color: var(--accent);
}

.upload-field {
  display: inline-block;
  margin-top: 0.8rem;
  padding: 0.8rem 1.2rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.upload-field input {
  display: none;
}

.upload-progress {
  margin-top: 1rem;
  display: grid;
  gap: 0.45rem;
}

.upload-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.upload-progress-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.upload-progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #14b8a6, #38bdf8);
  transition: width 0.12s linear;
}

.home-overview {
  margin-top: 1.25rem;
}

.home-album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.7rem;
}

.home-album-card {
  display: grid;
  gap: 0.5rem;
  padding: 0.55rem;
  border-radius: 16px;
  text-align: left;
  color: inherit;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.22);
}

.home-album-thumb {
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(20, 184, 166, 0.12), rgba(37, 99, 235, 0.14));
}

.home-album-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-album-meta {
  display: grid;
  gap: 0.15rem;
}

.home-album-meta strong {
  font-size: 0.9rem;
}

.home-album-meta span {
  color: var(--muted);
  font-size: 0.75rem;
}

.child-folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.85rem;
}

.child-folder-card {
  display: grid;
  gap: 0.55rem;
  padding: 0.55rem;
  border-radius: 16px;
  text-align: left;
  color: inherit;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: 0 10px 22px rgba(2, 6, 23, 0.2);
}

.child-folder-thumb {
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(20, 184, 166, 0.12), rgba(37, 99, 235, 0.14));
}

.child-folder-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.child-folder-meta {
  display: grid;
  gap: 0.15rem;
}

.child-folder-meta strong {
  font-size: 0.9rem;
}

.child-folder-meta span {
  color: var(--muted);
  font-size: 0.75rem;
}


.album-grid,
.image-grid {
  display: grid;
  gap: 1rem;
}

.album-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.image-grid {
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}

.album-card,
.image-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.88);
  box-shadow: 0 12px 35px rgba(2, 6, 23, 0.3);
}

.image-select {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.3);
}

.image-select input {
  width: 0.72rem;
  height: 0.72rem;
  margin: 0;
}

.batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.selection-count {
  color: var(--muted);
  font-size: 0.9rem;
}

.album-card {
  display: grid;
  padding: 0;
  text-align: left;
}

.album-cover,
.image-preview {
  aspect-ratio: 1;
  width: 100%;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(14, 116, 144, 0.16));
}

.image-preview {
  padding: 0;
  border: 0;
  overflow: hidden;
  border-radius: 12px;
}

.album-cover img,
.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.album-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 3rem;
  color: var(--accent-strong);
}

.album-meta,
.image-meta {
  padding: 0.95rem 1rem 1.1rem;
}

.image-meta {
  padding: 0.55rem 0.65rem 0.7rem;
}

.album-meta {
  display: grid;
  gap: 0.25rem;
}

.album-meta span,
.image-meta strong,
.empty-state {
  color: var(--muted);
}

.image-meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  margin: 0;
  padding: 1rem 0;
}

.context-menu {
  position: fixed;
  z-index: 50;
  display: grid;
  min-width: 180px;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.96);
  box-shadow: var(--shadow);
}

.context-menu button {
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  text-align: left;
  background: transparent;
  color: var(--text);
}

.context-menu .danger-text {
  color: var(--danger);
}

.context-menu button:hover {
  background: rgba(15, 118, 110, 0.08);
}

.modal {
  border: 0;
  border-radius: 24px;
  padding: 1.25rem;
  width: min(92vw, 420px);
  color: var(--text);
  background: rgba(15, 23, 42, 0.98);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.35);
}

.slideshow {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  gap: 0;
  padding: 0;
  background: rgba(2, 6, 23, 0.96);
}

.slideshow img {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  border-radius: 0;
  cursor: zoom-in;
  user-select: none;
}

.slideshow img.zoomed {
  max-width: none;
  max-height: none;
  position: absolute;
  cursor: grab;
}

.slideshow-caption,
.slideshow-close {
  color: #fff;
}

.slideshow-caption {
  position: absolute;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(8px);
 }

.slideshow-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(8px);
}

@media (max-width: 980px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  }

  .workspace-head,
  .topbar,
  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main-panel,
  .sidebar,
  .login-view {
    padding: 1rem;
  }

  .workspace,
  .login-card {
    padding: 1.2rem;
    border-radius: 24px;
  }

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

  .topbar-actions,
  .workspace-actions {
    width: 100%;
  }

  .topbar-actions > *,
  .workspace-actions > * {
    flex: 1;
  }
}
