/* =========================================
   VARIABILI GLOBALI E COLORI
========================================= */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --bg-body: #f3f4f6;
    
    /* Effetti Glass */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

/* =========================================
   RESET E IMPOSTAZIONI BASE
========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'Roboto', 'Segoe UI', sans-serif;
    background: var(--bg-body) url('https://images.unsplash.com/photo-1507842217343-583bb7270b66?ixlib=rb-4.0.3&auto=format&fit=crop&w=2000&q=80') no-repeat center center fixed;
    background-size: cover;
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
}

/* Overlay per scurire leggermente l'immagine di sfondo */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(243, 244, 246, 0.75); /* Sfondo chiaro semitrasparente */
    backdrop-filter: blur(10px); /* Sfocatura per risaltare i contenuti */
    z-index: -1;
}

/* =========================================
   TIPOGRAFIA
========================================= */
h1, h2, h3 {
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1rem;
    text-align: center;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

/* =========================================
   LAYOUT PRINCIPALE (HEADER E SIDEBAR)
========================================= */
.sidebar {
    width: 250px;
    height: 100vh;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    position: fixed;
    top: 0;
    left: 0;
    padding: 20px;
    box-shadow: var(--glass-shadow);
    z-index: 100;
}

.sidebar h2 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--primary);
    text-align: center;
}

.sidebar ul {
    list-style: none;
}

.sidebar ul li {
    margin-bottom: 10px;
}

.sidebar ul li a {
    display: block;
    padding: 12px 15px;
    color: var(--text-main);
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.sidebar ul li a:hover {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

.main-content {
    margin-left: 250px;
    padding: 40px;
    max-width: 1200px;
}

/* =========================================
   COMPONENTI UI: GLASS BOX
========================================= */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--glass-shadow);
    margin-bottom: 30px;
}

/* =========================================
   FORM, INPUT E BOTTONI
========================================= */
input[type="text"], 
input[type="password"], 
input[type="number"], 
select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.8);
    transition: border-color 0.3s, box-shadow 0.3s;
    margin-bottom: 15px;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

button {
    display: inline-block;
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    text-align: center;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

button.success { background: var(--success); }
button.success:hover { background: var(--success-hover); }

button.danger { background: var(--danger); }
button.danger:hover { background: var(--danger-hover); }

/* =========================================
   GRIGLIA LIBRI (HOMEPAGE)
========================================= */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.book-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.book-cover {
    width: 100%;
    height: 280px;
    object-fit: cover;
    background-color: #e5e7eb;
}

.book-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.book-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 5px;
    line-height: 1.2;
}

.book-author {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.book-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge.disponibile {
    background: #d1fae5;
    color: #065f46;
}

.badge.in_prestito {
    background: #fee2e2;
    color: #991b1b;
}

.btn-prenota {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* =========================================
   TABELLE (ADMIN)
========================================= */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

th {
    background: #f9fafb;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.85rem;
}

tr:last-child td { border-bottom: none; }
tr:hover { background: #f9fafb; }

/* =========================================
   PAGINAZIONE E UTILITA'
========================================= */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.pagination a, .pagination span {
    padding: 8px 16px;
    border-radius: 6px;
    background: white;
    color: var(--text-main);
    text-decoration: none;
    border: 1px solid #d1d5db;
    transition: all 0.2s;
}

.pagination a:hover {
    background: #f3f4f6;
}

.pagination .current {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.top-right-nav {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 15px;
    z-index: 10;
}

.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto 30px auto;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: var(--text-muted);
}

.search-container input {
    padding-left: 45px;
    border-radius: 30px;
    margin-bottom: 0;
}