/* =================================
   BOOK TIIS - Main Stylesheet
   ================================= */

:root {
  --primary: #6c3df4;
  --primary-dark: #5125ce;
  --secondary: #ffb84d;
  --background: #f8f7fc;
  --surface: #ffffff;
  --text: #201b2d;
  --muted: #777386;
  --border: #e9e5f1;
  --radius: 16px;
  --shadow: 0 8px 28px rgba(38, 23, 75, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

/* HEADER */

header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

nav {
  width: min(1200px, 92%);
  min-height: 76px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.logo {
  color: var(--primary);
  font-size: 25px;
  font-weight: 900;
  letter-spacing: -1px;
}

nav ul,
.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}

nav a {
  transition: color 0.2s ease;
}

nav a:hover {
  color: var(--primary);
}

/* BUTTONS */

button,
.btn,
.button {
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  font-weight: 700;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

button:hover,
.btn:hover,
.button:hover {
  transform: translateY(-2px);
}

.btn-primary,
button[type="submit"] {
  background: var(--primary);
  color: white;
}

.btn-primary:hover,
button[type="submit"]:hover {
  background: var(--primary-dark);
  box-shadow: 0 6px 18px rgba(108, 61, 244, 0.2);
}

.btn-secondary {
  background: #f0eaff;
  color: var(--primary);
}

/* HERO SECTION */

.hero {
  width: min(1200px, 92%);
  margin: 36px auto;
  padding: 65px 48px;
  border-radius: 26px;
  background: linear-gradient(135deg, #6c3df4, #4220a8);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  overflow: hidden;
}

.hero h1 {
  max-width: 680px;
  font-size: clamp(32px, 5vw, 55px);
  line-height: 1.15;
  margin-bottom: 18px;
}

.hero p {
  max-width: 600px;
  color: #eee8ff;
  font-size: 17px;
  margin-bottom: 26px;
}

.hero .btn {
  display: inline-block;
  background: var(--secondary);
  color: #2b1b42;
}

/* MAIN CONTENT */

main,
.container {
  width: min(1200px, 92%);
  margin: 40px auto;
}

section {
  margin-bottom: 48px;
}

.section-title {
  margin-bottom: 22px;
}

.section-title h2,
section h2 {
  font-size: clamp(23px, 3vw, 32px);
  line-height: 1.3;
}

.section-title p {
  color: var(--muted);
  margin-top: 7px;
}

/* SEARCH AND FILTERS */

.search-bar,
.search-container {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px 0 28px;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar input,
.search-container input {
  flex: 1;
  min-width: 200px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 61, 244, 0.1);
}

/* BOOK GRID */

.book-grid,
#book-grid,
#books-container,
.books-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.book-card,
.book-item {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.book-card:hover,
.book-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(38, 23, 75, 0.13);
}

.book-card img,
.book-item img,
.book-cover {
  width: 100%;
  height: 250px;
  object-fit: cover;
  background: #eee9fa;
}

.book-card-content,
.book-info,
.book-details {
  padding: 17px;
}

.book-card h3,
.book-item h3 {
  font-size: 17px;
  line-height: 1.4;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.book-card p,
.book-item p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 9px;
}

.book-price,
.price {
  color: var(--primary);
  font-size: 19px;
  font-weight: 800;
  margin: 10px 0;
}

.book-card button,
.book-item button {
  width: 100%;
  margin-top: 8px;
}

/* FORMS AND LOGIN */

form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

form label {
  font-weight: 700;
  font-size: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.auth-container,
.auth-card,
.form-card {
  width: min(450px, 100%);
  margin: 35px auto;
  padding: 28px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-container h2,
.auth-card h2,
.form-card h2 {
  margin-bottom: 18px;
}

/* DIALOG / MODAL */

dialog,
.modal {
  border: none;
  border-radius: 18px;
  padding: 28px;
  width: min(460px, calc(100% - 30px));
  margin: auto;
  background: white;
  color: var(--text);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.2);
}

dialog::backdrop {
  background: rgba(20, 12, 39, 0.6);
  backdrop-filter: blur(3px);
}

dialog[open] {
  display: block;
}

.modal {
  display: none;
}

.modal.active {
  display: block;
}

/* STATUS MESSAGES */

.message,
#message,
#status-message {
  padding: 12px 15px;
  margin: 15px 0;
  border-radius: 10px;
  background: #f0eaff;
  color: var(--primary-dark);
  overflow-wrap: anywhere;
}

.error {
  background: #fff0f0;
  color: #b42318;
}

.success {
  background: #eafaf0;
  color: #167443;
}

/* EMPTY STATE */

.empty-state,
#empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  background: white;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* FOOTER */

footer {
  margin-top: 60px;
  padding: 35px 4%;
  background: #211638;
  color: white;
  text-align: center;
}

footer p {
  color: #d0c6e1;
  font-size: 14px;
  margin-top: 8px;
}

/* RESPONSIVE DESIGN */

@media (max-width: 900px) {
  .book-grid,
  #book-grid,
  #books-container,
  .books-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }

  .hero {
    padding: 45px 30px;
  }

  nav ul,
  .nav-links {
    gap: 14px;
  }
}

@media (max-width: 600px) {
  nav {
    min-height: 65px;
    flex-wrap: wrap;
    padding: 12px 0;
    gap: 12px;
  }

  .logo {
    font-size: 22px;
  }

  nav ul,
  .nav-links {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px 18px;
  }

  .hero {
    margin: 22px auto;
    padding: 35px 23px;
    border-radius: 18px;
  }

  .hero h1 {
    font-size: 34px;
  }

  .hero p {
    font-size: 15px;
  }

  main,
  .container {
    margin-top: 28px;
    margin-bottom: 28px;
  }

  .book-grid,
  #book-grid,
  #books-container,
  .books-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px;
  }

  .book-card img,
  .book-item img,
  .book-cover {
    height: 190px;
  }

  .book-card-content,
  .book-info,
  .book-details {
    padding: 12px;
  }

  .book-card h3,
  .book-item h3 {
    font-size: 15px;
  }

  .book-price,
  .price {
    font-size: 17px;
  }

  button,
  .btn,
  .button {
    padding: 10px 13px;
  }

  .auth-container,
  .auth-card,
  .form-card {
    padding: 20px;
  }
}

@media (max-width: 360px) {
  .book-grid,
  #book-grid,
  #books-container,
  .books-grid {
    grid-template-columns: 1fr;
  }

  .book-card img,
  .book-item img,
  .book-cover {
    height: 260px;
  }
}
