/* =====================================================================
   ParadiddleCharts stylesheet
   Edit this file to change how the whole site looks.
   (For a quick recolour, just set SITE_THEME in .env, see READY-MADE THEMES.)

   After editing on the server, run:   sudo docker compose restart
   then hard-refresh your browser (Ctrl+Shift+R).

   Sections
     1. Colours, fonts and sizes   <-- start here
     2. Page basics
     3. Header / top bar
     4. Cards, text and badges
     5. Buttons and form fields (and the search / filter bar)
     6. Messages (green / red / yellow banners)
     7. Chart rows (browse page) and difficulty tags
     8. Chart page
     9. Profile page
    10. Upload and reupload boxes
    11. Small helper classes
   ===================================================================== */


/* ---------------------------------------------------------------------
   1. COLOURS, FONTS AND SIZES
   Change these and almost everything on the site follows.
   --------------------------------------------------------------------- */
:root {
  /* Main colours */
  --bg:            #14161a;   /* page background */
  --card:          #1e2128;   /* boxes, top bar */
  --text:          #e8e8ea;   /* normal text */
  --mute:          #9aa0aa;   /* faded / secondary text */
  --accent:        #ff7a29;   /* links, buttons, badges (the orange) */
  --accent-text:   #000000;   /* text written ON the accent colour */

  /* Form fields */
  --field-bg:      #101216;
  --border:        #333333;
  --border-strong: #3a3f4a;   /* dashed upload boxes */

  /* Messages and status colours */
  --good:          #5fd068;
  --good-bg:       #25402b;
  --warn:          #f2c94c;
  --warn-bg:       #4a3f1c;
  --bad:           #ff6b6b;
  --bad-bg:        #4a2323;

  /* Difficulty tags */
  --easy:          #5fd068;
  --medium:        #f2c94c;
  --hard:          #f2994a;
  --expert:        #eb5757;

  /* Shape and layout */
  --font:          system-ui, sans-serif;
  --font-size:     16px;
  --page-width:    1500px;     /* width of the main content column */
  --radius:        10px;      /* boxes */
  --radius-small:  6px;       /* buttons, fields, badges */
  --search-min-width: 180px;  /* the search box never shrinks below this; below that the bar wraps */
}

/* ---------------------------------------------------------------------
   READY-MADE THEMES
   Pick one by setting  SITE_THEME=purple  in your .env file, then run
       sudo docker compose up -d
   Available: orange (the default above), purple, blue, green.

   To make your own: copy one block below, rename "theme-purple" to
   "theme-mine", change the colours, and set  SITE_THEME=mine
   --------------------------------------------------------------------- */
html.theme-purple {
  --bg: #16121e;  --card: #221b30;  --text: #ece8f5;  --mute: #a198b8;
  --accent: #b57bff;  --field-bg: #110d19;  --border: #3a3150;  --border-strong: #4a4066;
}

html.theme-blue {
  --bg: #0e1420;  --card: #18213a;  --text: #e6ebf5;  --mute: #8d9ab8;
  --accent: #4f9dff;  --field-bg: #0b1020;  --border: #2c3858;  --border-strong: #3a4870;
}

html.theme-green {
  --bg: #111713;  --card: #1b251e;  --text: #e6efe8;  --mute: #93a597;
  --accent: #4ccf7a;  --field-bg: #0d130f;  --border: #2c3a30;  --border-strong: #3a4c3f;
}

/* NOTE on light themes: chart descriptions bring their own colours
   (set by each charter), so a light theme can make some descriptions
   look odd. Dark themes are safest. */


/* ---------------------------------------------------------------------
   2. PAGE BASICS
   --------------------------------------------------------------------- */
* {
  box-sizing: border-box;
}

html {
  background: var(--bg);        /* fills the whole window, even on short pages */
  color-scheme: dark;
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font: var(--font-size)/1.5 var(--font);
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--accent);
}

main {
  max-width: var(--page-width);
  margin: 24px auto;
  padding: 0 16px;
}


/* ---------------------------------------------------------------------
   3. HEADER / TOP BAR
   --------------------------------------------------------------------- */
header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 24px;
  background: var(--card);
}

header .brand {
  font-size: 1.2em;
  font-weight: 700;
  text-decoration: none;
}

header .spacer {
  flex: 1;                      /* pushes the links after it to the right */
}


/* ---------------------------------------------------------------------
   4. CARDS, TEXT AND BADGES
   --------------------------------------------------------------------- */
.card {
  margin-bottom: 12px;
  padding: 14px 18px;
  background: var(--card);
  border-radius: var(--radius);
}

.mute {
  color: var(--mute);
  font-size: .9em;
}

.err {
  color: var(--bad);
}

.badge {                        /* "verified", "pending" labels */
  padding: 1px 7px;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: var(--radius-small);
  font-size: .75em;
  font-weight: 700;
}


/* ---------------------------------------------------------------------
   5. BUTTONS AND FORM FIELDS
   --------------------------------------------------------------------- */
