:root {
  color-scheme: dark;

  --background: #050914;
  --background-light: #0b1220;
  --card: rgba(15, 23, 42, 0.94);
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #f8fafc;
  --muted: #94a3b8;
  --primary: #22c55e;
  --primary-dark: #16a34a;
  --danger: #b32626;
  --danger-light: #d13434;
  --input: #070c17;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  color: var(--text);

  background:
    radial-gradient(
      circle at top,
      rgba(37, 99, 235, 0.17),
      transparent 38%
    ),
    linear-gradient(
      180deg,
      #07101e 0%,
      var(--background) 56%,
      #02040a 100%
    );
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

.page {
  width: 100%;
  min-height: 100vh;
}

.container {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 12px 0 50px;
}

.topbar {
  width: min(1240px, calc(100% - 40px));
  min-height: 86px;
  margin: 0 auto;

  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  flex-shrink: 0;

  font-size: 30px;
  font-weight: 900;
  letter-spacing: -1.5px;
}

.brand-i {
  color: var(--primary);
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-btn,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 42px;
  padding: 10px 17px;

  border: 1px solid var(--border);
  border-radius: 13px;

  color: var(--text);
  background: rgba(255, 255, 255, 0.055);

  font-weight: 750;
  cursor: pointer;

  transition:
    transform 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.nav-btn:hover,
.btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.10);
}

.nav-btn.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.16);
}

.logout-btn {
  background: transparent;
}

.btn-primary {
  border-color: transparent;
  color: #ffffff;

  background:
    linear-gradient(
      180deg,
      var(--primary),
      var(--primary-dark)
    );
}

.btn-primary:hover {
  border-color: transparent;

  background:
    linear-gradient(
      180deg,
      #2bd96a,
      var(--primary-dark)
    );
}

.btn-upload {
  min-width: 180px;
  min-height: 50px;

  padding: 13px 26px;

  border-color: var(--danger);
  border-radius: 16px;

  color: #ffffff;
  background: var(--danger);

  font-size: 17px;
  font-weight: 850;
}

.btn-upload:hover {
  border-color: var(--danger-light);
  background: var(--danger-light);
}

.btn:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.btn-full {
  width: 100%;
}

.btn.small {
  min-height: 38px;
  padding: 8px 14px;

  font-size: 14px;
}

.btn.danger {
  border-color: var(--danger);
  background: var(--danger);
}

.btn.danger:hover {
  border-color: var(--danger-light);
  background: var(--danger-light);
}

.copy-btn {
  border-color: var(--danger);
  background: var(--danger);
}

.copy-btn:hover {
  border-color: var(--danger-light);
  background: var(--danger-light);
}

.inline-form {
  display: inline;
  margin: 0;
}

.pill {
  display: inline-flex;
  align-items: center;

  min-height: 42px;
  padding: 9px 14px;

  border: 1px solid var(--border);
  border-radius: 999px;

  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.055);

  font-size: 14px;
}

.card,
.upload-box,
.img-card {
  border: 1px solid var(--border);
  border-radius: 22px;

  background: var(--card);
  box-shadow: var(--shadow);
}

.upload-box {
  padding: 20px;
}

.drop-area {
  padding: 42px 24px;

  border: 2px dashed var(--border-strong);
  border-radius: 22px;

  text-align: center;
  background: rgba(2, 6, 23, 0.45);
}

.upload-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;

  display: grid;
  place-items: center;

  border: 1px solid rgba(34, 197, 94, 0.28);
  border-radius: 999px;

  color: var(--primary);
  background: rgba(34, 197, 94, 0.10);

  font-size: 38px;
  font-weight: 400;
}

.drop-area h1 {
  margin: 0 0 9px;

  font-size: clamp(27px, 4vw, 38px);
  letter-spacing: -1px;
}

.upload-description {
  max-width: 680px;
  margin: 0 auto 24px;

  color: var(--muted);
  line-height: 1.65;
}

