/* styles.css */

/* Reset & base */
body {
  margin: 0;
  font-family: sans-serif;
}

/* Utility: visually hidden (for screen-reader labels) */
.visually-hidden {
  position: absolute;
  clip: rect(0 0 0 0);
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
}

/* Topbar container */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  background: #222;
  padding: 0.5rem 1rem;
  position: relative;
}

/* Hamburger toggle (hidden desktop) */
.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #fff;
  cursor: pointer;
  padding: 0.25rem;
  margin-right: 1rem;
}

/* Left group: logo */
.topbar-left {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
}

/* Center group: search */
.topbar-center {
  display: flex;
  flex: 1 1 auto;
  justify-content: center;
  margin-top: 0;
}

/* Right group: nav items */
.topbar-right {
  display: flex;
  justify-content: flex-end;
  flex: 1 1 auto;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.logo-icon {
  width: 32px;
  height: auto;
  margin-right: 0.5rem;
}
.logo-text {
  color: #fff;
  font-size: 1.25rem;
  font-weight: bold;
}

/* Search form */
.search-form {
  display: flex;
  align-items: center;
}
.search-form select,
.search-form input {
  height: 2.25rem;
  border: none;
  border-radius: 4px;
  margin-right: 0.25rem;
  padding: 0 0.5rem;
}
.search-form select {
  background: #333;
  color: #fff;
}
.search-form input {
  flex: 1;
}
.search-form button {
  background: #444;
  border: none;
  height: 2.25rem;
  padding: 0 0.75rem;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  color: #fff;
}
.search-form button:hover {
  background: #555;
}

/* Nav menu */
.menu {
  list-style: none;
  display: flex;
  margin: 0;
  padding: 0;
}
.menu-item {
  position: relative;
}
.menu-item > a {
  display: flex;
  align-items: center;
  color: #fff;
  text-decoration: none;
  padding: 0.5rem 0.75rem;
}
.menu-item > a i {
  margin-right: 0.5rem;
}
.menu-item > a .dropdown-icon {
  margin-left: 0.25rem;
  margin-right: 0;
}
.menu-item > a:hover {
  background: #333;
  border-radius: 4px;
}

/* Dropdown submenu */
.submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #333;
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  border-radius: 4px;
  white-space: nowrap;
  transition: opacity 0.1s ease-in-out;
  opacity: 0;
  z-index: 51;
  visibility: hidden;
}
.submenu.open,
.menu-item.dropdown:hover > .submenu {
  display: block;
  opacity: 1;
  visibility: visible;
}
.submenu li {
  border-bottom: 1px solid #444;
}
.submenu li:last-child {
  border-bottom: none;
}
.submenu li a {
  display: block;
  padding: 0.5rem 1rem;
  color: #fff;
  text-decoration: none;
}
.submenu li a:hover {
  background: #444;
}

.main-content {
	max-width: 90%;
	margin: 40px auto;
	padding: 0px 20px;
	box-sizing: border-box;
}

/* Responsive: mobile screens */
@media (max-width: 600px) {
  /* show hamburger */
  .hamburger {
    display: block;
  }
  
  .main-content {
	max-width: 95%;
	margin: 20px auto;
	padding: 0px 10px;
	box-sizing: border-box;
  }

  /* hide the full menu */
  .menu {
    flex-direction: column;
    display: none;
    width: 100%;
    background: #222;
    position: absolute;
    top: 100%;
    left: 0;
  }
  .menu.open {
    display: flex;
  }
  .menu-item {
    width: 100%;
  }
  .menu-item > a {
    padding: 1rem;
  }
  .submenu {
    position: relative;
    top: 0;
    left: 0;
  }
}

/* Customer form (mobile-first) */
.customer-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
  max-width: 500px;
  margin: 50px auto;
  background: #ffffff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.customer-form .form-group {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}
.customer-form label {
  font-weight: bold;
  margin-bottom: 5px;
}
.customer-form input,
.customer-form textarea,
.customer-form select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-sizing: border-box;
  margin-bottom: 15px;
  font-size: 1rem;
  appearance: none; /* OPTIONAL: Removes native dropdown arrows (for full custom styling) */
  background-color: #fff; /* Match input background */
}

.customer-form button {
  padding: 12px;
  background-color: #4CAF50;
  color: white;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s ease;
}
.customer-form button:hover {
  background-color: #45a049;
}

/* Two-column layout on desktop */
@media (min-width: 992px) {
  .customer-form {
    grid-template-columns: repeat(2, 1fr);
    max-width: 800px;
  }
  /* Ensure the button row spans both columns */
  .customer-form .form-group:last-child {
    grid-column: 1 / -1;
  }
}

