/* COLOR VARIABLES */
:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b;
  --background-color: #f8fafc;
  --surface-color: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --heading-color: #334155;
  --table-header-bg: #f1f5f9;
  --shadow-light: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-medium: 0 4px 6px -1px rgb(0 0 0 / 0.1),
    0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-large: 0 20px 25px -5px rgb(0 0 0 / 0.1),
    0 8px 10px -6px rgb(0 0 0 / 0.1);
}

RESETS *,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    interpolate-size: allow-keywords;
  }
}

body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

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

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

p {
  text-wrap: pretty;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: balance;
}

#root,
#__next {
  isolation: isolate;
}

svg path {
  pointer-events: auto;
}

/* SETUP */

html {
  font-size: 62.5%;
}

body {
  font-size: 1.6rem;
}

/* GENERAL STYLES */

html,
body {
  height: 100%;
}

body > *:first-child.main-container {
  height: 100vh;
  width: clamp(700px, 60vw, 900px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body {
  font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  background-color: var(--background-color);
  color: var(--text-primary);
}

.icon {
  width: 1.5em;
  height: 1.5em;
  margin: 0 auto;
  fill: var(--text-secondary);
  opacity: 0.8;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon:hover {
  opacity: 1;
  fill: var(--primary-color);
}

.icon.check-icon,
.icon.uncheck-icon {
  width: 1.25em;
  height: 1.25em;
}

.icon.check-icon {
  fill: var(--success-color);
  opacity: 1;
}

.icon.delete-icon:hover {
  fill: var(--danger-color);
}

.button {
  padding: 0.2em 0.8em;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.button.button-text {
  border: none;
  background-color: transparent;
  font-weight: 500;
  color: var(--text-secondary);
}

.button.button-text:hover {
  color: var(--text-primary);
  background-color: var(--table-header-bg);
}

.button.button-outline {
  border: 1px solid var(--border-color);
  background-color: var(--surface-color);
  font-weight: 500;
  color: var(--primary-color);
  box-shadow: var(--shadow-light);
}

.button.button-outline:hover {
  border-color: var(--primary-color);
  background-color: var(--primary-color);
  color: var(--surface-color);
  box-shadow: var(--shadow-medium);
}

.button.icon-wrapper-button {
  padding: 0;
  border: none;
}

input[type="checkbox"] {
  transform: scale(1.125);
  margin: 0.125px;
  accent-color: var(--primary-color);
}

.modal-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.modal-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: none;
}

.table td:nth-child(1),
.table th:nth-child(1) {
  text-align: left;
}

.table td:nth-child(2),
.table td:nth-child(3),
.table th:nth-child(2),
.table th:nth-child(3) {
  text-align: left;
}

.table td:nth-child(4),
.table th:nth-child(4) {
  text-align: right;
}

.table td:nth-child(5),
.table td:nth-child(6),
.table th:nth-child(5),
.table th:nth-child(6) {
  text-align: center;
}

/* SPECIFIC STYLES */

.main-header {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1.6rem 0 2.4rem 0;
}

.main-header .primary-heading {
  font-size: 2.8rem;
  color: var(--heading-color);
}

.button.add-book-bar {
  padding: 1.6rem 0;
  border-color: var(--border-color);
  background-color: var(--surface-color);
  border-style: dashed;
}

.button.add-book-bar:hover {
  border-color: var(--primary-color);
  background-color: var(--table-header-bg);
}

.main-content {
  flex: 1;
  overflow-y: auto;
}

.main-content .table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--surface-color);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-medium);
}

.table .table-header {
  background-color: var(--table-header-bg);
}

.table .table-heading,
.table .table-data {
  border: 1px solid var(--border-color);
  padding: 0.4rem 1.2rem;
}

.table .table-heading {
  font-weight: 600;
  color: var(--text-primary);
  background-color: var(--table-header-bg);
}

.table .table-data {
  font-weight: 400;
  color: var(--text-primary);
  background-color: var(--surface-color);
}

.table .table-row:hover .table-data {
  background-color: var(--table-header-bg);
}

.aside .modal-dialog {
  border-radius: 12px;
  background-color: var(--surface-color);
  box-shadow: var(--shadow-large);
  padding: 2.8rem;
  border: 1px solid var(--border-color);
}

.modal-dialog .form {
  margin-top: 1.6rem;
  width: 100%;
}

.modal-dialog .form > .control-group {
  margin-bottom: 0.8rem;
}

.modal-dialog .form label {
  font-weight: 500;
  color: var(--text-primary);
}

.modal-dialog h2 {
  color: var(--heading-color);
}

.modal-dialog .form label:not(:last-of-type),
.modal-dialog .form input:not(input[type="checkbox"]) {
  display: block;
  width: clamp(250px, 30vw, 300px);
}

.modal-dialog .form input:not(input[type="checkbox"]) {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--surface-color);
  color: var(--text-primary);
  transition: border-color 0.2s ease;
}

.modal-dialog .form input:not(input[type="checkbox"]):focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.modal-dialog .form > .control-group:nth-last-of-type(2),
.modal-dialog .form .button-group {
  display: flex;
  align-items: center;
}

.modal-dialog .form > .control-group:nth-last-of-type(2) {
  justify-content: flex-start;
  gap: 0.8rem;
  margin: 1.6rem 0 2.4rem 0;

  & input[type="checkbox"] {
    margin-bottom: 1px;
  }
}

.modal-dialog .form .button-group {
  justify-content: flex-end;

  & .button-outline {
    margin-left: 0.4rem;
  }
}
