/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #00A651 0%, #005B2F 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Estilos del login */
.login-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 450px;
    animation: slideUp 0.6s ease-out;
}

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

.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    text-align: center;
    margin-bottom: 30px;
}

.logo img {
    max-width: 150px;
    height: auto;
}

.logo h1 {
    color: #00A651;
    font-size: 2.5em;
    margin-bottom: 10px;
}

.logo p {
    color: #666;
    font-size: 1.1em;
}

/* Alertas */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-error {
    background-color: #fee;
    color: #c53030;
    border: 1px solid #fed7d7;
}

.alert-success {
    background-color: #f0fff4;
    color: #22543d;
    border: 1px solid #c6f6d5;
}

/* Tabs */
.form-tabs {
    display: flex;
    margin-bottom: 25px;
    border-bottom: 2px solid #f1f1f1;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: none;
    border: none;
    font-size: 1em;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    color: #00A651;
    border-bottom-color: #00A651;
}

.tab-btn:hover {
    color: #00A651;
}

/* Formularios */
.form-tab {
    display: none;
}

.form-tab.active {
    display: block;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #00A651;
    box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.1);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.9em;
}

/* Botones */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #00A651 0%, #005B2F 100%);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 166, 81, 0.3);
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-danger {
    background: #e53e3e;
    color: white;
}

.btn-danger:hover {
    background: #c53030;
}

.btn-success {
    background: #38a169;
    color: white;
}

.btn-success:hover {
    background: #2f855a;
}

/* Dashboard */
.dashboard {
    width: 90%;
    max-width: none;
    margin: 0 auto;
    padding: 20px;
    min-width: 1000px; /* Ancho mínimo para evitar que se comprima demasiado */
}

.header {
    background: white;
    padding: 18px 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: #333;
    font-size: 2em;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    color: #666;
    font-weight: 500;
}

/* Cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.card {
    background: white;
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 14px rgba(0,0,0,.13);
}

.card h3 {
    color: #555;
    margin-bottom: 6px;
    font-size: 0.82em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ── Tab system ── */
.admin-tabs {
    display: flex;
    gap: 4px;
    background: white;
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    margin-bottom: 16px;
}

.admin-tab-btn {
    flex: 1;
    padding: 10px 8px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #666;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all .18s ease;
    white-space: nowrap;
}

.admin-tab-btn:hover {
    background: #f0faf4;
    color: #00A651;
}

.admin-tab-btn.active {
    background: linear-gradient(135deg, #00A651 0%, #005B2F 100%);
    color: white;
    box-shadow: 0 3px 10px rgba(0,166,81,.35);
}

.admin-tab-panel {
    display: none;
}

.admin-tab-panel.active {
    display: block;
}

/* Tabla */
.table-container {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    margin-bottom: 25px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.table th,
.table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9em;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.table tr:hover {
    background: #f8f9fa;
}

/* Estados */
.status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
}

.status-disponible {
    background: #c6f6d5;
    color: #22543d;
}

.status-prestado {
    background: #fed7d7;
    color: #c53030;
}

.status-activo {
    background: #bee3f8;
    color: #2a69ac;
}

.status-devuelto {
    background: #c6f6d5;
    color: #22543d;
}

.status-vencido {
    background: #fed7d7;
    color: #c53030;
}

/* ── Tarjetas de condición en modal devolución ── */
.dev-cond-card {
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 10px;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
    background: #fff;
    user-select: none;
}

.dev-cond-card:hover {
    border-color: #b0c4de;
    background: #f8f9fa;
}

.dev-cond-active {
    border-color: #00A651 !important;
    background: #e6f7ee !important;
    box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.15);
}