/* Address display improvements */
.customer-header p {
  margin: 0.25rem 0;
  text-indent: 0.5rem; /* slight indent if it wraps */
  word-break: break-word; /* allow nice wrapping */
}

.customer-dashboard {
  max-width: 90%;
  margin: 2rem auto;
  padding: 1rem;
}

.customer-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.customer-header-top h2 {
  margin: 0;
  font-size: 2rem;
}

.header-buttons {
  display: flex;
  gap: 0.5rem;
}

.edit-customer-btn, .add-note-btn {
  background-color: #007bff;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.3s;
}

.edit-customer-btn:hover {
  background-color: #0056b3;
}

.add-note-btn {
  background-color: #28a745;
}

.add-note-btn:hover {
  background-color: #218838;
}

.customer-header-main {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}

.customer-info {
  flex: 1 1 45%;
}

.customer-notes {
  flex: 1 1 45%;
  background: #f9f9f9;
  padding: 1rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.customer-notes h3 {
  margin-top: 0;
}

.customer-notes p {
  white-space: pre-wrap;
}

/* Mobile stacking */
@media (max-width: 768px) {
  .customer-header-top {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }
  .edit-customer-btn {
    width: auto;
    margin-top: 0.5rem;
  }
  .customer-header-main {
    flex-direction: column;
  }
  .customer-info, .customer-notes {
    flex: 1 1 100%;
  }
}

.summary-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.summary-card {
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 8px;
  flex: 1 1 22%;
  margin: 0.5rem;
  padding: 1rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  text-align: center;
}

.summary-card h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.summary-value {
  font-size: 1.5rem;
  font-weight: bold;
}

.customer-activity {
  margin-top: 2rem;
}

.transactions-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
}

.transactions-table th, .transactions-table td {
  border: 1px solid #ddd;
  padding: 0.75rem;
  text-align: center;
}

.transactions-table tbody tr:nth-child(even) {
  background-color: #f5f5f5;
}

/* Responsive stacking */
@media (max-width: 768px) {
  .summary-cards {
    flex-direction: column;
  }
  .summary-card {
    flex: 1 1 100%;
  }
}

/* Optional: form-container styles (if used elsewhere) */
.form-container {
  max-width: 500px;
  margin: 50px auto;
  background: #fff;
  padding: 30px;
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
  border-radius: 8px;
}
.form-container h1,
.form-container h2 {
  text-align: center;
  margin-bottom: 20px;
}
.form-container form {
  display: flex;
  flex-direction: column;
}
.form-container input,
.form-container button {
  padding: 12px;
  margin-bottom: 15px;
  border: 1px solid #ccc;
  border-radius: 5px;
}
.form-container button {
  background-color: #007bff;
  color: white;
  font-weight: bold;
  border: none;
  cursor: pointer;
}
.form-container button:hover {
  background-color: #0056b3;
}
.form-container p {
  text-align: center;
}

/* Customer Note Edit Modal */
/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 999;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  position: relative;
  animation: modalFade 0.3s ease-in-out;
}

@keyframes modalFade {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.close-button {
  position: absolute;
  right: 1rem;
  top: 1rem;
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-save-btn {
  background-color: #28a745;
  color: #fff;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.modal-save-btn:hover {
  background-color: #218838;
}

/* Previous notes, timeline */
.customer-notes-history {
  margin-top: 2rem;
}

.timeline {
  position: relative;
  padding-left: 1.5rem;
  margin-top: 1rem;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0.5rem;
  width: 2px;
  height: 100%;
  background: #ccc;
}

.timeline-item {
  position: relative;
  margin-bottom: 1.5rem;
}

.timeline-dot {
  position: absolute;
  top: 0.2rem;
  left: -0.1rem;
  width: 10px;
  height: 10px;
  background: #007bff;
  border-radius: 50%;
}

.timeline-content {
  background: #f9f9f9;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.timeline-date {
  font-size: 0.9rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timeline-text {
  font-size: 0.95rem;
  white-space: pre-wrap;
}

/* Toast Messages */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 10px 20px;
  border-radius: 6px;
  color: white;
  font-weight: bold;
  animation: fadeOut 4s forwards;
  opacity: 1;
  min-width: 200px;
  text-align: center;
}

.toast-success {
  background-color: #28a745;
}

.toast-error {
  background-color: #dc3545;
}

@keyframes fadeOut {
  0% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-20px); }
}

