/* ============================================================
   BIBLIOTECA FEDERICI — style.css
   ============================================================ */

/* === Reset & Body === */
body {
  font-family: "Segoe UI", sans-serif;
  background-color: #f7f7f7;
  background-image: url('../images/LogoBibliorici_2.png');
  background-repeat: no-repeat;
  background-position: center center;
  background-attachment: fixed;
  background-size: 500px auto;
  color: #333;
  margin: 0;
  padding: 0;
}

/* Watermark semitrasparente */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(247, 247, 247, 0.75);
  pointer-events: none;
  z-index: 0;
}

/* Tutto sopra il watermark */
header, nav, main, .container, .form-container, .cards-grid,
table, footer, h1, h2, h3, p, form, div {
  position: relative;
  z-index: 1;
}

/* === Glass mixin (applicato a tutti i box) === */
.glass {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* === Header === */
header {
  background-color: #003366;
  color: white;
  text-align: center;
  padding: 10px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

header img {
  height: 280px;
  width: auto;
  vertical-align: middle;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* === Nav === */
nav {
  background-color: #004080;
  text-align: center;
  padding: 10px;
}

nav a {
  color: white;
  text-decoration: none;
  margin: 0 15px;
  font-weight: bold;
}

nav a:hover { text-decoration: underline; }

/* === Tipografia === */
h1 { margin: 0; font-size: 1.8rem; letter-spacing: 1px; }

h2, h3 {
  text-align: center;
  color: #2a5d84;
  margin-top: 30px;
}

/* === Container generico === */
.container {
  max-width: 1000px;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  margin: 30px auto;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Container login (più stretto) */
.container.login-box {
  max-width: 450px;
  margin: 50px auto;
  text-align: center;
}

/* Container descrizione libro */
.container.descrizione-box {
  max-width: 800px;
  margin: 40px auto;
}

/* === test) === */
/*.box {
  display: inline-block;
  margin-top: 80px;
  padding: 35px 40px;
  border: 1px solid #ccc;
  border-radius: 10px;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  text-align: left;
  min-width: 320px;
}
/* test */

/* === Box centrato (login, forgot, reset) === */
.box {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 50px auto 0;
  padding: 35px 40px;
  border: 1px solid #ccc;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  text-align: center;
  min-width: 320px;
  max-width: 500px;
}

.box h2 { text-align: center; color: #2a5d84; margin-bottom: 20px; }

/* === Form generico === */
form label {
  display: block;
  margin-top: 10px;
  font-weight: bold;
}

form input, form textarea, form select {
  width: 100%;
  padding: 8px;
  margin-top: 5px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 15px;
  box-sizing: border-box;
}

form textarea { resize: vertical; }

form button, button {
  background-color: #004080;
  color: white;
  padding: 10px 15px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 15px;
  font-size: 15px;
}

form button:hover, button:hover { background-color: #0059b3; }

/* Form inline login */
.login-form input { margin: 10px; padding: 8px; width: 220px; }
.login-form button { padding: 8px 15px; margin-top: 0; }

/* Form verticale login (index.php) */
.container.login-box form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
}

.container.login-box form label {
  text-align: left;
  margin-top: 10px;
}

.container.login-box form input {
  width: 100%;
  box-sizing: border-box;
}

.container.login-box form button {
  margin-top: 15px;
}

.container.login-box .link-reset {
  text-align: center;
  display: block;
  margin-top: 12px;
}

/* === Form container (inserisci libro) === */
.form-container {
  width: 60%;
  margin: 50px auto;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 30px 40px;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

.form-container h2 { text-align: center; margin-bottom: 20px; }
.form-container form { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 30px; }
.form-container .buttons { grid-column: span 2; text-align: center; margin-top: 10px; }
.form-container button { background-color: #2a5d84; margin: 5px; }
.form-container button:hover { background-color: #1c3f5c; }
.form-container button.reset { background-color: #888; }
.form-container button.reset:hover { background-color: #666; }
.qty-hint { font-size: 12px; color: #666; margin-top: 3px; }

/* === Tabelle === */
table {
  border-collapse: collapse;
  width: 95%;
  margin: 20px auto;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  border-radius: 10px;
  overflow: hidden;
}

th, td {
  border: 1px solid #ddd;
  padding: 10px;
  text-align: center;
}

th { background: #004080; color: white; }

tr:nth-child(even) { background: rgba(238,242,247,0.5); }

.col-titolo { width: 35%; text-align: left; white-space: normal; word-wrap: break-word; }

/* === Badges === */
.badge-disp { background: #28a745; color: white; border-radius: 10px; padding: 2px 8px; font-size: 13px; }
.badge-esau { background: #d9534f; color: white; border-radius: 10px; padding: 2px 8px; font-size: 13px; }
.badge-part { background: #f0ad4e; color: white; border-radius: 10px; padding: 2px 8px; font-size: 13px; }

/* === Bottoni azione === */
.btn-desc     { padding: 6px 12px; background: #28a745; color: white; border-radius: 5px; text-decoration: none; border: none; cursor: pointer; }
.btn-desc:hover { background: #218838; }
.btn-delete   { padding: 6px 12px; background: #d9534f; color: white; border: none; border-radius: 5px; cursor: pointer; margin: 20px auto; display: block; }
.btn-delete:hover { background: #c9302c; }
.btn-presta   { padding: 10px 20px; background: #2a5d84; color: white; border: none; border-radius: 6px; cursor: pointer; display: block; margin: 0 auto; }
.btn-presta:hover { background: #1c3f5c; }
.btn-restituisci { padding: 5px 10px; background: #c0392b; color: white; border: none; border-radius: 5px; cursor: pointer; }
.btn-restituisci:hover { background: #922b21; }
.btn-back     { display: inline-block; margin-top: 20px; background: #0066cc; color: white; padding: 10px 20px; border-radius: 5px; text-decoration: none; }
.btn-back:hover { background: #004c99; }
.reset-btn    { background-color: #c0392b !important; }
.reset-btn:hover { background-color: #922b21 !important; }

/* Bottoni gestione utenti */
.btn       { padding: 6px 10px; border-radius: 6px; border: none; cursor: pointer; }
.btn-blue  { background: #2a5d84; color: white; }
.btn-red   { background: #c0392b; color: white; }

/* === Quantità copie +/- === */
.qty-form    { display: inline-flex; gap: 4px; align-items: center; justify-content: center; }
.qty-display { min-width: 28px; text-align: center; font-weight: bold; font-size: 15px; }
.btn-qty     { width: 28px; height: 28px; border: none; border-radius: 50%; cursor: pointer; font-size: 16px; font-weight: bold; line-height: 1; margin-top: 0; padding: 0; }
.btn-minus   { background: #e74c3c; color: white; }
.btn-minus:hover:not(:disabled) { background: #c0392b; }
.btn-plus    { background: #27ae60; color: white; }
.btn-plus:hover { background: #219a52; }
.btn-qty:disabled { background: #ccc; cursor: not-allowed; }

/* === Paginazione === */
.pagination { text-align: center; margin: 20px 0; }
.pagination a { padding: 8px 12px; margin: 0 4px; border: 1px solid #0066cc; color: #0066cc; text-decoration: none; border-radius: 5px; }
.pagination a.active, .pagination a:hover { background: #0066cc; color: white; }

/* === Cards home === */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  max-width: 1100px;
  margin: 30px auto;
  padding: 10px;
  justify-items: center;
  justify-content: center;
  text-align: center;
  align-items: stretch;
}

.card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  min-height: 90px;
  background: rgba(238,242,247,0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #003366;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-align: center;
}

.card:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,0.12); }

/* === Stats === */
.stats {
  margin-top: 30px;
  padding: 15px;
  background: rgba(240,246,255,0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 10px;
}

/* === Descrizione libro === */
.book-header { display: flex; align-items: flex-start; gap: 25px; margin-bottom: 25px; flex-wrap: wrap; }
.book-header img { width: 150px; height: auto; border-radius: 8px; box-shadow: 0 0 8px rgba(0,0,0,0.2); }
.book-details { flex: 1; min-width: 200px; }
.book-details h2 { color: #0066cc; margin: 0 0 8px; text-align: left; }
.book-details h4 { color: #333; margin: 0 0 12px; font-weight: normal; font-size: 16px; }
.book-details .meta { margin-bottom: 5px; font-size: 14px; }
.descr {
  text-align: justify;
  line-height: 1.7em;
  color: #444;
  background: rgba(249,249,249,0.85);
  padding: 15px;
  border-radius: 8px;
  border-left: 4px solid #0066cc;
  margin-top: 15px;
}

/* === Prestiti === */
.prestito-box {
  width: 60%;
  max-width: 500px;
  margin: 30px auto;
  padding: 20px;
  border: 1px solid #ccc;
  border-radius: 10px;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.prestito-box label { font-weight: bold; display: block; margin-bottom: 5px; }
.prestito-box input, .prestito-box select { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 5px; margin-bottom: 15px; }

/* === Form ricerca === */
form.ricerca { text-align: center; margin: 20px auto; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
form.ricerca input { padding: 8px; border: 1px solid #ccc; border-radius: 5px; width: 180px; margin-top: 0; }
form.ricerca button { padding: 8px 15px; margin-top: 0; height: 38px; }

/* === Form gestione utenti === */
.form-inline { display: flex; gap: 8px; align-items: center; }
.form-inline input[type="text"] { width: 220px; }
.select-role { padding: 6px; border-radius: 6px; }

/* === Messaggi === */
.success, .msg-ok  { color: #27ae60; font-weight: bold; text-align: center; margin-bottom: 15px; }
.error,   .msg-err { color: #c0392b; font-weight: bold; text-align: center; margin-bottom: 15px; }
.errore   { color: red; }
.message  { color: red; margin-bottom: 10px; }
.back     { display: block; text-align: center; margin-top: 15px; color: #2a5d84; text-decoration: none; font-size: 14px; }
.back:hover { text-decoration: underline; }
.link-reset { display: block; margin-top: 14px; font-size: 14px; color: #2a5d84; text-decoration: none; }
.link-reset:hover { text-decoration: underline; }

/* === Popup === */
.popup { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); align-items: center; justify-content: center; z-index: 2000; }
.popup .box { background: rgba(255,255,255,0.92); padding: 20px 26px; border-radius: 10px; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,0.2); max-width: 520px; }
.popup .box.error { border-left: 6px solid #d9534f; }
.popup .box h3 { margin: 0 0 8px; color: #d9534f; }
.popup .box p  { margin: 0 0 14px; }

/* === Footer === */
footer {
  background-color: #003366;
  color: white;
  text-align: center;
  padding: 10px;
  margin-top: 40px;
  position: relative;
  z-index: 1;
}

/* === Responsive === */
@media (max-width: 768px) {
  .form-container { width: 95%; padding: 20px; }
  .prestito-box   { width: 95%; }
  .book-header    { flex-direction: column; align-items: center; }
}

@media (max-width: 420px) {
  .cards-grid .card { padding: 16px; font-size: 0.95rem; }
}