.file-label {
  margin-bottom: 12px;
}

.selected-files {
  min-height: 24px;
  margin-bottom: 22px;

  color: #cbd5e1;
  font-size: 14px;
}

.or-text {
  margin: 4px 0 13px;

  color: var(--muted);

  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.5px;
}

textarea,
input,
select {
  width: 100%;
  min-height: 48px;

  padding: 13px 15px;

  border: 1px solid var(--border);
  border-radius: 14px;
  outline: none;

  color: var(--text);
  background: var(--input);

  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(34, 197, 94, 0.70);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.10);
}

textarea {
  display: block;
  width: min(720px, 100%);
  min-height: 132px;
  margin: 0 auto 20px;

  resize: vertical;
  line-height: 1.5;
}

.form-grid {
  display: grid;
  gap: 15px;
}

.form-label {
  display: grid;
  gap: 8px;

  color: #dbe4f0;

  font-size: 14px;
  font-weight: 750;
}

.subinfo {
  margin-top: 17px;

  display: flex;
  justify-content: space-between;
  gap: 14px;

  color: var(--muted);

  font-size: 14px;
  line-height: 1.5;
}

.gallery-section {
  padding-top: 28px;
}

.section-head {
  margin-bottom: 16px;

  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.section-head h2,
.card-heading h1,
.card-heading h2 {
  margin: 0;

  font-size: 25px;
  letter-spacing: -0.5px;
}

.section-head p,
.card-heading p {
  margin: 7px 0 0;

  color: var(--muted);
  line-height: 1.5;
}

.gallery {
  display: grid;

  grid-template-columns:
    repeat(4, minmax(0, 1fr));

  gap: 17px;
}

.img-card {
  min-width: 0;
  padding: 13px;
}

.image-link {
  display: block;
  overflow: hidden;

  margin-bottom: 12px;

  border-radius: 15px;
  background: #020617;
}

.img-card img {
  display: block;

  width: 100%;
  aspect-ratio: 1 / 1;

  object-fit: cover;

  transition: transform 0.2s ease;
}

.image-link:hover img {
  transform: scale(1.025);
}

.link-box {
  overflow: hidden;

  margin-bottom: 11px;
  padding: 11px;

  border: 1px solid var(--border);
  border-radius: 12px;

  color: #cbd5e1;
  background: #050a14;

  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-actions {
  margin-bottom: 12px;

  display: flex;
  justify-content: center;
  gap: 9px;
}

.card-actions .btn {
  flex: 1;
}

.meta {
  display: grid;
  gap: 5px;

  color: var(--muted);

  font-size: 12px;
  line-height: 1.45;
}

.meta div {
  min-width: 0;

  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.meta strong {
  overflow: hidden;

  color: #dbe4f0;

  font-weight: 650;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-box {
  grid-column: 1 / -1;

  padding: 38px;

  border: 1px dashed var(--border-strong);
  border-radius: 18px;

  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);

  text-align: center;
}

.pagination {
  margin-top: 28px;

  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;

  flex-wrap: wrap;
}

.page-link,
.page-current {
  width: 40px;
  height: 40px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 1px solid var(--border);
  border-radius: 11px;

  color: var(--text);
  background: rgba(255, 255, 255, 0.055);

  font-size: 14px;
  font-weight: 800;
}

.page-link:hover {
  background: rgba(255, 255, 255, 0.11);
}

.page-current {
  border-color: var(--danger);
  background: var(--danger);
}

.page-arrow {
  font-size: 24px;
  font-weight: 500;
}

.alert {
  margin-bottom: 16px;
  padding: 13px 15px;

  border-radius: 14px;

  font-weight: 750;
  line-height: 1.5;
}

.alert.success {
  border: 1px solid rgba(34, 197, 94, 0.30);
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.12);
}

.alert.error {
  border: 1px solid rgba(239, 68, 68, 0.30);
  color: #fecaca;
  background: rgba(239, 68, 68, 0.12);
}

.toast-wrap {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 9999;

  display: flex;
  flex-direction: column;
  gap: 9px;
}

.toast {
  min-width: 240px;
  max-width: 360px;
  padding: 13px 16px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 13px;

  color: #ffffff;
  background: var(--danger);
  box-shadow: var(--shadow);

  font-weight: 800;
  text-align: center;

  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;

  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.auth-body {
  display: grid;
  place-items: center;

  padding: 24px;
}

.login-wrap {
  width: min(440px, 100%);
}

.brand-login {
  margin-bottom: 17px;

  font-size: 40px;
  text-align: center;
}

.login-card {
  padding: 28px;
}

.login-heading {
  margin-bottom: 22px;
  text-align: center;
}

.login-heading h1 {
  margin: 0;

  font-size: 30px;
  letter-spacing: -0.7px;
}

.login-heading p {
  margin: 9px 0 0;

  color: var(--muted);
  line-height: 1.5;
}

.user-layout {
  display: grid;

  grid-template-columns:
    minmax(290px, 360px)
    minmax(0, 1fr);

  gap: 20px;
}

.card {
  padding: 22px;
}

.card-heading {
  margin-bottom: 20px;
}

.user-list-card {
  min-width: 0;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 10px;

  border-bottom: 1px solid var(--border);

  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: var(--muted);

  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

td {
  color: #dbe4f0;
  font-size: 14px;
}

.role-badge {
  display: inline-flex;
  padding: 5px 9px;

  border: 1px solid var(--border);
  border-radius: 999px;

  color: #dbe4f0;
  background: rgba(255, 255, 255, 0.055);

  font-size: 12px;
  font-weight: 800;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1050px) {
  .gallery {
    grid-template-columns:
      repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .topbar {
    padding: 17px 0;
    flex-wrap: wrap;
  }

  .nav {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .nav .nav-btn {
    flex: 1;
  }

  .top-right {
    margin-left: auto;
  }

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

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

  .subinfo {
    flex-direction: column;
    gap: 5px;
  }
}

@media (max-width: 560px) {
  .container,
  .topbar {
    width: min(100% - 24px, 1240px);
  }

  .top-right {
    width: 100%;
    margin-left: 0;
  }

  .pill {
    flex: 1;
  }

  .gallery {
    grid-template-columns: 1fr;
  }

  .drop-area {
    padding: 32px 16px;
  }

  .upload-box,
  .card {
    padding: 14px;
  }

  .login-card {
    padding: 22px;
  }

  .toast-wrap {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }
}

/* Ihphlegacy FOLDER FEATURE */

.folder-toolbar {
  margin-bottom: 18px;

  display: grid;
  grid-template-columns:
    minmax(0, 1.4fr)
    minmax(240px, 0.8fr);

  gap: 16px;
}

.folder-create-form,
.folder-filter-form {
  min-width: 0;
}

.folder-field {
  display: grid;
  gap: 8px;

  color: #dbe4f0;

  font-size: 14px;
  font-weight: 750;
}

.folder-create-row {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    auto;

  gap: 9px;
}

.upload-folder-field {
  width: min(420px, 100%);
  margin: 0 auto 22px;

  display: grid;
  gap: 8px;

  color: #dbe4f0;

  font-size: 14px;
  font-weight: 750;
  text-align: left;
}

@media (max-width: 760px) {
  .folder-toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .folder-create-row {
    grid-template-columns: 1fr;
  }

  .folder-create-row .btn {
    width: 100%;
  }
}

/* Ihphlegacy COMPACT UPLOAD START */

.upload-box {
  padding: 14px;
  border-radius: 18px;
}

.upload-folder-field {
  width: min(390px, 100%);
  margin: 0 auto 12px;
  gap: 6px;

  font-size: 13px;
}

.upload-folder-field select {
  min-height: 42px;
  padding: 9px 13px;
  border-radius: 12px;
}

.drop-area {
  padding: 20px 18px;

  border-radius: 16px;
}

.upload-icon {
  display: none;
}

.drop-area h1 {
  margin: 0 0 5px;

  font-size: 25px;
  letter-spacing: -0.5px;
}

.upload-description {
  max-width: 680px;
  margin: 0 auto 14px;

  font-size: 13px;
  line-height: 1.5;
}

.file-label {
  min-height: 38px;
  margin: 0 8px 10px 0;
  padding: 8px 15px;

  border-radius: 11px;

  vertical-align: middle;
}

.selected-files {
  min-height: 0;
  margin: 0 0 10px;

  display: inline-block;

  font-size: 13px;
  vertical-align: middle;
}

.or-text {
  margin: 3px 0 8px;

  font-size: 11px;
}

.drop-area textarea {
  width: min(660px, 100%);
  height: 88px;
  min-height: 88px;
  margin: 0 auto 12px;
  padding: 11px 13px;

  border-radius: 12px;

  font-size: 13px;
  line-height: 1.45;
}

.btn-upload {
  min-width: 145px;
  min-height: 42px;
  padding: 9px 19px;

  border-radius: 12px;

  font-size: 15px;
}

.subinfo {
  margin-top: 10px;
  gap: 8px;

  font-size: 12px;
}

@media (max-width: 560px) {
  .upload-box {
    padding: 10px;
  }

  .drop-area {
    padding: 17px 12px;
  }

  .drop-area h1 {
    font-size: 22px;
  }

  .upload-description {
    margin-bottom: 12px;
  }

  .file-label,
  .selected-files {
    display: flex;
    width: fit-content;
    margin-right: auto;
    margin-left: auto;
  }

  .selected-files {
    justify-content: center;
  }

  .drop-area textarea {
    height: 82px;
    min-height: 82px;
  }

  .btn-upload {
    width: 100%;
    max-width: 240px;
  }
}

/* Ihphlegacy COMPACT UPLOAD END */


/* Ihphlegacy BULK DELETE START */

.bulk-delete-toolbar {
  margin: 0 0 14px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 11px 13px;

  border: 1px solid var(--border);
  border-radius: 14px;

  background: rgba(255, 255, 255, 0.035);
}

.bulk-select-all {
  display: inline-flex;
  align-items: center;
  gap: 9px;

  color: #dbe4f0;

  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.bulk-select-all input,
.image-select-control input {
  width: 17px;
  height: 17px;
  min-height: 0;
  padding: 0;

  accent-color: var(--danger);
  cursor: pointer;
}

.bulk-delete-button {
  min-height: 39px;
  padding: 8px 14px;
}

.bulk-delete-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.img-card {
  position: relative;
}

.image-select-control {
  position: absolute;
  top: 21px;
  left: 21px;
  z-index: 5;

  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 7px 9px;

  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;

  color: #ffffff;
  background: rgba(2, 6, 23, 0.82);

  box-shadow:
    0 5px 18px rgba(0, 0, 0, 0.28);

  font-size: 12px;
  font-weight: 800;
  cursor: pointer;

  backdrop-filter: blur(6px);
}

.image-select-control:hover {
  background: rgba(15, 23, 42, 0.94);
}

@media (max-width: 560px) {
  .bulk-delete-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .bulk-delete-button {
    width: 100%;
  }
}

/* Ihphlegacy BULK DELETE END */

/* Ihphlegacy CHANGE PASSWORD START */

.password-layout {
  min-height: calc(100vh - 150px);

  display: flex;
  justify-content: center;
  align-items: flex-start;

  padding-top: 24px;
}

.password-card {
  width: min(480px, 100%);
}

.password-card .card-heading {
  text-align: center;
}

/* Ihphlegacy CHANGE PASSWORD END */
