/* =====================================================
   web.css — shared dark-theme stylesheet for all
   Django server-side web templates.
   Drawing SPA styles live in style.css.
   Email templates use their own inlined styles.
   ===================================================== */

/* ── Base ─────────────────────────────────────────── */

* {
  box-sizing: border-box;
}

body {
  font-family: sans-serif;
  background: #1a1a1a;
  color: #eee;
  margin: 0;
  padding: 0;
}

h1 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

p {
  color: #ccc;
  line-height: 1.6;
  margin-bottom: 1rem;
}

a {
  color: #4da6ff;
}

/* ── Page containers ──────────────────────────────── */

/* Standard wide layout — library, collections */
.page-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
}

/* Slightly narrower — home page */
.page-container--narrow {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* Narrow centered form layout — auth pages */
.page-container--form {
  max-width: 400px;
  margin: 100px auto;
  padding: 0 20px;
}

/* ── Navigation ───────────────────────────────────── */

.nav {
  margin-bottom: 1.5rem;
}

.nav a {
  color: #4da6ff;
  margin-right: 1rem;
}

.nav .logout-form {
  display: inline;
  margin: 0;
  padding: 0;
}

.nav .logout-form button {
  background: none;
  border: none;
  color: #4da6ff;
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
}

/* ── Buttons ──────────────────────────────────────── */

.btn-primary {
  width: 100%;
  padding: 0.6rem;
  background: #0066cc;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

.btn-primary:hover {
  background: #0055aa;
}

.btn-success {
  display: block;
  width: 100%;
  padding: 0.6rem;
  background: #2e7d32;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

.btn-danger {
  display: block;
  width: 100%;
  padding: 0.6rem;
  background: #b71c1c;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

.btn-danger:hover {
  background: #7f0000;
}

.btn-success:hover {
  background: #1b5e20;
}

.stacked-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stacked-actions .btn-secondary {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

.upload-btn {
  margin-top: 0.75rem;
  padding: 0.5rem 1.2rem;
  background: #2e7d32;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.upload-btn:hover {
  background: #1b5e20;
}

.upload-btn:disabled {
  background: #555;
  cursor: not-allowed;
}

.delete-btn {
  background: #c62828;
  color: white;
  border: none;
  border-radius: 3px;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.delete-btn:hover {
  background: #b71c1c;
}

.batch-btn {
  padding: 0.4rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  color: white;
}

.batch-btn-add {
  background: #2e7d32;
}

.batch-btn-add:hover {
  background: #1b5e20;
}

.batch-btn-remove {
  background: #c62828;
}

.batch-btn-remove:hover {
  background: #b71c1c;
}

/* ── Auth forms ───────────────────────────────────── */

.page-container--form label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
  color: #aaa;
}

.page-container--form input[type="text"],
.page-container--form input[type="email"],
.page-container--form input[type="password"],
.page-container--form select,
.page-container--form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem;
  margin-bottom: 1rem;
  background: #2a2a2a;
  border: 1px solid #444;
  color: #eee;
  border-radius: 4px;
}

.btn-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn-row .btn-primary,
.btn-row .btn-secondary {
  width: auto;
  flex: 1;
}

.button-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
}

.button-row > button {
  flex: 1;
}

.draw-page-report-link {
  display: block;
  text-align: center;
  margin-top: 1rem;
  color: #ef5350;
  font-size: 0.85rem;
  text-decoration: none;
}

.draw-page-report-link:hover {
  color: #e53935;
  text-decoration: underline;
}

/* ── Upload section (collapsible) ─────────────────── */

.upload-section {
  margin-bottom: 2rem;
}

.upload-section summary {
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: bold;
  color: #eee;
  padding: 0.5rem;
  background: #2a2a2a;
  border-radius: 4px;
}

.upload-section summary:hover {
  background: #333;
}

.upload-section > div {
  padding: 1rem;
  background: #252525;
  border: 1px solid #333;
  border-radius: 0 0 4px 4px;
}

.policy-notice {
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 1rem;
}

.policy-notice a {
  color: #4da6ff;
}

.upload-form label {
  display: block;
  margin-bottom: 0.5rem;
  color: #aaa;
  font-size: 0.9rem;
}

.upload-form input[type="file"] {
  color: #eee;
}

.folder-upload {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #444;
}

.folder-upload label {
  display: block;
  margin-bottom: 0.5rem;
  color: #aaa;
  font-size: 0.9rem;
}

.folder-upload input[type="file"] {
  color: #eee;
}

#folder-upload-btn {
  margin-top: 0.5rem;
  padding: 0.5rem 1.2rem;
  background: #2e7d32;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#folder-upload-btn:hover:not(:disabled) {
  background: #1b5e20;
}

#folder-upload-btn:disabled {
  background: #555;
  cursor: not-allowed;
}

#folder-counts {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: #aaa;
}

