/* ==========================================================
   Screen Lounge – Global Styles
   ========================================================== */

:root {

  --bg: #f4f6fa;
  --surface: #ffffff;

  --border: #d8deea;

  --text: #202736;
  --muted: #6b7280;

  --primary: #2557d6;
  --primary-hover: #1b45ad;

  --danger: #c0392b;

  --radius: 10px;

  --shadow:
      0 4px 18px rgba(0,0,0,.08);

  --content-width: 1200px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {

  margin: 0;

  background: var(--bg);

  color: var(--text);

  font-family:
      "Segoe UI",
      Roboto,
      Arial,
      sans-serif;

  line-height: 1.5;
}



/* ==========================================================
   Typography
   ========================================================== */

h1 {
  font-size: 2.1rem;
  margin: 0;
}

h2 {
  font-size: 1.55rem;
  margin-top: 2rem;
}

h3 {
  font-size: 1.15rem;
}

p,
li,
td,
th,
button,
input,
select,
textarea,
a {
  font-size: 1rem;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}



/* ==========================================================
   Main Layout
   ========================================================== */

body > div,
.salutation {

  max-width: var(--content-width);

  margin-left: auto;
  margin-right: auto;
}

#main_form {

  max-width: var(--content-width);

  margin: auto;

  padding:
      1rem
      1.5rem
      3rem;
}



/* ==========================================================
   Navigation
   ========================================================== */

.topnav {

  background: white;

  padding: 1rem;

  box-shadow: var(--shadow);

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

.topnav form {

  display: flex;

  flex-wrap: wrap;

  gap: .75rem;
}



/* ==========================================================
   Welcome Section
   ========================================================== */

.salutation {

  margin-top: 1.5rem;

  padding: 1.25rem;

  background: white;

  border-radius: var(--radius);

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

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



/* ==========================================================
   Buttons
   ========================================================== */

button,
input[type="submit"] {

  border: none;

  border-radius: 8px;

  padding:
      .7rem
      1rem;

  background:
      var(--primary);

  color: white;

  cursor: pointer;

  transition:
      .15s;
}

button:hover,
input[type="submit"]:hover {

  background:
      var(--primary-hover);
}

button:active {
  transform:
      translateY(1px);
}



/* ==========================================================
   Inputs
   ========================================================== */

input:not([type="submit"]),
select,
textarea {

  width: 100%;

  max-width: 550px;

  padding: .7rem;

  border-radius: 8px;

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

  background: white;
}

textarea {
  min-height: 120px;
}



/* ==========================================================
   Django form.as_div support
   ========================================================== */

#main_form > div,
#main_form > fieldset,
#main_form > section {

  background: white;

  padding: 1.5rem;

  border-radius: var(--radius);

  box-shadow: var(--shadow);

  margin-bottom: 1.5rem;
}

#main_form label {

  display: block;

  font-weight: 600;

  margin-bottom: .35rem;
}

#main_form div:has(> label) {
  margin-bottom: 1rem;
}



/* ==========================================================
   Admin / Editor Function Links
   ========================================================== */

h2 + a,
h2 + a + a,
h2 + a + a + a {

  display: inline-flex;

  align-items: center;

  min-height: 42px;

  margin-right: .6rem;

  margin-bottom: .8rem;

  padding:
      .65rem
      1rem;

  background: white;

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

  border-radius: 8px;

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



/* ==========================================================
   Search Buttons
   ========================================================== */

#search_clear {

  display: flex;

  gap: .75rem;

  align-items: center;

  margin-top: 1rem;
}

#search_clear input {
  width: auto;
}



/* ==========================================================
   Pagination
   ========================================================== */

#page_nav {

  display: flex;

  flex-wrap: wrap;

  gap: .75rem;

  justify-content: center;

  align-items: center;

  margin-top: 1.5rem;

  padding-top: 1rem;
}

#page_nav > div {

  display: flex;

  gap: .75rem;

  align-items: center;
}

#page_nav select {
  width: auto;
}



/* ==========================================================
   Tables
   ========================================================== */

table {

  width: 100%;

  border-collapse: collapse;

  background: white;

  border-radius: var(--radius);

  overflow: hidden;

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

th {

  background:
      #eef3ff;

  text-align: left;
}

th,
td {

  padding: 1rem;

  vertical-align: top;

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

td:first-child {

  white-space: nowrap;
}

td button {

  margin-right: .5rem;

  margin-bottom: .5rem;
}



/* ==========================================================
   Result Summary
   ========================================================== */

#resultOverview {

  padding: 1rem;

  background: white;

  border-left:
      5px solid var(--primary);

  border-radius: 8px;
}



/* ==========================================================
   Dialogs
   ========================================================== */

dialog {

  border: none;

  border-radius: 14px;

  padding: 1.5rem;

  width: 500px;

  max-width: 90vw;

  box-shadow:
      0 30px 70px rgba(0,0,0,.35);
}

dialog::backdrop {

  background:
      rgba(0,0,0,.55);

  backdrop-filter:
      blur(2px);
}

.dialog-actions {

  display: flex;

  justify-content: flex-end;

  gap: .75rem;

  margin-top: 1rem;
}



/* ==========================================================
   Messages / Errors
   ========================================================== */

ul {

  padding-left: 1.25rem;
}

p[autofocus] {

  background:
      #fff3cd;

  padding: 1rem;

  border-radius: 8px;
}



/* ==========================================================
   Login Page
   ========================================================== */

body:not(:has(nav)) {

  min-height: 100vh;

  display: flex;

  flex-direction: column;

  justify-content: center;

  align-items: center;

  padding: 2rem;
}

body:not(:has(nav)) form {

  background: white;

  width: 460px;

  max-width: 100%;

  padding: 2rem;

  border-radius: var(--radius);

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



/* ==========================================================
   Mobile
   ========================================================== */

@media (max-width: 800px) {

  h1 {
    font-size: 1.6rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  .topnav form,
  #search_clear,
  #page_nav {

    flex-direction: column;

    align-items: stretch;
  }

  td:first-child {
    white-space: normal;
  }

  table {

    display: block;

    overflow-x: auto;
  }
}