/* Results Tables */
.results-table {
  width: 100%;
  margin: 20px auto;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.results-table thead th {
  background: #333;
  color: #fff;
  padding: 12px 10px;
  text-align: left;
  border-radius: 0 !important;
}

/* Round top-left corner of the second (visible) column */
table.results-table thead tr th:nth-of-type(2) {
  border-top-left-radius: 6px !important;
}

/* Round top-right corner of the last visible column */
table.results-table thead tr th:last-of-type {
  border-top-right-radius: 6px !important;
}

/* Optional: make header background darker for contrast */
table.results-table thead {
  background-color: #333;
  color: white;
}

.results-table tbody tr {
  background: #f9f9f9;
  cursor: pointer;
}

.results-table tbody tr:hover {
  background: #f1f1f1;
}

.results-table tbody td {
  padding: 10px;
  border-bottom: 1px solid #e0e0e0;
}

.results-table tbody tr:last-child td {
  border-bottom: none;
}

/* If there's a single cell for "no results" */
.results-table tbody tr td[colspan] {
  text-align: center;
  font-style: italic;
  color: #777;
}

/* Back button for Books */
.back-button {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 8px 16px;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
}
.back-button:hover {
  background-color: #0056b3;
}

/* Add padding/margin around the top controls */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  margin-bottom: 10px;
  margin-top: 10px;
}

/* Add spacing between the dropdown and the search box */
.dataTables_wrapper .dataTables_length {
  margin-right: 20px;
}

.dataTables_wrapper .dataTables_filter {
  float: right;
}

/* Fix the sizing and spacing of the "Show entries" dropdown */
.dataTables_wrapper select {
  padding: 6px 10px;
  font-size: 14px;
}

/* Remove rounding from all headers */
table.dataTable thead th {
  border-radius: 0 !important;
}

/* Round top-left corner of the second (visible) column */
table.dataTable thead tr th:nth-of-type(2) {
  border-top-left-radius: 6px !important;
}

/* Round top-right corner of the last visible column */
table.dataTable thead tr th:last-of-type {
  border-top-right-radius: 6px !important;
}

/* Optional: make header background darker for contrast */
table.dataTable thead {
  background-color: #333;
  color: white;
}

.edit-customer-form {
  max-width: 700px;
  margin: 2rem auto;
  padding: 1rem;
  background: #f8f8f8;
  border: 1px solid #ccc;
  border-radius: 8px;
}

.edit-customer-form .form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.edit-customer-form label {
  flex: 1 1 300px;
  display: flex;
  flex-direction: column;
  font-weight: bold;
  font-size: 0.95rem;
}

.edit-customer-form input,
.edit-customer-form textarea {
  margin-top: 4px;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.95rem;
}

.edit-customer-form textarea {
  resize: vertical;
  min-height: 80px;
}

.edit-customer-form .form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.edit-customer-form button {
  padding: 10px 16px;
  background-color: #0069d9;
  border: none;
  color: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.95rem;
}

.edit-customer-form button:hover {
  background-color: #0053ba;
}

.edit-customer-form .cancel-link {
  color: #6c757d;
  text-decoration: none;
  font-size: 0.95rem;
}

.edit-customer-form .cancel-link:hover {
  text-decoration: underline;
}

/* Form error validation */
.form-error {
  color: red;
  font-size: 0.85rem;
  margin-top: 4px;
}

input:invalid, textarea:invalid {
  border-color: red;
}

.form-success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
  padding: 10px 16px;
  margin-bottom: 1rem;
  border-radius: 4px;
  font-size: 0.95rem;
}

.activate-btn {
  background-color: #28a745;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.activate-btn:hover {
  background-color: #218838;
}

.deactivate-btn {
  background-color: #dc3545;
  color: white;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 1rem;
}
.deactivate-btn:hover {
  background-color: #c82333;
}

.book-page-container {
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 768px) {
  .book-page-container {
    max-width: 1100px;
    padding-left: 2rem;
  }
}


.book-details-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .book-details-container {
    flex-direction: row;
    align-items: flex-start;
  }
}

.book-cover {
  flex: 0 0 auto;
  max-width: 250px;
  width: 100%;
}

.book-cover img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  margin-left: 9px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.book-info {
  flex: 1;
  padding-left: 0;
}

@media (min-width: 768px) {
  .book-info {
    padding-left: 2rem;
  }
}

.book-info p {
  margin: 0.5rem 0;
}

.book-info strong {
  display: inline-block;
  width: 100px;
}

.floating-cart {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 300px;
  background: white;
  border: 1px solid #ccc;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  z-index: 9999;
  font-family: sans-serif;
  transition: transform 0.3s ease;
}

.floating-cart.minimized .cart-body {
  display: none;
}

.cart-header {
  background: #f0f0f0;
  padding: 10px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}

.cart-body {
  padding: 10px;
}

.checkout-btn {
  display: block;
  margin-top: 10px;
  background: #28a745;
  color: white;
  padding: 8px;
  text-align: center;
  border-radius: 6px;
  text-decoration: none;
}