#folder-progress-container {
  margin-top: 0.75rem;
}

#folder-progress {
  width: 100%;
  height: 8px;
  accent-color: #2e7d32;
}

#folder-status {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.85rem;
  color: #aaa;
}

/* ── Manage-collections section (collapsible) ─────── */

.collections-section {
  margin-bottom: 2rem;
}

.collections-section summary {
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: bold;
  color: #eee;
  padding: 0.5rem;
  background: #2a2a2a;
  border-radius: 4px;
}

.collections-section summary:hover {
  background: #333;
}

.collections-section > div {
  padding: 1rem;
  background: #252525;
  border: 1px solid #333;
  border-radius: 0 0 4px 4px;
}

/* ── Collection list (library manage panel) ───────── */

.collection-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
}

.collections-section .collection-list li {
  display: flex;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid #333;
  gap: 0.75rem;
}

.collections-section .collection-list li:last-child {
  border-bottom: none;
}

.collection-list .col-title {
  flex: 1;
  color: #eee;
}

.collections-section .collection-list a {
  color: #4da6ff;
  font-size: 0.85rem;
}

.collection-list .delete-col-form {
  display: inline;
}

.collection-list .delete-col-btn {
  background: none;
  border: none;
  color: #ff6b6b;
  cursor: pointer;
  font-size: 0.85rem;
  text-decoration: underline;
  padding: 0;
  font: inherit;
}

/* ── Public collections list (card style) ─────────── */

.collection-list--card {
  list-style: none;
  padding: 0;
  margin: 0;
}

.collection-list--card li {
  background: #2a2a2a;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.collection-list--card .col-title {
  flex: 1;
  font-size: 1rem;
  color: #eee;
}

.collection-list--card .col-meta {
  font-size: 0.8rem;
  color: #aaa;
}

.collection-list--card .draw-link {
  padding: 0.35rem 0.9rem;
  background: #2e7d32;
  color: white;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.85rem;
  white-space: nowrap;
}

.collection-list--card .draw-link:hover {
  background: #1b5e20;
}

.collection-list--card .report-link {
  color: #ef5350;
  font-size: 0.8rem;
  text-decoration: none;
  white-space: nowrap;
}

.collection-list--card .report-link:hover {
  color: #e53935;
  text-decoration: underline;
}

/* ── Create collection form ───────────────────────── */

