:root {
  --bg: linear-gradient(120deg, #f4f7fb 0%, #e9f1ff 45%, #f8f5ef 100%);
  --card-bg: rgba(255, 255, 255, 0.9);
  --text: #142238;
  --muted: #5f6f86;
  --accent: #0d6efd;
  --accent-soft: #d6e7ff;
  --danger: #c62828;
  --border: #d7e1ef;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

.container {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.container-fluid {
  min-height: 100vh;
  padding: 20px;
}

.container-fluid .card {
  width: 100%;
  max-width: none;
}

.card {
  width: min(900px, 100%);
  background: var(--card-bg);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(31, 53, 92, 0.16);
  padding: 24px;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.header-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.session-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.session-strip form {
  margin: 0;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.header-links form {
  margin: 0;
}

.user-info {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.session-strip .user-info {
  margin-bottom: 0;
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
}

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

.controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.drop-zone {
  margin-top: 20px;
  border: 2px dashed #b8d0f3;
  border-radius: 14px;
  background: linear-gradient(145deg, #f8fbff 0%, #eef5ff 100%);
  padding: 26px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.drop-zone:hover,
.drop-zone.drag-active {
  border-color: #0d6efd;
  background: linear-gradient(145deg, #f1f7ff 0%, #e3f0ff 100%);
  transform: translateY(-1px);
}

.drop-zone-title {
  margin: 0;
  font-weight: 700;
  color: #19345f;
}

.drop-zone-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.file-input-hidden {
  display: none;
}

input[type="file"] {
  flex: 1;
  min-width: 220px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
}

button {
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  padding: 0 18px;
  min-height: 44px;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.05);
}

.secondary-btn {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}

.link-btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.top-menu {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: linear-gradient(130deg, #eff5ff 0%, #f6faff 100%);
  border: 1px solid #d4e4fb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.top-menu-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  color: #33507b;
  letter-spacing: 0.01em;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.top-menu-link:hover {
  background: rgba(255, 255, 255, 0.75);
  color: #18335d;
  transform: translateY(-1px);
}

.top-menu-link.active {
  background: linear-gradient(135deg, #0d6efd 0%, #1f88ff 100%);
  color: #fff;
  box-shadow: 0 8px 18px rgba(13, 110, 253, 0.32);
}

.secondary-btn:hover {
  background: #f8fbff;
  filter: none;
}

.error {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--danger);
  font-weight: 500;
}

.error.visible {
  min-height: unset;
}

.upload-list {
  margin-top: 16px;
  display: grid;
  gap: 14px;
}

.upload-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 14px;
}

.upload-header {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.upload-header strong {
  flex: 1;
  min-width: 180px;
}

.upload-header span {
  color: var(--muted);
  font-size: 0.9rem;
}

.cancel-upload-btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  background: #fff;
  color: #b42318;
  border: 1px solid #efc1ba;
  font-weight: 700;
}

.cancel-upload-btn:hover {
  background: #fff5f3;
  filter: none;
}

.cancel-upload-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.progress-outer {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--accent-soft);
}

.progress-inner {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #2f80ed 0%, #47c6ff 100%);
  transition: width 0.2s linear;
}

.upload-meta {
  margin-top: 10px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-card {
  width: min(520px, 100%);
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.login-form input[type="text"] {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  font-size: 1rem;
}

.media-section {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.media-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.media-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.bulk-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.bulk-actions .subtitle {
  margin-left: 4px;
}

.media-gallery {
  margin-top: 14px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.user-tabs {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.user-tab-btn {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

.user-tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.media-item {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.select-media-checkbox {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 4px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.media-select-input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.media-item img,
.media-item video {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f3f7ff;
}

.media-item img {
  cursor: zoom-in;
}

.media-meta {
  margin-top: 8px;
  display: grid;
  gap: 4px;
  font-size: 0.9rem;
  color: var(--muted);
}

.download-btn {
  margin-top: 10px;
  display: inline-block;
  text-decoration: none;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 600;
}

.download-links {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.download-links .download-btn {
  margin-top: 0;
}

.media-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.media-actions .download-links {
  margin-top: 0;
}

.delete-media-btn {
  min-height: 34px;
  min-width: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid #efc1ba;
  background: #fff;
  color: #b42318;
  font-weight: 700;
}

.delete-media-btn:hover {
  background: #fff5f3;
  filter: none;
}

.delete-media-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(9, 20, 38, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.image-lightbox.open {
  display: flex;
}

.image-lightbox-img {
  max-width: min(1200px, 96vw);
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.image-lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  min-height: 40px;
  min-width: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
}

@media (max-width: 640px) {
  .card {
    padding: 16px;
    border-radius: 12px;
  }

  .upload-meta {
    gap: 10px;
  }

  .media-item img,
  .media-item video {
    height: 160px;
  }

  .top-menu {
    width: 100%;
    justify-content: stretch;
  }

  .top-menu-link {
    flex: 1;
  }
}
