/* ============================================
   BiblioIECAN - Diseño Dark Theme Premium
   ============================================ */

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

/* Estilos base */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
    color: #f8fafc;
}

/* Header con glassmorphism */
header {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    color: white;
    padding: 15px 0;
    width: 100%;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.header-left,
.header-center,
.header-right {
    flex: 1;
    text-align: center;
}

.header-img {
    width: 90px;
    height: auto;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    border: 3px solid rgba(255, 255, 255, 0.1);
}

.header-center h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 600;
    background: linear-gradient(135deg, #f8fafc 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.header-img2 {
    width: 50px;
    height: auto;
}

.header-link {
    color: #f8fafc;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 12px;
    background: rgba(249, 115, 22, 0.2);
    border: 1px solid rgba(249, 115, 22, 0.3);
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 14px;
}

.header-link:hover {
    background: rgba(249, 115, 22, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(249, 115, 22, 0.25);
}

main {
    flex: 1;
    padding: 20px 0;
}

.full-screen {
    width: 100%;
    min-height: 100vh;
    padding: 20px;
}

/* Contenedores principales con glassmorphism */
.search-container,
.admin-container,
.login-container,
.catalog-container,
.container {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    padding: 35px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    margin-bottom: 30px;
}

.search-container h2,
.admin-container h2,
.login-container h2,
.catalog-container h2,
.container h2 {
    color: #f8fafc;
    margin-bottom: 25px;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.search-container h2::after,
.admin-container h2::after,
.login-container h2::after,
.catalog-container h2::after,
.container h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, #f97316, #ea580c);
    margin: 12px auto 0;
    border-radius: 2px;
}

/* Formularios */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    color: #94a3b8;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 14px;
}

select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea {
    width: 100%;
    max-width: 400px;
    padding: 14px 18px;
    font-size: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #f8fafc;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
}

select option {
    background: #1e293b;
    color: #f8fafc;
}

input::placeholder,
textarea::placeholder {
    color: #64748b;
}

select:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
textarea:focus {
    border-color: #f97316;
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15);
    background: rgba(255, 255, 255, 0.08);
}

select:hover,
input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
input[type="date"]:hover,
textarea:hover {
    border-color: rgba(249, 115, 22, 0.5);
}

/* Botones */
button {
    padding: 14px 28px;
    font-size: 15px;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    margin: 5px;
    transition: all 0.3s ease;
    font-weight: 600;
    font-family: inherit;
    box-shadow: 0 8px 25px rgba(249, 115, 22, 0.3);
}

button:hover {
    background: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(249, 115, 22, 0.4);
}

button:active {
    transform: translateY(-1px);
}

button:disabled {
    background: #475569;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

/* Navigation buttons box */
.nav-box {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: 14px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.35);
}

.nav-btn.loans {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
}

.nav-btn.catalogo {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.nav-btn.requests {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.nav-btn.history {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.nav-btn.active {
    outline: 3px solid rgba(255,255,255,0.25);
    transform: translateY(-2px) scale(1.02);
}

/* Botones especiales */
.edit-btn {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    padding: 8px 14px;
    font-size: 13px;
    margin: 2px;
    box-shadow: 0 6px 18px rgba(14, 165, 233, 0.25);
}

.edit-btn:hover {
    background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%);
}

.delete-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    padding: 8px 14px;
    font-size: 13px;
    margin: 2px;
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.25);
}

.delete-btn:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
}

.schedule-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    padding: 8px 14px;
    font-size: 13px;
    margin: 2px;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.25);
}

.schedule-btn:hover {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
}

.cancel-btn,
.reset-btn {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    padding: 10px 16px;
    font-size: 14px;
    margin: 2px;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(100, 116, 139, 0.25);
}

.cancel-btn:hover,
.reset-btn:hover {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}

/* Search card */
.search-card {
    max-width: 800px;
    margin: 30px auto;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 35px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
    text-align: center;
}

.search-card .search-subtitle {
    margin: 0 0 20px 0;
    color: #94a3b8;
    font-size: 15px;
}

.search-form {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: stretch;
}

.search-input {
    flex: 1;
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: #f8fafc;
    max-width: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #f97316;
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15);
}

.search-input::placeholder {
    color: #64748b;
}

.form-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.search-btn {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #fff;
    border: none;
    padding: 14px 28px;
    font-size: 15px;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(249, 115, 22, 0.3);
    transition: all 0.3s ease;
    font-weight: 600;
}

.search-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(249, 115, 22, 0.4);
}

/* Search section */
.search-section {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 25px;
}

.search-section input {
    max-width: 350px;
}

/* Book grid and card styles */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.book-card {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    padding: 18px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.book-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #f97316, #ea580c);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.book-card:hover {
    transform: translateY(-6px);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(249, 115, 22, 0.3);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.4);
}

.book-card:hover::before {
    opacity: 1;
}

.book-cover {
    width: 75px;
    height: 105px;
    object-fit: cover;
    border-radius: 10px;
    flex: 0 0 75px;
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.book-meta {
    flex: 1;
    min-width: 0;
}

.book-title {
    margin: 0 0 6px 0;
    font-size: 16px;
    font-weight: 700;
    color: #f8fafc;
}

.book-author {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #94a3b8;
}

.book-category {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.book-available {
    font-size: 13px;
    color: #4ade80;
    font-weight: 600;
}

.book-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-request {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    padding: 10px 14px;
    border-radius: 10px;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    box-shadow: 0 6px 18px rgba(14, 165, 233, 0.25);
}

.btn-request:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(14, 165, 233, 0.35);
}

.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
    border: 1px solid rgba(249, 115, 22, 0.2);
}

