@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  --primary-color: #6c5ce7;
  --secondary-color: #a29bfe;
  --text-color: #2d3436;
  --light-bg: #f9f9f9;
  --border-radius: 12px;
  --box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

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

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  color: var(--text-color);
  min-height: 100vh;
  padding: 40px 0;
}

.container {
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
}

h1 {
  text-align: center;
  margin-bottom: 30px;
  color: var(--primary-color);
  font-size: 2.5rem;
  font-weight: 700;
  text-shadow: 0 2px 10px rgba(108, 92, 231, 0.2);
}

.search-container {
  margin-bottom: 30px;
}

#search-input {
  width: 100%;
  padding: 15px 20px;
  border: none;
  border-radius: var(--border-radius);
  background-color: white;
  box-shadow: var(--box-shadow);
  font-size: 1rem;
  transition: var(--transition);
}

#search-input:focus {
  outline: none;
  box-shadow: 0 10px 25px rgba(108, 92, 231, 0.2);
}

#books-table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  background-color: white;
}

#books-table th,
#books-table td {
  padding: 16px 20px;
  text-align: left;
  white-space: normal;
}

#books-table th {
  background-color: var(--primary-color);
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
}

#books-table tr:nth-child(even) {
  background-color: var(--light-bg);
}

#books-table tbody tr {
  transition: var(--transition);
}

#books-table tbody tr:hover {
  background-color: var(--secondary-color);
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(108, 92, 231, 0.3);
}

.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
}

.table-wrapper {
  position: relative;
  width: 100%;
}

/* Ustawienie kolumn na szerokich ekranach */
@media (min-width: 769px) {
  #books-table td:nth-child(1),
  #books-table th:nth-child(1) {
    width: 30%;
  }
  
  #books-table td:nth-child(2),
  #books-table th:nth-child(2) {
    width: 25%;
  }
  
  #books-table td:nth-child(3),
  #books-table th:nth-child(3) {
    width: 10%;
  }
  
  #books-table td:nth-child(4),
  #books-table th:nth-child(4) {
    width: 20%;
  }
  
  #books-table td:nth-child(5),
  #books-table th:nth-child(5) {
    width: 15%;
    text-align: center;
  }
}

/* Spinner i styl wyszukiwania */
.loading-spinner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  border-radius: var(--border-radius);
  /* Ustaw położenie tak, aby obejmowało całą tabelę */
  top: 0;
}

.table-searching {
  opacity: 0.6;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--secondary-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.hidden {
  display: none !important;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Modal */
.modal {
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: white;
  width: 80%;
  max-width: 600px;
  padding: 30px;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  position: relative;
  transform: translateY(-20px);
  transition: transform 0.3s ease;
}

.modal.show .modal-content {
  transform: translateY(0);
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  cursor: pointer;
  color: var(--primary-color);
  transition: var(--transition);
}

.close-modal:hover {
  color: #ff4757;
  transform: scale(1.2);
}

#modal-title {
  color: var(--primary-color);
  margin-bottom: 15px;
}

.description-container {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #eee;
}

.description-container h3 {
  color: var(--primary-color);
  margin-bottom: 10px;
}

.show-description-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: var(--transition);
}

.show-description-btn:hover {
  background-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 3px 8px rgba(108, 92, 231, 0.3);
}

/* Indykator ładowania */
.loading-indicator {
  padding: 15px;
  text-align: center;
  background-color: #f1f1f1;
  border-radius: var(--border-radius);
}

.loading-text {
  color: var(--primary-color);
  font-weight: 500;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

/* Responsywność */
@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }
  
  #books-table th,
  #books-table td {
    padding: 12px 15px;
    font-size: 0.9rem;
  }
  
  body {
    padding: 20px 0;
  }
  
  .table-container {
    margin-bottom: 20px;
  }
  
  .modal-content {
    width: 90%;
    padding: 20px;
  }
}

.book-cover-thumbnail {
  width: 50px;
  height: 70px;
  object-fit: cover;
  border-radius: 4px;
}

.modal-image {
    width: 150px;
    height: auto;
    float: left;
    margin-right: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
