/* --- McLector Estilo Vibrante y Funcional --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 40px;
}

h1 {
    color: #333;
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.5em;
}

h3 {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-weight: normal;
}

/* Botones con degradados vibrantes */
.btn, button {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    color: white;
}

.btn-primary, #btnPlay {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-secondary {
    background: #4caf50;
}

.btn-danger {
    background: #f44336;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    filter: brightness(1.1);
}

/* Bibliotecas */
.books-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 40px 25px;
    padding: 40px;
    background-color: #4e342e;
    background-image: repeating-linear-gradient(90deg, rgba(255,255,255,0.03) 0px, rgba(255,255,255,0.03) 1px, transparent 1px, transparent 10px), linear-gradient(to bottom, #6d4c41, #3e2723);
    border: 15px solid #3e2723;
    border-radius: 8px;
    box-shadow: inset 0 0 80px rgba(0,0,0,0.7), 0 10px 20px rgba(0,0,0,0.3);
}

.book-card {
    background: white;
    border-radius: 10px;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 2px solid #e0e0e0;
}

.book-card:hover {
    border-color: #667eea;
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.book-cover {
    width: 100%;
    height: 250px;
    background: #f0f0f0;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    position: relative;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Imágenes enteras */
}

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

.book-title {
    color: #333;
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-info {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 4px;
}

.book-info strong {
    color: #667eea;
}

/* Controles de Administración (Siempre Visibles) */
.book-card-admin-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.book-delete-btn, .transfer-book-btn {
    color: #333;
    background: #eee;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    border: 1px solid #ddd;
}

.book-delete-btn:hover { background: #f44336; color: white; }
.transfer-book-btn:hover { background: #2196f3; color: white; }

.public-toggle-wrapper {
    display: flex;
    align-items: center;
}

.public-toggle-label {
    width: 24px;
    height: 24px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23666666'%3E%3Cpath d='M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.public-toggle-checkbox:checked + .public-toggle-label {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234caf50'%3E%3Cpath d='M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z'/%3E%3C/svg%3E");
}

/* Sala de Lectura */
.reader-section {
    display: none;
    margin-top: 30px;
    background-color: #fdfaf6;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    border: 1px solid #ddd;
}

.reader-text-preview {
    font-family: 'Georgia', serif;
    background: #000 !important; /* Fondo negro puro para máximo contraste */
    color: #fff !important; /* Blanco puro */
    border-radius: 20px;
    padding: 40px;
    font-size: 1.5em;
    line-height: 1.6;
    height: 500px; /* Tamaño amplio y fijo */
    overflow-y: auto; /* Scroll interno si el texto es muy largo */
    margin-bottom: 20px;
    border: 4px solid #ffc107 !important;
    box-shadow: 0 15px 40px rgba(0,0,0,0.5), 0 0 30px rgba(255, 193, 7, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

/* Cargadores */
.loading {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

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

#loadingProgressBar {
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px;
    border-radius: 8px;
    z-index: 3000;
    color: white;
}

.status.success { background: #4caf50; }
.status.error { background: #f44336; }
.status.info { background: #2196f3; }