.highlight {
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.3), rgba(251, 146, 60, 0.3));
    padding: 2px 4px;
    border-radius: 4px;
    color: #fb923c;
}

/* Modal / Request form */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.85);
    z-index: 1200;
    padding: 24px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn .2s ease both;
}

.modal-content {
    width: 100%;
    max-width: 520px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
    position: relative;
    color: #f8fafc;
}

.modal .close {
    position: absolute;
    right: 18px;
    top: 14px;
    font-size: 28px;
    color: #94a3b8;
    cursor: pointer;
    background: transparent;
    border: none;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal .close:hover {
    color: #f8fafc;
}

.modal-content h3 {
    margin: 0 0 20px 0;
    font-size: 22px;
    color: #f8fafc;
    font-weight: 700;
}

.modal .form-group {
    margin-bottom: 16px;
    text-align: left;
}

.modal .form-group label {
    display: block;
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 8px;
    font-weight: 500;
}

.modal .form-group input,
.modal .form-group select,
.modal .form-group textarea {
    width: 100%;
    max-width: none;
    padding: 14px 16px;
    font-size: 15px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #f8fafc;
    transition: all 0.2s ease;
}

.modal .form-group input:focus,
.modal .form-group select:focus,
.modal .form-group textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
    border-color: #f97316;
}

.modal .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal .form-actions button {
    border-radius: 12px;
    padding: 12px 20px;
    font-weight: 600;
}

.modal .form-actions button[type="submit"] {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    box-shadow: 0 8px 25px rgba(249, 115, 22, 0.3);
}

.modal .form-actions button[type="button"] {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    color: #f8fafc;
    box-shadow: none;
}

.success-message {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(74, 222, 128, 0.2);
    margin-top: 12px;
}

.error-message {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(248, 113, 113, 0.2);
    margin-top: 12px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Spinner */
.spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #f97316;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Headings */
h2 {
    font-size: 28px;
    color: #f8fafc;
    letter-spacing: -0.5px;
    font-weight: 700;
}

h3 {
    font-size: 20px;
    color: #f8fafc;
    margin-top: 25px;
    font-weight: 600;
}

/* Tablas */
.table-container {
    margin-top: 25px;
    overflow-x: auto;
    border-radius: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

table th,
table td {
    padding: 16px 14px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

table th {
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.8px;
}

table td {
    color: #f8fafc;
    font-size: 14px;
}

table tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

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

.action-buttons {
    white-space: nowrap;
}

.loading-text,
.no-results {
    text-align: center;
    color: #64748b;
    font-style: italic;
    padding: 50px 20px;
}

/* Login específico */
.login-card {
    max-width: 420px;
    margin: 40px auto;
    padding: 45px 35px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

.login-subtitle {
    color: #94a3b8;
    margin-bottom: 30px;
    font-size: 15px;
}

.login-container input {
    max-width: 100%;
}

/* Form sections */
.form-section {
    background: rgba(255, 255, 255, 0.03);
    padding: 25px;
    border-radius: 16px;
    margin: 25px 0;
    border-left: 4px solid #f97316;
}

.form-section h3 {
    color: #fb923c;
    margin-top: 0;
    font-size: 18px;
    font-weight: 600;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 250px;
}

/* Edit form */
.edit-form {
    background: rgba(255, 255, 255, 0.03);
    padding: 30px;
    border-radius: 20px;
    margin-top: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.edit-form h3 {
    color: #f8fafc;
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 22px;
    font-weight: 700;
}

/* CSV/Excel upload section */
.csv-upload {
    background: rgba(255, 255, 255, 0.03);
    padding: 20px;
    border-radius: 16px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.csv-upload h4 {
    color: #94a3b8;
    margin: 0 0 12px 0;
    font-weight: 500;
}

.csv-upload input[type="file"] {
    color: #94a3b8;
}

/* Footer */
footer {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: #64748b;
    padding: 25px 0;
    text-align: center;
    width: 100%;
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-container p {
    margin: 0;
    font-size: 13px;
}

/* Recommended and Results sections */
.recommended-section,
.results-section {
    margin-top: 40px;
}

.recommended-section h3,
.results-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 12px;
        padding: 15px;
    }

    .header-center h1 {
        font-size: 20px;
    }

    .header-img {
        width: 70px;
    }

    .header-link {
        margin: 2px;
        padding: 8px 16px;
        font-size: 13px;
    }

    .admin-container,
    .login-container,
    .search-container,
    .catalog-container,
    .container {
        padding: 20px;
        margin: 10px;
        border-radius: 18px;
    }

    .nav-box {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-btn {
        justify-content: center;
    }

    .search-form {
        flex-direction: column;
    }

    .form-row {
        flex-direction: column;
    }

    .form-row .form-group {
        min-width: 100%;
    }

    table {
        font-size: 13px;
    }

    table th,
    table td {
        padding: 12px 10px;
    }

    .action-buttons {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .edit-btn,
    .delete-btn,
    .schedule-btn {
        width: 100%;
        margin: 2px 0;
    }

    .book-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header-center h1 {
        font-size: 16px;
    }

    .admin-container h2,
    .login-container h2,
    .search-container h2 {
        font-size: 22px;
    }

    button {
        padding: 12px 20px;
        font-size: 14px;
    }
}