.dev-cond-active p { color: #005B2F !important; }

.dev-cond-danger.dev-cond-active {
    border-color: #c53030 !important;
    background: #fff5f5 !important;
    box-shadow: 0 0 0 3px rgba(197, 48, 48, 0.12);
}

.dev-cond-danger.dev-cond-active p { color: #c53030 !important; }

/* ── Filas de accesorios en modal devolución ── */
.dev-acc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    background: #fff;
    transition: background 0.12s;
}

.dev-acc-row:hover { background: #f8fffe; }

.dev-acc-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 99px;
    letter-spacing: 0.03em;
}

.dev-acc-ok {
    background: #e6f7ee;
    color: #005B2F;
}

.dev-acc-no {
    background: #f1f1f1;
    color: #888;
}

/* Chips de accesorios */
label.acc-chip,
.modal-content label.acc-chip,
.modal-content .form-group label.acc-chip {
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 99px;
    font-size: 0.88em !important;
    font-weight: 500;
    color: #555 !important;
    background: #f9fafb;
    cursor: pointer;
    user-select: none;
    text-transform: none !important;
    letter-spacing: normal !important;
    transition: all 0.18s ease;
    margin-bottom: 0;
}

label.acc-chip:hover,
.modal-content .form-group label.acc-chip:hover {
    border-color: #00A651;
    color: #00A651 !important;
    background: #f0faf4;
}

label.acc-chip.acc-chip--on,
.modal-content .form-group label.acc-chip.acc-chip--on {
    background: #e6f7ee;
    border-color: #00A651;
    color: #005B2F !important;
    font-weight: 600;
    box-shadow: 0 0 0 2px rgba(0,166,81,0.15);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 4% auto;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 520px;
    position: relative;
    animation: slideUp 0.3s ease-out;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
    overflow: hidden;
}

.modal-content h2 {
    margin: 0;
    padding: 22px 28px 18px;
    font-size: 1.25em;
    color: #1a202c;
    border-bottom: 1px solid #edf2f7;
    background: linear-gradient(135deg,#f8fffe 0%,#f0faf4 100%);
}

.modal-content form {
    padding: 22px 28px 24px;
}

.modal-content .close {
    top: 18px;
    right: 22px;
    color: #999;
    font-size: 24px;
}

.modal-content .form-group label {
    font-size: 0.88em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #4a5568;
}

.modal-content .form-group input[type="text"],
.modal-content .form-group input[type="email"],
.modal-content .form-group input[type="number"],
.modal-content .form-group input[type="password"],
.modal-content .form-group textarea,
.modal-content .form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 9px;
    font-size: 0.95em;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafafa;
}

.modal-content .form-group input:focus,
.modal-content .form-group textarea:focus,
.modal-content .form-group select:focus {
    outline: none;
    border-color: #00A651;
    box-shadow: 0 0 0 3px rgba(0,166,81,0.1);
    background: #fff;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

/* Responsive */
@media (max-width: 1200px) {
    .dashboard {
        width: 95%;
        min-width: 800px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .login-container {
        padding: 30px 20px;
    }
    
    .dashboard {
        width: 98%;
        min-width: auto;
        padding: 15px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px 20px;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .table-container {
        padding: 15px;
    }
    
    .table th,
    .table td {
        padding: 8px 10px;
        font-size: 0.85em;
    }
}
/* 
Estilos adicionales para optimizar el espacio */
.table-container h2 {
    margin-bottom: 15px;
    font-size: 1.4em;
}

/* Hacer botones más compactos en las tablas */
.table .btn {
    padding: 6px 12px;
    font-size: 0.85em;
    margin: 2px;
}

/* Optimizar el espacio en los formularios de filtro */
.table-container input[type="text"] {
    padding: 8px 12px;
    font-size: 0.9em;
    max-width: 300px;
}

/* Mejorar la visualización de estados */
.status {
    padding: 3px 10px;
    font-size: 0.8em;
    white-space: nowrap;
}

/* Optimizar el espacio en la información de préstamos */
.table td div {
    line-height: 1.3;
}

.table td input[type="date"] {
    font-size: 0.8em;
    padding: 3px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 130px;
}

/* Hacer que las columnas de acciones sean más estrechas */
.table th:last-child,
.table td:last-child {
    width: 120px;
    text-align: center;
}

/* Optimizar el espacio en los modales */
.modal-content {
    width: 85%;
    max-width: 600px;
}

/* Mejorar la visualización en pantallas grandes */
@media (min-width: 1400px) {
    .dashboard {
        width: 90%;
        max-width: 2200px;
    }
}

/* Estilos para hacer las tablas más densas */
.table-dense .table th,
.table-dense .table td {
    padding: 8px 10px;
    font-size: 0.85em;
}

.table-dense .table {
    font-size: 0.9em;
}

/* Mejorar la legibilidad de texto pequeño */
.table small {
    font-size: 0.75em;
    color: #666;
    display: block;
    margin-top: 2px;
}