.create-collection-form {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.create-collection-form input[type="text"] {
  padding: 0.4rem 0.75rem;
  background: #333;
  border: 1px solid #555;
  color: #eee;
  border-radius: 4px;
  font-size: 0.9rem;
  min-width: 220px;
}

.create-collection-form button {
  padding: 0.4rem 1rem;
  background: #0066cc;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

.create-collection-form button:hover {
  background: #0052a3;
}

/* ── Sort controls ────────────────────────────────── */

.sort-controls {
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: #aaa;
}

.sort-controls a {
  color: #4da6ff;
  margin-right: 0.75rem;
}

.sort-controls .active {
  color: #eee;
  font-weight: bold;
  text-decoration: none;
}

/* ── Image grid ───────────────────────────────────── */

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.image-card {
  background: #2a2a2a;
  border-radius: 6px;
  overflow: hidden;
}

.image-card img {
  width: 100%;
  height: 160px;
  object-fit: contain;
  background: #111;
  display: block;
}

.image-card .card-body {
  padding: 0.5rem;
}

.image-card .filename {
  font-size: 0.8rem;
  color: #ccc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 0.4rem;
}

/* Selectable image cards — collection management page */
.image-card--selectable {
  cursor: pointer;
  position: relative;
  transition: outline 0.1s;
  outline: 3px solid transparent;
}

.image-card--selectable.in-collection {
  outline: 3px solid #2e7d32;
}

.image-card--selectable:hover {
  outline: 3px solid #4da6ff;
}

.in-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #2e7d32;
  color: white;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 3px;
}

/* ── Batch controls ───────────────────────────────── */

.controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}

/* ── Public-toggle section ────────────────────────── */

.public-section {
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  background: #2a2a2a;
  border-radius: 6px;
  font-size: 0.9rem;
}

.public-section label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.public-section input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.public-section .unconfirmed-msg {
  margin-top: 0.4rem;
  color: #aaa;
  font-size: 0.85rem;
}

.public-section .unconfirmed-msg a {
  color: #4da6ff;
}

/* ── Pagination ───────────────────────────────────── */

.pagination {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.9rem;
}

.pagination a {
  color: #4da6ff;
  cursor: pointer;
}

.pagination .current {
  color: #eee;
}

/* ── Home page ────────────────────────────────────── */

.links {
  margin-top: 2rem;
}

.links a {
  color: #4da6ff;
  display: inline-block;
  margin-right: 1.5rem;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.links a:hover {
  color: #80c0ff;
}

.divider {
  border: none;
  border-top: 1px solid #333;
  margin: 2rem 0;
}

/* ── Utility ──────────────────────────────────────── */

.empty-state {
  color: #888;
  font-style: italic;
  margin-top: 2rem;
}

.empty-collections {
  color: #888;
  font-style: italic;
  margin-bottom: 1rem;
}

.error-msg {
  color: #ff6b6b;
  font-size: 0.9rem;
  margin-top: 0.4rem;
}

.error {
  color: #ff6b6b;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.non-field-errors {
  color: #ff6b6b;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.help {
  font-size: 0.8rem;
  color: #888;
  margin-top: -0.75rem;
  margin-bottom: 0.75rem;
}

.help-text {
  font-size: 0.85rem;
  color: #999;
  margin-bottom: 1.5rem;
}

.back-link {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.9rem;
  color: #aaa;
}

.back-link a {
  color: #4da6ff;
  display: block;
  margin-bottom: 0.5rem;
}

.register-link {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.9rem;
  color: #aaa;
}

.register-link a {
  color: #4da6ff;
}

.login-link {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* Coloured headings for status pages */
.text-success {
  color: #4da6ff;
}

.text-error {
  color: #ff6b6b;
}

/* ── Site header ──────────────────────────────────── */

.site-header {
  background: #222;
  border-bottom: 1px solid #333;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header__inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header__title {
  font-size: 1.1rem;
  font-weight: bold;
  color: #eee;
  text-decoration: none;
}

.site-header__title:hover {
  color: #fff;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.site-nav a {
  color: #4da6ff;
  text-decoration: none;
  font-size: 0.95rem;
}

.site-nav a:hover {
  color: #80c0ff;
}

.site-nav .logout-form {
  display: inline;
  margin: 0;
  padding: 0;
}

.site-nav .logout-form button {
  background: none;
  border: none;
  color: #4da6ff;
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-size: 0.95rem;
  text-decoration: underline;
}

.site-nav .logout-form button:hover {
  color: #80c0ff;
}

.site-header__hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
}

.site-header__hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: #eee;
  border-radius: 2px;
}