input, select, textarea, button {
  font: inherit;
  padding: 8px;
  background: var(--field-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
}

button, .btn {
  display: inline-block;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--accent-text);
  border: 0;
  border-radius: var(--radius-small);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

/* A button that looks like a plain text link (e.g. "Log out", "delete") */
.link {
  padding: 0;
  background: none;
  color: var(--mute);
  font-weight: 400;
  text-decoration: underline;
}

form.inline {
  display: inline;
}

/* Forms inside the page (login, sign-up, profile, report...) */
main form p {
  margin: 0 0 12px;
}

main form label {
  display: block;
  margin-bottom: 4px;
}

main form input[type=text],
main form input[type=email],
main form input[type=password],
main form textarea {
  width: 100%;
  max-width: 420px;
}

main form .helptext,
main form ul.errorlist {
  font-size: .85em;
}

main ul.errorlist {
  margin: 4px 0;
  padding: 0;
  list-style: none;
  color: var(--bad);
}

/* --- Search and filter bar (front page and charter profiles) ---
   Layout:  [ search box (grows) ] [ difficulty ] [ sort ] [ verified ] [ Filter ]
   The search box takes all the space the other items leave over, so the Filter
   button stays at the far right. On narrow screens the items wrap onto more lines. */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

main form.filter-bar .search {
  flex: 1 1 var(--search-min-width);   /* grow to fill the free space */
  width: auto;
  min-width: 0;
  max-width: none;                      /* overrides the 420px limit on other text boxes */
}

main form.filter-bar label {            /* "Verified charters only" */
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  white-space: nowrap;
}

main form.filter-bar input[type=checkbox] {
  width: auto;
  padding: 0;
}

.filter-bar select,
.filter-bar button {
  flex: none;
}

/* When the site runs without email, hide "Forgot your password?" */
.no-email #id_password_helptext {
  display: none;
}


/* ---------------------------------------------------------------------
   6. MESSAGES  (green = success, yellow = warning, red = error)
   --------------------------------------------------------------------- */
.msg {
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--good-bg);
  border-radius: 8px;
}

.msg.warning {
  background: var(--warn-bg);
}

.msg.error {
  background: var(--bad-bg);
}


/* ---------------------------------------------------------------------
   7. CHART ROWS (browse page) AND DIFFICULTY TAGS
   --------------------------------------------------------------------- */
.row {                          /* picture on the left, text on the right */
  display: flex;
  align-items: center;
  gap: 14px;
}

img.thumb {                     /* small cover image in a chart row */
  flex: none;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-small);
}

.diff {
  padding: 1px 7px;
  color: #000;
  border-radius: var(--radius-small);
  font-size: .75em;
  font-weight: 700;
}

.diff.easy   { background: var(--easy); }
.diff.medium { background: var(--medium); }
.diff.hard   { background: var(--hard); }
.diff.expert { background: var(--expert); }


/* The line above the list: the chart count on the left, the "Infinite scroll" switch on the right */
.list-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
}

.list-info p {
  margin: 0;
}

label.infinite-option {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--mute);
  font-size: .9em;
  cursor: pointer;
}

label.infinite-option[hidden] {
  display: none;
}

#infinite-status {              /* "Showing 40 of 300 charts" under the list */
  margin: 12px 0 24px;
  text-align: center;
}

/* While infinite scroll is switched on, the page numbers aren't needed */
.infinite-on .pagination {
  display: none;
}

/* Page numbers under the list: Prev 1 2 [3] 4 ... 12 Next */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 18px 0;
}

.pagination a,
.pagination .current {
  min-width: 36px;
  padding: 6px 10px;
  border-radius: var(--radius-small);
  text-align: center;
  text-decoration: none;
}

.pagination a {
  background: var(--card);
}

.pagination a:hover {
  background: var(--accent);
  color: var(--accent-text);
}

.pagination .current {          /* the page you're on */
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}

.pagination .gap {              /* the "..." between number groups */
  padding: 0 4px;
  color: var(--mute);
}


/* ---------------------------------------------------------------------
   8. CHART PAGE
   --------------------------------------------------------------------- */
img.cover-large {               /* big cover image at the top of a chart */
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
}

/* The charter's description. Its own colours come from the chart file. */
.desc {
  margin: 12px 0;
  overflow-x: auto;
}

.desc figure {
  margin: 10px 0;
}

.desc td,
.desc th {
  vertical-align: top;
}


/* ---------------------------------------------------------------------
   9. PROFILE PAGE
   --------------------------------------------------------------------- */
.stats {                        /* "charts / downloads / average rating" */
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin-top: 12px;
}

.stats div {
  display: flex;
  flex-direction: column;
}

.stats b {
  font-size: 1.4em;
}


/* ---------------------------------------------------------------------
   10. UPLOAD AND REUPLOAD BOXES
   --------------------------------------------------------------------- */
.dropzone {                     /* the dashed "drop files here" box */
  display: block;
  padding: 36px 16px;
  background: var(--card);
  border: 2px dashed var(--border-strong);
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
}

.dropzone:hover,
.dropzone:focus,
.dropzone.over {                /* .over = while a file is dragged above it */
  border-color: var(--accent);
  outline: none;
}

.bar {                          /* progress bar track */
  height: 5px;
  margin-top: 6px;
  background: var(--field-bg);
  border-radius: 3px;
  overflow: hidden;
}

.bar > div {                    /* progress bar fill */
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width .2s;
}

/* One row per file in the batch uploader */
.job {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--card);
  border-left: 4px solid transparent;
  border-radius: 8px;
}

.job .top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.job .name {
  word-break: break-all;
}

.job .st {                      /* the status text under the file name */
  color: var(--mute);
  font-size: .9em;
}

.job.done                { border-left-color: var(--good); }
.job.done .bar > div     { background: var(--good); }
.job.failed              { border-left-color: var(--expert); }
.job.failed .st          { color: var(--bad); }
.job.skipped             { border-left-color: var(--warn); }


/* ---------------------------------------------------------------------
   11. SMALL HELPER CLASSES (used in the page templates)
   --------------------------------------------------------------------- */
.flush        { margin: 0; }
.flush-bottom { margin-bottom: 0; }
.space-top    { margin-top: 8px; }
.space-top-lg { margin-top: 12px; }