@media (max-width: 600px) {
  .site-header {
    position: relative;
  }

  .site-header__hamburger {
    display: flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: #222;
    border-bottom: 1px solid #333;
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 20px;
    gap: 0.75rem;
    z-index: 99;
  }

  .site-nav.open {
    display: flex;
  }
}

/* ── Site footer ──────────────────────────────────── */

.site-footer {
  border-top: 1px solid #333;
  padding: 1rem 20px;
  text-align: center;
  font-size: 0.85rem;
}

.site-footer .logout-form {
  display: inline;
}

.site-footer .logout-form button {
  background: none;
  border: none;
  color: #4da6ff;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  text-decoration: underline;
}

.site-footer .logout-form button:hover {
  color: #80c0ff;
}

/* ── Drawing active — hide chrome during drawing ──── */

.drawing-active .site-header,
.drawing-active .site-footer {
  display: none;
}

/* ── Policy overlay ───────────────────────────────── */

.policy-overlay {
  position: fixed;
  inset: 0;
  background: #1a1a1a;
  z-index: 1000;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.policy-overlay__header {
  position: sticky;
  top: 0;
  background: #1a1a1a;
  border-bottom: 1px solid #333;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: flex-end;
}

.policy-overlay__close {
  background: none;
  border: none;
  color: #eee;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}

.policy-overlay__close:hover {
  color: #fff;
}

.policy-overlay__content {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.policy-overlay__content h1 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.policy-overlay__content h2 {
  font-size: 1.1rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: #eee;
}

.policy-overlay__content h3 {
  font-size: 1rem;
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
  color: #ccc;
}

.policy-overlay__content ul,
.policy-overlay__content ol {
  color: #ccc;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
  line-height: 1.6;
}

.policy-overlay__content strong {
  color: #eee;
}

/* ── Collection management — visibility section ────── */

.visibility-section {
  margin-bottom: 2rem;
}

.visibility-section summary {
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: bold;
  color: #eee;
  padding: 0.5rem;
  background: #2a2a2a;
  border-radius: 4px;
}

.visibility-section summary:hover {
  background: #333;
}

.visibility-section > div {
  padding: 1rem;
  background: #252525;
  border: 1px solid #333;
  border-radius: 0 0 4px 4px;
}

.visibility-section label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: #aaa;
}

.visibility-section select {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 1rem;
  background: #333;
  border: 1px solid #555;
  color: #eee;
  border-radius: 4px;
  font-size: 0.95rem;
}

/* ── Secondary button ──────────────────────────────── */

.btn-secondary {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #444;
  color: #eee;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
}

.btn-secondary:hover {
  background: #555;
  color: #fff;
}

.btn-confirm {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #2e7d32;
  color: #eee;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
}

.btn-confirm:hover {
  background: #1b5e20;
  color: #fff;
}

/* ── Message blocks ────────────────────────────────── */

.success-message {
  background: #1b3a1e;
  border: 1px solid #2e7d32;
  color: #a5d6a7;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.error-message {
  background: #3a1b1b;
  border: 1px solid #c62828;
  color: #ef9a9a;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.error-message a {
  color: #ef9a9a;
  text-decoration: underline;
}

.adult-notice {
  background: #3a2800;
  border: 1px solid #b45309;
  color: #fcd34d;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

/* ── Confirmation page sections ────────────────────── */

.confirm-section {
  background: #252525;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 1.25rem;
  margin-top: 1.5rem;
}

.confirm-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.confirm-actions form {
  flex: 0 1 auto;
}

.confirm-actions form button {
  margin: 0;
}

/* ── TOTP QR code ──────────────────────────────────── */

.totp-qr-container {
  display: inline-block;
  background: #fff;
  padding: 1rem;
  border-radius: 4px;
}

.totp-qr-image {
  display: block;
  width: 200px;
  height: 200px;
}
